org.eclipse.swt.graphics.GC.getDevice()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(185)

本文整理了Java中org.eclipse.swt.graphics.GC.getDevice()方法的一些代码示例,展示了GC.getDevice()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GC.getDevice()方法的具体详情如下:
包路径:org.eclipse.swt.graphics.GC
类名称:GC
方法名:getDevice

GC.getDevice介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void drawImage( EImage image, int x, int y, float magnification, double angle ) {
 Image img =
   getNativeImage( image ).getAsBitmapForSize( gc.getDevice(), Math.round( small_icon_size * magnification ),
     Math.round( small_icon_size * magnification ), angle );
 if ( img != null ) {
  Rectangle bounds = img.getBounds();
  int hx = Math.round( bounds.width / magnification );
  int hy = Math.round( bounds.height / magnification );
  gc.drawImage( img, 0, 0, bounds.width, bounds.height, x - hx / 2, y - hy / 2, hx, hy );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void drawImage( EImage image, int x, int y, float magnification, double angle ) {
 Image img =
   getNativeImage( image ).getAsBitmapForSize( gc.getDevice(), Math.round( small_icon_size * magnification ),
     Math.round( small_icon_size * magnification ), angle );
 if ( img != null ) {
  Rectangle bounds = img.getBounds();
  int hx = Math.round( bounds.width / magnification );
  int hy = Math.round( bounds.height / magnification );
  gc.drawImage( img, 0, 0, bounds.width, bounds.height, x - hx / 2, y - hy / 2, hx, hy );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public Point getDeviceBounds() {
 org.eclipse.swt.graphics.Rectangle p = gc.getDevice().getBounds();
 return new Point( p.width, p.height );
}

代码示例来源:origin: pentaho/pentaho-kettle

public Point getDeviceBounds() {
 org.eclipse.swt.graphics.Rectangle p = gc.getDevice().getBounds();
 return new Point( p.width, p.height );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawStepIcon( int x, int y, StepMeta stepMeta, float magnification ) {
 String steptype = stepMeta.getStepID();
 Image im =
   images.get( steptype ).getAsBitmapForSize( gc.getDevice(), Math.round( iconsize * magnification ),
     Math.round( iconsize * magnification ) );
 if ( im != null ) { // Draw the icon!
  org.eclipse.swt.graphics.Rectangle bounds = im.getBounds();
  gc.drawImage( im, 0, 0, bounds.width, bounds.height, x, y, iconsize, iconsize );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawImage( EImage image, int x, int y, int width, int height, float magnification ) {
 Image img = getNativeImage( image ).getAsBitmapForSize( gc.getDevice(), Math.round( width * magnification ),
   Math.round( height * magnification ) );
 if ( img != null ) {
  Rectangle bounds = img.getBounds();
  gc.drawImage( img, 0, 0, bounds.width, bounds.height, x, y, width, height );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawImage( EImage image, int x, int y, int width, int height, float magnification ) {
 Image img =
   getNativeImage( image ).getAsBitmapForSize( gc.getDevice(), Math.round( width * magnification ),
     Math.round( height * magnification ) );
 if ( img != null ) {
  Rectangle bounds = img.getBounds();
  gc.drawImage( img, 0, 0, bounds.width, bounds.height, x, y, width, height );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawImage( EImage image, int x, int y, float magnification ) {
 Image img = getNativeImage( image ).getAsBitmapForSize( gc.getDevice(), Math.round( small_icon_size * magnification ),
   Math.round( small_icon_size * magnification ) );
 if ( img != null ) {
  Rectangle bounds = img.getBounds();
  gc.drawImage( img, 0, 0, bounds.width, bounds.height, x, y, small_icon_size, small_icon_size );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawImage( EImage image, int x, int y, float magnification ) {
 Image img =
   getNativeImage( image ).getAsBitmapForSize( gc.getDevice(), Math.round( small_icon_size * magnification ),
     Math.round( small_icon_size * magnification ) );
 if ( img != null ) {
  Rectangle bounds = img.getBounds();
  gc.drawImage( img, 0, 0, bounds.width, bounds.height, x, y, small_icon_size, small_icon_size );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void drawImage( BufferedImage image, int x, int y ) {
  ImageData imageData = ImageUtil.convertToSWT( image );
  Image swtImage = new Image( gc.getDevice(), imageData );
  gc.drawImage( swtImage, x, y );
  swtImage.dispose();
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public void drawImage( BufferedImage image, int x, int y ) {
  ImageData imageData = ImageUtil.convertToSWT( image );
  Image swtImage = new Image( gc.getDevice(), imageData );
  gc.drawImage( swtImage, x, y );
  swtImage.dispose();
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setTransform( float translationX, float translationY, int shadowsize, float magnification ) {
 if ( transform != null ) { // dispose of previous to prevent leaking of handles
  transform.dispose();
 }
 transform = new Transform( gc.getDevice() );
 transform.translate( translationX + shadowsize * magnification, translationY + shadowsize * magnification );
 transform.scale( magnification, magnification );
 gc.setTransform( transform );
 currentMagnification = magnification;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setTransform( float translationX, float translationY, int shadowsize, float magnification ) {
 if ( transform != null ) { // dispose of previous to prevent leaking of handles
  transform.dispose();
 }
 transform = new Transform( gc.getDevice() );
 transform.translate( translationX + shadowsize * magnification, translationY + shadowsize * magnification );
 transform.scale( magnification, magnification );
 gc.setTransform( transform );
 currentMagnification = magnification;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawStepIcon( int x, int y, StepMeta stepMeta, float magnification ) {
 String steptype = stepMeta.getStepID();
 Image im = null;
 if ( stepMeta.isMissing() ) {
  im = GUIResource.getInstance().getImageMissing();
 } else if ( stepMeta.isDeprecated() ) {
  im = GUIResource.getInstance().getImageDeprecated();
 } else {
  im =
    images.get( steptype ).getAsBitmapForSize( gc.getDevice(), Math.round( iconsize * magnification ),
      Math.round( iconsize * magnification ) );
 }
 if ( im != null ) { // Draw the icon!
  org.eclipse.swt.graphics.Rectangle bounds = im.getBounds();
  gc.drawImage( im, 0, 0, bounds.width, bounds.height, x, y, iconsize, iconsize );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawJobEntryIcon( int x, int y, JobEntryCopy jobEntryCopy, float magnification ) {
 if ( jobEntryCopy == null ) {
  return; // Don't draw anything
 }
 SwtUniversalImage swtImage = null;
 int w = Math.round( iconsize * magnification );
 int h = Math.round( iconsize * magnification );
 if ( jobEntryCopy.isSpecial() ) {
  if ( jobEntryCopy.isStart() ) {
   swtImage = GUIResource.getInstance().getSwtImageStart();
  }
  if ( jobEntryCopy.isDummy() ) {
   swtImage = GUIResource.getInstance().getSwtImageDummy();
  }
 } else {
  String configId = jobEntryCopy.getEntry().getPluginId();
  if ( configId != null ) {
   swtImage = GUIResource.getInstance().getImagesJobentries().get( configId );
  }
 }
 if ( swtImage == null ) {
  return;
 }
 Image image = swtImage.getAsBitmapForSize( gc.getDevice(), w, h );
 org.eclipse.swt.graphics.Rectangle bounds = image.getBounds();
 gc.drawImage( image, 0, 0, bounds.width, bounds.height, x, y, iconsize, iconsize );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void drawJobEntryIcon( int x, int y, JobEntryCopy jobEntryCopy, float magnification ) {
 if ( jobEntryCopy == null ) {
  return; // Don't draw anything
 }
 SwtUniversalImage swtImage = null;
 int w = Math.round( iconsize * magnification );
 int h = Math.round( iconsize * magnification );
 if ( jobEntryCopy.isSpecial() ) {
  if ( jobEntryCopy.isStart() ) {
   swtImage = GUIResource.getInstance().getSwtImageStart();
  }
  if ( jobEntryCopy.isDummy() ) {
   swtImage = GUIResource.getInstance().getSwtImageDummy();
  }
 } else {
  String configId = jobEntryCopy.getEntry().getPluginId();
  if ( configId != null ) {
   swtImage = GUIResource.getInstance().getImagesJobentries().get( configId );
  }
 }
 if ( jobEntryCopy.isMissing() ) {
  swtImage = GUIResource.getInstance().getSwtImageMissing();
 }
 if ( swtImage == null ) {
  return;
 }
 Image image = swtImage.getAsBitmapForSize( gc.getDevice(), w, h );
 org.eclipse.swt.graphics.Rectangle bounds = image.getBounds();
 gc.drawImage( image, 0, 0, bounds.width, bounds.height, x, y, iconsize, iconsize );
}

代码示例来源:origin: org.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
public Path createPath ()
{
  return new Path ( this.gc.getDevice () );
}

代码示例来源:origin: BiglySoftware/BiglyBT

public static Font getAnyFontBoldItalic(GC gc) {
  if (fontBoldItalic == null || fontBoldItalic.isDisposed()) {
    FontData[] fontData = gc.getFont().getFontData();
    for (FontData fd : fontData) {
      fd.setStyle(SWT.BOLD | SWT.ITALIC);
    }
    fontBoldItalic = new Font(gc.getDevice(), fontData);
  }
  return fontBoldItalic;
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
public void setBackground ( final RGB color )
{
  if ( color != null )
  {
    this.gc.setBackground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
  }
  else
  {
    this.gc.setBackground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_BACKGROUND ) );
  }
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
public void setForeground ( final RGB color )
{
  if ( color != null )
  {
    this.gc.setForeground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
  }
  else
  {
    this.gc.setForeground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_FOREGROUND ) );
  }
}

相关文章

GC类方法