public void drawImage( String location, ClassLoader classLoader, int x, int y ) { Image img = SwtSvgImageUtil.getImage( PropsUI.getDisplay(), classLoader, location, Math.round( small_icon_size * currentMagnification ), Math.round( small_icon_size * currentMagnification ) ); if ( img != null ) { Rectangle bounds = img.getBounds(); gc.drawImage( img, 0, 0, bounds.width, bounds.height, x, y, small_icon_size, small_icon_size ); } }
private Rectangle getAddSize( GC gc ) { Rectangle is = imageAdd.getBounds(); // image size Rectangle cs = getBounds(); // Canvas size return new Rectangle( cs.width - is.width - 5 - X_PADDING, 5, is.width, is.height ); }
public void drawImage( String location, ClassLoader classLoader, int x, int y ) { Image img = SwtSvgImageUtil.getImage( PropsUI.getDisplay(), classLoader, location, Math.round( small_icon_size * currentMagnification ), Math.round( small_icon_size * currentMagnification ) ); if ( img != null ) { Rectangle bounds = img.getBounds(); gc.drawImage( img, 0, 0, bounds.width, bounds.height, x, y, small_icon_size, small_icon_size ); } }
@Override protected Image renderSimple( Device device, int width, int height ) { int xsize = bitmap.getBounds().width; int ysize = bitmap.getBounds().height; Image result = new Image( device, width, height ); GC gc = new GC( result ); gc.drawImage( bitmap, 0, 0, xsize, ysize, 0, 0, width, height ); gc.dispose(); return result; }
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 ); } }
@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 ); } }
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 ); } }
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 ); } }
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 ); } }
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 ); } }
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 ); } }
private void setWarningIcon( Display display ) { warningIcon = new Label( shell, SWT.NONE ); Image image = display.getSystemImage( SWT.ICON_WARNING ); warningIcon.setImage( image ); props.setLook( warningIcon ); FormData fdIcon = new FormData(); fdIcon.left = new FormAttachment( 0, 0 ); fdIcon.top = new FormAttachment( 0, 0 ); fdIcon.right = new FormAttachment( 0, image.getBounds().width ); fdIcon.bottom = new FormAttachment( 0, image.getBounds().height ); //icon should be at the top left corner warningIcon.setLayoutData( fdIcon ); }
@Override protected Image renderRotated( Device device, int width, int height, double angleRadians ) { Image result = new Image( device, width * 2, height * 2 ); GC gc = new GC( result ); int bw = bitmap.getBounds().width; int bh = bitmap.getBounds().height; Transform affineTransform = new Transform( device ); affineTransform.translate( width, height ); affineTransform.rotate( (float) Math.toDegrees( angleRadians ) ); affineTransform.scale( (float) 1.0 * width / bw, (float) 1.0 * height / bh ); gc.setTransform( affineTransform ); gc.drawImage( bitmap, 0, 0, bw, bh, -bw / 2, -bh / 2, bw, bh ); gc.dispose(); return result; } }
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 ); } }
/** * Setting the layout of an <i>Edit</i> option button. Either a button image is set - if existing - or a text. * * @param button * The button */ private FormData layoutEditOptionButton( Button button ) { FormData fd = new FormData(); Image editButton = GUIResource.getInstance().getEditOptionButton(); if ( editButton != null ) { button.setImage( editButton ); button.setBackground( GUIResource.getInstance().getColorWhite() ); fd.width = editButton.getBounds().width + 20; fd.height = editButton.getBounds().height; } else { button.setText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit" ) ); } button.setToolTipText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit.Tooltip" ) ); return fd; }
/** * Setting the layout of a <i>Reset</i> option button. Either a button image is set - if existing - or a text. * * @param button * The button */ private FormData layoutResetOptionButton( Button button ) { FormData fd = new FormData(); Image editButton = GUIResource.getInstance().getResetOptionButton(); if ( editButton != null ) { button.setImage( editButton ); button.setBackground( GUIResource.getInstance().getColorWhite() ); fd.width = editButton.getBounds().width + 20; fd.height = editButton.getBounds().height; } else { button.setText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Reset" ) ); } button.setToolTipText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Reset.Tooltip" ) ); return fd; }
public void paintControl( PaintEvent e ) { Point area = getArea(); if ( area.x == 0 || area.y == 0 ) { return; // nothing to do! } Display disp = shell.getDisplay(); Image img = getTransformationImage( disp, area.x, area.y, magnification ); e.gc.drawImage( img, 0, 0 ); if ( transMeta.nrSteps() == 0 ) { e.gc.setForeground( GUIResource.getInstance().getColorCrystalTextPentaho() ); e.gc.setFont( GUIResource.getInstance().getFontMedium() ); Image pentahoImage = GUIResource.getInstance().getImageTransCanvas(); int leftPosition = ( area.x - pentahoImage.getBounds().width ) / 2; int topPosition = ( area.y - pentahoImage.getBounds().height ) / 2; e.gc.drawImage( pentahoImage, leftPosition, topPosition ); } img.dispose(); // spoon.setShellText(); }
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 ); }
public void paintControl( PaintEvent e ) { Point area = getArea(); if ( area.x == 0 || area.y == 0 ) { return; // nothing to do! } Display disp = shell.getDisplay(); Image img = getJobImage( disp, area.x, area.y, magnification ); e.gc.drawImage( img, 0, 0 ); if ( jobMeta.nrJobEntries() == 0 ) { e.gc.setForeground( GUIResource.getInstance().getColorCrystalTextPentaho() ); e.gc.setBackground( GUIResource.getInstance().getColorBackground() ); e.gc.setFont( GUIResource.getInstance().getFontMedium() ); Image pentahoImage = GUIResource.getInstance().getImageJobCanvas(); int leftPosition = ( area.x - pentahoImage.getBounds().width ) / 2; int topPosition = ( area.y - pentahoImage.getBounds().height ) / 2; e.gc.drawImage( pentahoImage, leftPosition, topPosition ); } img.dispose(); }
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 ); }