Java Code Examples for org.eclipse.swt.graphics.Transform#translate()

The following examples show how to use org.eclipse.swt.graphics.Transform#translate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwtUniversalImageBitmap.java    From hop with Apache License 2.0 6 votes vote down vote up
@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) zoomFactor * width / bw, (float) zoomFactor * height / bh );
  gc.setTransform( affineTransform );

  gc.drawImage( bitmap, 0, 0, bw, bh, -bw / 2, -bh / 2, bw, bh );

  gc.dispose();

  return result;
}
 
Example 2
Source File: SwtUniversalImageBitmap.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 3
Source File: RotatePiece.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void rotateTransform(Transform transform) {
	switch (angle) {
	case 90:
		transform.translate(0, size.y);
		break;
	case 180:
		transform.translate(size.x, size.y);
		break;
	case 270:
		transform.translate(size.x, 0);
		break;
	default:
		PaperClips.error(SWT.ERROR_INVALID_ARGUMENT,
				"Rotation angle must be 90, 180 or 270."); //$NON-NLS-1$
	}
	transform.rotate(-angle); // reverse the angle since Transform.rotate
	// goes clockwise
}
 
Example 4
Source File: SWTGraphics2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void translate(int x, int y) {
    Transform swtTransform = new Transform(this.gc.getDevice()); 
    this.gc.getTransform(swtTransform);
    swtTransform.translate(x, y);
    this.gc.setTransform(swtTransform);
    swtTransform.dispose();
}
 
Example 5
Source File: SWTGraphics2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies a translation.
 *
 * @param x  the translation along the x-axis.
 * @param y  the translation along the y-axis.
 */
public void translate(int x, int y) {
    Transform swtTransform = new Transform(this.gc.getDevice());
    this.gc.getTransform(swtTransform);
    swtTransform.translate(x, y);
    this.gc.setTransform(swtTransform);
    swtTransform.dispose();
}
 
Example 6
Source File: SWTGraphics2D.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Applies a translation.
 *
 * @param x  the translation along the x-axis.
 * @param y  the translation along the y-axis.
 */
public void translate(int x, int y) {
    Transform swtTransform = new Transform(this.gc.getDevice());
    this.gc.getTransform(swtTransform);
    swtTransform.translate(x, y);
    this.gc.setTransform(swtTransform);
    swtTransform.dispose();
}
 
Example 7
Source File: SWTGraphics2D.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies a translation.
 *
 * @param x  the translation along the x-axis.
 * @param y  the translation along the y-axis.
 */
public void translate(int x, int y) {
    Transform swtTransform = new Transform(this.gc.getDevice());
    this.gc.getTransform(swtTransform);
    swtTransform.translate(x, y);
    this.gc.setTransform(swtTransform);
    swtTransform.dispose();
}
 
Example 8
Source File: SWTGraphics2D.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Applies a translation.
 *
 * @param x  the translation along the x-axis.
 * @param y  the translation along the y-axis.
 */
public void translate(int x, int y) {
    Transform swtTransform = new Transform(this.gc.getDevice());
    this.gc.getTransform(swtTransform);
    swtTransform.translate(x, y);
    this.gc.setTransform(swtTransform);
    swtTransform.dispose();
}
 
Example 9
Source File: TagCloud.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
private ImageData createImageData(final Word word, Font font, Point stringExtent, final double sin,
		final double cos, int x, int y, Color color) {
	Image img = new Image(null, x, y);
	word.width = x;
	word.height = y;
	word.stringExtent = stringExtent;
	GC g = new GC(img);
	g.setAntialias(antialias);
	g.setForeground(color);
	Transform t = new Transform(img.getDevice());
	if (word.angle < 0) {
		t.translate(0, img.getBounds().height - (int) (cos * stringExtent.y));
	} else {
		t.translate((int) (sin * stringExtent.y), 0);
	}
	t.rotate(word.angle);
	g.setTransform(t);
	g.setFont(font);
	// Why is drawString so slow? between 30 and 90 percent of the whole
	// draw time...
	g.drawString(word.string, 0, 0, false);
	int max = Math.max(x, y);
	int tmp = maxSize;
	while (max < tmp) {
		tmp = tmp / 2;
	}
	tmp = tmp * 2;
	SmallRect root = new SmallRect(0, 0, tmp, tmp);
	word.tree = new RectTree(root, accuracy);
	final ImageData id = img.getImageData();
	g.dispose();
	img.dispose();
	return id;
}
 
Example 10
Source File: SWTGraphics2D.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Applies a translation.
 *
 * @param x  the translation along the x-axis.
 * @param y  the translation along the y-axis.
 */
public void translate(int x, int y) {
    Transform swtTransform = new Transform(this.gc.getDevice());
    this.gc.getTransform(swtTransform);
    swtTransform.translate(x, y);
    this.gc.setTransform(swtTransform);
    swtTransform.dispose();
}
 
Example 11
Source File: VisualisationCanvas.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
protected void doPaint(GC gc, PaintEvent event) {
	gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
	gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));

	gc.fillRectangle(event.x, event.y, event.width, event.height);

	if (graph != null) {
		final Transform tf = new Transform(gc.getDevice());
		tf.translate(-offsetX, -offsetY);
		tf.scale(scale, scale);
		gc.setTransform(tf);

		if (graphNeedsLayout) {
			graph.layout();
			graphNeedsLayout = false;
		}

		graph.getNodes().forEach(n -> n.paint(gc));

		gc.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));

		gc.setTransform(null);
		tf.dispose();

		if (hawkEye_active && hawkEye_target != null) {
			final int w = Math.round(getSize().x / hawkEye_oldScale * scale);
			final int h = Math.round(getSize().y / hawkEye_oldScale * scale);
			gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
			gc.setAlpha(64);
			gc.fillRectangle(
					(int) hawkEye_target.x - w / 2,
					(int) hawkEye_target.y - h / 2,
					w, h);
			gc.setAlpha(255);
		}
	}
}
 
Example 12
Source File: AnalogClockPainter.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void setTransform(Event e, float angle, boolean shadow) {
	Transform t = new Transform(e.display);
	int x = picker.dialCenter.x;
	int y = picker.dialCenter.y;
	if (shadow) {
		x += 4;
		y += 4;
	}
	t.translate(x, y);
	t.rotate(angle - 90);
	e.gc.setTransform(t);
	t.dispose();
}
 
Example 13
Source File: ScalePrint.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void paint(GC gc, int x, int y) {
	Transform oldTransform = getOldTransform();
	gc.getTransform(oldTransform);

	Transform transform = getTransform();
	gc.getTransform(transform);
	transform.translate(x, y);
	transform.scale((float) scale, (float) scale);
	gc.setTransform(transform);

	target.paint(gc, 0, 0);

	gc.setTransform(oldTransform);
}
 
Example 14
Source File: ToggleRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void paintMacTwistie(GC gc) {
	Transform transform = new Transform(gc.getDevice());
	transform.translate(getBounds().x, getBounds().y);
	gc.setTransform(transform);

	Color back = gc.getBackground();
	Color fore = gc.getForeground();

	if (!isHover()) {
		gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
	} else {
		gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_SELECTION));
	}

	gc.setBackground(gc.getForeground());
	if (isExpanded()) {
		gc.drawPolygon(new int[] { 1, 3, 4, 6, 5, 6, 8, 3 });
		gc.fillPolygon(new int[] { 1, 3, 4, 6, 5, 6, 8, 3 });
	} else {
		gc.drawPolygon(new int[] { 3, 1, 6, 4, 6, 5, 3, 8 });
		gc.fillPolygon(new int[] { 3, 1, 6, 4, 6, 5, 3, 8 });
	}

	if (isFocus()) {
		gc.setBackground(back);
		gc.setForeground(fore);
		gc.drawFocus(-1, -1, 12, 12);
	}

	gc.setTransform(null);
	transform.dispose();
}
 
Example 15
Source File: ChevronsToggleRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/** 
 * @see org.eclipse.nebula.widgets.pgroup.AbstractRenderer#paint(org.eclipse.swt.graphics.GC, java.lang.Object)
 */
public void paint(GC gc, Object value)
{
    Transform transform = new Transform(gc.getDevice());
    transform.translate(getBounds().x, getBounds().y);
    gc.setTransform(transform);

    Color back = gc.getBackground();
    Color fore = gc.getForeground();

    if (isHover())
    {
        Color old = gc.getForeground();
        gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
        gc.drawRoundRectangle(0, 0, 16, 15, 5, 5);
        gc.setForeground(old);
    }

    if (isExpanded())
    {
        gc.drawPolygon(new int[] {5, 6, 8, 3, 11, 6, 10, 6, 8, 4, 6, 6 });
        gc.drawPolygon(new int[] {5, 10, 8, 7, 11, 10, 10, 10, 8, 8, 6, 10 });
    }
    else
    {
        gc.drawPolygon(new int[] {5, 4, 8, 7, 11, 4, 10, 4, 8, 6, 6, 4 });
        gc.drawPolygon(new int[] {5, 8, 8, 11, 11, 8, 10, 8, 8, 10, 6, 8 });
    }

    if (isFocus())
    {
        gc.setBackground(back);
        gc.setForeground(fore);
        gc.drawFocus(2, 2, 13, 12);
    }

    gc.setTransform(null);
    transform.dispose();

}
 
Example 16
Source File: TwisteToggleRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void paint(GC gc, Object value)
{
    Transform transform = new Transform(gc.getDevice());
    transform.translate(getBounds().x, getBounds().y);
    gc.setTransform(transform);

    Color back = gc.getBackground();
    Color fore = gc.getForeground();

    if (!isHover())
    {
        gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
    }
    else
    {
        gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_SELECTION));
    }

    gc.setBackground(gc.getForeground());
    if (isExpanded())
    {
        gc.drawPolygon(new int[] {1, 3, 4, 6, 5, 6, 8, 3 });
        gc.fillPolygon(new int[] {1, 3, 4, 6, 5, 6, 8, 3 });
    }
    else
    {
        gc.drawPolygon(new int[] {3, 1, 6, 4, 6, 5, 3, 8 });
        gc.fillPolygon(new int[] {3, 1, 6, 4, 6, 5, 3, 8 });
    }

    if (isFocus())
    {
        gc.setBackground(back);
        gc.setForeground(fore);
        gc.drawFocus(-1, -1, 12, 12);
    }

    gc.setTransform(null);
    transform.dispose();
}
 
Example 17
Source File: MinMaxToggleRenderer.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void paint(GC gc, Object value)
{

    Transform transform = new Transform(gc.getDevice());
    transform.translate(getBounds().x, getBounds().y);
    gc.setTransform(transform);

    gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));

    if (isHover())
    {
        gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
        gc.drawRoundRectangle(0, 0, 17, 17, 5, 5);
    }

    gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));

    if (isExpanded())
    {
        gc.fillRectangle(4, 3, 9, 3);
        gc.drawRectangle(4, 3, 9, 3);
    }
    else
    {
        gc.fillRectangle(4, 3, 9, 9);
        gc.drawRectangle(4, 3, 9, 9);
        gc.drawLine(4, 5, 13, 5);
    }

    gc.setTransform(null);
    transform.dispose();

}
 
Example 18
Source File: GanttChartPrintJob.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
public void run() {
	if (printer.startJob(jobName)) {
		GC gc = new GC(printer);

		int currentPage = 1;
		for (GanttChart ganttChart : this.ganttCharts) {
			
			Image printerImage = null;
			if (printer.getPrinterData().scope == PrinterData.SELECTION) {
				//the user selected to only print the selected area
				//as this is quite difficult in GanttChart, we specify that
				//this means to print the visible area
				//but it is possible to configure via settings what "visible"
				//area means: 
				// - really only the visible area horizontally and vertically
				// - only the horizontal visible area, but vertically everything
				printerImage = ganttChart.getSettings().printSelectedVerticallyComplete() ? 
						ganttChart.getGanttComposite().getVerticallyFullImage() : ganttChart.getGanttComposite().getImage();
			}
			else {
				printerImage = ganttChart.getGanttComposite().getFullImage();
			}
			
			final Rectangle printerClientArea = PrintUtils.computePrintArea(printer);
			final Point scaleFactor = PrintUtils.computeScaleFactor(printer);
			final Point pageCount = PrintUtils.getPageCount(printer, printerImage);

			// Print pages Left to Right and then Top to Down
			for (int verticalPageNumber = 0; verticalPageNumber < pageCount.y; verticalPageNumber++) {

				for (int horizontalPageNumber = 0; horizontalPageNumber < pageCount.x; horizontalPageNumber++) {

					// Calculate bounds for the next page
					int printerClientAreaHeight = ganttChart.getSettings().printFooter() ? 
							(printerClientArea.height - PrintUtils.FOOTER_HEIGHT_IN_PRINTER_DPI) : printerClientArea.height;
					Rectangle printBounds = new Rectangle((printerClientArea.width / scaleFactor.x) * horizontalPageNumber,
					                                      (printerClientAreaHeight / scaleFactor.y) * verticalPageNumber,
					                                      printerClientArea.width / scaleFactor.x,
					                                      printerClientAreaHeight / scaleFactor.y);

					if (shouldPrint(printer.getPrinterData(), currentPage)) {
						printer.startPage();

						Transform printerTransform = new Transform(printer);

						// Adjust for DPI difference between display and printer
						printerTransform.scale(scaleFactor.x, scaleFactor.y);

						// Adjust for margins
						printerTransform.translate(printerClientArea.x / scaleFactor.x, printerClientArea.y / scaleFactor.y);

						// GanttChart will not automatically print the pages at the left margin.
						// Example: page 1 will print at x = 0, page 2 at x = 100, page 3 at x = 300
						// Adjust to print from the left page margin. i.e x = 0
						printerTransform.translate(-1 * printBounds.x, -1 * printBounds.y);
						gc.setTransform(printerTransform);

						int imgWidthClipping = printBounds.width;
						if (((horizontalPageNumber * printBounds.width)+printBounds.width) > printerImage.getImageData().width) {
							imgWidthClipping = printerImage.getImageData().width - (horizontalPageNumber * printBounds.width);
						}
						
						int imgHeightClipping = printBounds.height;
						if (((verticalPageNumber * printBounds.height)+printBounds.height) > printerImage.getImageData().height) {
							imgHeightClipping = printerImage.getImageData().height - (verticalPageNumber * printBounds.height);
						}
						
						gc.drawImage(printerImage, 
								horizontalPageNumber * printBounds.width, 
								verticalPageNumber * printBounds.height, 
								imgWidthClipping, imgHeightClipping,
								printBounds.x, printBounds.y, imgWidthClipping, imgHeightClipping);
						
						if (ganttChart.getSettings().printFooter())
							printFooter(gc, ganttChart, currentPage, printBounds);

						printer.endPage();
						printerTransform.dispose();
						
					}
					currentPage++;
				}
			}
			
			printerImage.dispose();
		}
		
		printer.endJob();
		gc.dispose();
		
		//only dispose the printer after the print job is done if it is configured to do so
		//this configuration enables the possibility to reuse a printer for several jobs
		if (disposePrinter)
			printer.dispose();
	}
}
 
Example 19
Source File: SwtTextRenderer.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param ipr
 * @param lo
 * @param la
 * @param b
 */
private void showTopValue( IPrimitiveRenderer ipr, Location lo, Label la,
		boolean b )
{
	GC gc = (GC) ( (IDeviceRenderer) ipr ).getGraphicsContext( );
	IChartComputation cComp = ( (IDeviceRenderer) ipr ).getChartComputation( );
	double dX = lo.getX( ), dY = lo.getY( );
	final FontDefinition fd = la.getCaption( ).getFont( );

	final int dAngleInDegrees = (int)fd.getRotation( );

	final Color clrBackground = (Color) _sxs.getColor( la.getShadowColor( ) );

	final ITextMetrics itm = cComp.getTextMetrics( _sxs, la, 0 );
	final double dFW = itm.getFullWidth( );
	final double dFH = itm.getFullHeight( );
	cComp.recycleTextMetrics( itm );

	double scaledThickness = SHADOW_THICKNESS
			* _sxs.getDpiResolution( )
			/ 72d;

	gc.setBackground( clrBackground );

	R31Enhance.setAlpha( gc, la.getShadowColor( ) );

	// HORIZONTAL TEXT
	if ( dAngleInDegrees == 0 )
	{
		gc.fillRectangle( (int) ( dX + scaledThickness ),
				(int) ( dY + scaledThickness ),
				(int) dFW,
				(int) dFH );
	}
	// TEXT AT POSITIVE 90 (TOP RIGHT HIGHER THAN TOP LEFT CORNER)
	else if ( dAngleInDegrees == 90 )
	{
		gc.fillRectangle( (int) ( dX + scaledThickness ),
				(int) ( dY - dFW - scaledThickness ),
				(int) dFH,
				(int) dFW );
	}
	// TEXT AT NEGATIVE 90 (TOP RIGHT LOWER THAN TOP LEFT CORNER)
	else if ( dAngleInDegrees == -90 )
	{
		gc.fillRectangle( (int) ( dX - dFH - scaledThickness ),
				(int) ( dY + scaledThickness ),
				(int) dFH,
				(int) dFW );
	}
	else
	{
		Transform transform = new Transform( getDevice( ) );
		transform.translate( (float) dX, (float) dY );
		transform.rotate( -dAngleInDegrees );
		gc.setTransform( transform );
		gc.fillRectangle( (int) scaledThickness,
				(int) scaledThickness,
				(int) dFW,
				(int) dFH );
		transform.dispose( );
		gc.setTransform( null );
	}
}
 
Example 20
Source File: ViewLattice.java    From arx with Apache License 2.0 4 votes vote down vote up
/**
 * Draws a node.
 *
 * @param g
 */
private void drawNodes(final GC g) {

    // Prepare
    Rectangle bounds = new Rectangle(0, 0, (int)nodeWidth, (int)nodeHeight);
    Transform transform = new Transform(g.getDevice());
    
    // Set style
    g.setLineWidth(STROKE_WIDTH_NODE);
    g.setFont(font);

    // Draw nodes
    for (List<ARXNode> level : lattice) {
        for (ARXNode node : level) {
            
            // Obtain coordinates
            double[] center = (double[]) node.getAttributes().get(ATTRIBUTE_CENTER);
            bounds.x = (int)(center[0] - nodeWidth / 2d);
            bounds.y = (int)(center[1] - nodeHeight / 2d);
            
            // Clipping
            if (bounds.intersects(new Rectangle(0, 0, screen.x, screen.y))) { 
                
                // Retrieve/compute text rendering data
                SerializablePath path = (SerializablePath) node.getAttributes().get(ATTRIBUTE_PATH);
                Point extent = (Point) node.getAttributes().get(ATTRIBUTE_EXTENT);
                if (path == null || path.getPath() == null) {
                    String text = (String) node.getAttributes().get(ATTRIBUTE_LABEL);
                    path = new SerializablePath(new Path(canvas.getDisplay()));
                    path.getPath().addString(text, 0, 0, font);
                    node.getAttributes().put(ATTRIBUTE_PATH, path);
                    extent = g.textExtent(text);
                    node.getAttributes().put(ATTRIBUTE_EXTENT, extent);
                }
        
                // Degrade if too far away
                if (bounds.width <= 4) {
                    g.setBackground(getInnerColor(node));
                    g.setAntialias(SWT.OFF);
                    g.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
        
                    // Draw real node
                } else {
                    
                    // Fill background
                    g.setBackground(getInnerColor(node));
                    g.setAntialias(SWT.OFF);
                    if (node != getSelectedNode()) {
                        g.fillOval(bounds.x, bounds.y, bounds.width, bounds.height);
                    } else {
                        g.fillRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
                    }
                    
                    // Draw line
                    g.setLineWidth(getOuterStrokeWidth(node, bounds.width));
                    g.setForeground(getOuterColor(node));
                    g.setAntialias(SWT.ON);
                    if (node != getSelectedNode()) {
                        g.drawOval(bounds.x, bounds.y, bounds.width, bounds.height);
                    } else {
                        g.drawRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
                    }
                    
                    // Draw text
                    if (bounds.width >= 20) {
                        
                        // Enable anti-aliasing
                        g.setTextAntialias(SWT.ON);
                        
                        // Compute position and factor
                        float factor1 = (bounds.width * 0.7f) / (float)extent.x;
                        float factor2 = (bounds.height * 0.7f) / (float)extent.y;
                        float factor = Math.min(factor1, factor2);
                        int positionX = bounds.x + (int)(((float)bounds.width - (float)extent.x * factor) / 2f); 
                        int positionY = bounds.y + (int)(((float)bounds.height - (float)extent.y * factor) / 2f);
                        
                        // Initialize transformation
                        transform.identity();
                        transform.translate(positionX, positionY);
                        transform.scale(factor, factor);
                        g.setTransform(transform);
                        
                        // Draw and reset
                        g.setBackground(COLOR_BLACK);
                        g.fillPath(path.getPath());
                        g.setTransform(null);
                        g.setTextAntialias(SWT.OFF);
                    }
                }
            }
        }
    }
    
    // Clean up
    transform.dispose();
}