Java Code Examples for java.awt.Graphics2D.create()

The following are Jave code examples for showing how to use create() of the java.awt.Graphics2D class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: VISNode   File: JNodeBorder.java   View Source Code Vote up 6 votes
/**
 * Paints the header
 * 
 * @param g
 */
private void paintHeader(Graphics2D g, int x, int y, int width, int height) {
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setClip(new Rectangle(x, y, width, HEADER_HEIGHT));
    if (node.getParentNodeContainer().getSelection().contains(node)) {
        g2d.setColor(new Color(0x555555));
    } else {
        g2d.setColor(new Color(0x333333));
    }
    g2d.fillRect(x + 5, y + 5, width - 11, HEADER_HEIGHT - 5);
    if (node.getParentNodeContainer().getSelection().contains(node)) {
        g2d.setColor(new Color(0x1da6b0));
        g2d.fillRect(x + 5, y + HEADER_HEIGHT - 2, width - 11, 2);
    } else {
        g2d.setColor(new Color(0xa0a0a0));
        g2d.fillRect(x + 10, y + HEADER_HEIGHT - 2, width - 21, 2);
    }
    g2d.dispose();
}
 
Example 2
Project: rapidminer   File: ProcessDrawer.java   View Source Code Vote up 6 votes
/**
 * Draws text centered in the process.
 *
 * @param process
 *            the process in question
 * @param g2
 *            the graphics context
 * @param font
 * @param text
 * @param color
 * @param yOffset
 */
private void drawCenteredText(ExecutionUnit process, Graphics2D g2, Font font, String text, Color color, double yOffset) {
	double width = model.getProcessWidth(process);
	double height = model.getProcessHeight(process);

	Graphics2D g2d = (Graphics2D) g2.create();
	g2d.setFont(font);
	Rectangle2D bounds = g2d.getFontMetrics().getStringBounds(text, g2d);

	int x = (int) (width / 2 - bounds.getWidth() / 2);
	int y = (int) (height / 2 + bounds.getHeight() / 2 + yOffset);
	g2d.setColor(color);
	g2d.drawString(text, x, y);

	g2d.dispose();
}
 
Example 3
Project: rapidminer   File: AnnotationDrawer.java   View Source Code Vote up 6 votes
/**
 * Draws the drag indicators for annotations.
 *
 * @param g
 *            the graphics context to draw upon
 * @param anno
 *            the current annotation to draw
 * @param loc
 *            the location of the annotation
 * @param printing
 *            if we are currently printing
 */
private void drawAnnoDragIndicators(final Graphics2D g, final WorkflowAnnotation anno, final Rectangle2D loc,
		final boolean printing) {
	if (printing) {
		// never draw them for printing
		return;
	}

	AnnotationDragHelper dragged = model.getDragged();
	if (dragged.getHoveredOperator() == null) {
		return;
	}
	Graphics2D g2 = (Graphics2D) g.create();

	int padding = 15;
	Rectangle2D opRect = rendererModel.getOperatorRect(dragged.getHoveredOperator());
	opRect = new Rectangle2D.Double(opRect.getX(), opRect.getY(), opRect.getWidth(), opRect.getHeight());
	Rectangle2D shadowRect = new Rectangle2D.Double(opRect.getX() - padding - 1, opRect.getY() - padding - 1,
			opRect.getWidth() + 2 * padding + 1, opRect.getHeight() + 2 * padding + 1);
	g2.setColor(DRAG_LINK_COLOR);

	g2.setStroke(DRAG_BORDER_STROKE);
	g2.draw(shadowRect);

	g2.dispose();
}
 
Example 4
Project: rapidminer   File: AnnotationDrawer.java   View Source Code Vote up 6 votes
/**
 * Bypass the cache and the speedy image drawing and directly paint the JEditorPane to the
 * context. Required for printing in SVG format which would turn out pixelated if it were drawn
 * as an image.
 *
 * @param anno
 *            the annotation to draw
 * @param g2
 *            the graphics context to draw upon
 */
private void printAnnotationFromEditor(final WorkflowAnnotation anno, final Graphics2D g2) {
	Graphics2D gPr = (Graphics2D) g2.create();

	Rectangle2D loc = anno.getLocation();
	gPr.translate(loc.getX(), loc.getY());
	gPr.setClip(0, 0, (int) loc.getWidth(), (int) loc.getHeight());
	// paint each annotation with the same JEditorPane
	Dimension size = new Dimension((int) loc.getWidth(), (int) loc.getHeight());
	pane.setSize(size);
	pane.setText(AnnotationDrawUtils.createStyledCommentString(anno));
	pane.setCaretPosition(0);
	// draw annotation area to image and then to graphics
	// otherwise heavyweight JEdiorPane draws over everything and outside of panel
	// paint JEditorPane to context
	pane.paint(gPr);

	gPr.dispose();
}
 
Example 5
Project: rapidminer   File: AnnotationsDecorator.java   View Source Code Vote up 6 votes
/**
 * Draws the annotation for the given operator (if he has one).
 */
private void drawOpAnno(final Operator operator, final Graphics2D g2, final ProcessRendererModel rendererModel,
		final boolean printing) {
	WorkflowAnnotations annotations = rendererModel.getOperatorAnnotations(operator);
	if (annotations == null) {
		return;
	}
	for (WorkflowAnnotation anno : annotations.getAnnotationsDrawOrder()) {
		// selected is drawn by highlight decorator
		if (anno.equals(model.getSelected())) {
			continue;
		}

		// paint the annotation itself
		Graphics2D g2P = (Graphics2D) g2.create();
		drawer.drawAnnotation(anno, g2P, printing);
		g2P.dispose();
	}
}
 
Example 6
Project: AWGW   File: GridPanel.java   View Source Code Vote up 5 votes
/**
 * Draw one occupant object. First verify that the object is actually
 * visible before any drawing, set up the clip appropriately and use the
 * DisplayMap to determine which object to call upon to render this
 * particular Locatable. Note that we save and restore the graphics
 * transform to restore back to normalcy no matter what the renderer did to
 * to the coordinate system.
 *
 * @param g2    the Graphics2D object to use to render
 * @param xleft the leftmost pixel of the rectangle
 * @param ytop  the topmost pixel of the rectangle
 * @param obj   the Locatable object to draw
 */
private void drawOccupant(Graphics2D g2, int xleft, int ytop, Object obj) {
    Rectangle cellToDraw = new Rectangle(xleft, ytop, cellSize, cellSize);

    // Only draw if the object is visible within the current clipping
    // region.
    if (cellToDraw.intersects(g2.getClip().getBounds())) {
        Graphics2D g2copy = (Graphics2D) g2.create();
        g2copy.clip(cellToDraw);
        // Get the drawing object to display this occupant.
        Display displayObj = displayMap.findDisplayFor(obj.getClass());
        displayObj.draw(obj, this, g2copy, cellToDraw);
        g2copy.dispose();
    }
}
 
Example 7
Project: jdk8u-jdk   File: NonOpaqueDestLCDAATest.java   View Source Code Vote up 5 votes
static void clear(Graphics2D  g, int type, int w, int h) {
    Graphics2D gg = (Graphics2D) g.create();
    if (type > OPAQUE) {
        gg.setColor(new Color(0, 0, 0, 0));
        gg.setComposite(AlphaComposite.Src);
    } else {
        gg.setColor(new Color(0xAD, 0xD8, 0xE6));
    }
    gg.fillRect(0, 0, w, h);
}
 
Example 8
Project: rapidminer   File: ProcessDrawer.java   View Source Code Vote up 5 votes
/**
 * Draws operator backgrounds and then calls all registered {@link ProcessDrawDecorator}s for
 * the annotations render phase.
 *
 * @param process
 *            the process to draw the operator backgrounds for
 * @param g2
 *            the graphics context to draw upon
 * @param printing
 *            if {@code true} we are printing instead of drawing to the screen
 */
public void drawOperatorBackgrounds(final ExecutionUnit process, final Graphics2D g2, final boolean printing) {
	Graphics2D gBG = (Graphics2D) g2.create();
	// draw background of operators
	for (Operator op : process.getOperators()) {
		Rectangle2D frame = model.getOperatorRect(op);
		if (frame == null) {
			continue;
		}

		// only draw background if operator is visisble
		Rectangle2D opBounds = new Rectangle2D.Double(frame.getX() - 10, frame.getY(), frame.getWidth() + 20,
				frame.getHeight());
		if (g2.getClipBounds() != null && !g2.getClipBounds().intersects(opBounds)) {
			continue;
		}

		renderOperatorBackground(op, gBG);
	}

	// draw connections background for all operators
	for (Operator operator : process.getOperators()) {
		renderConnectionsBackground(operator.getInputPorts(), operator.getOutputPorts(), gBG);
	}

	// draw connections background for process
	renderConnectionsBackground(process.getInnerSinks(), process.getInnerSources(), gBG);
	gBG.dispose();

	// let decorators draw
	drawPhaseDecorators(process, g2, RenderPhase.OPERATOR_BACKGROUND, printing);
}
 
Example 9
Project: rapidminer   File: ProcessDrawUtils.java   View Source Code Vote up 5 votes
/**
 * Draws a shadow around the given rectangle.
 *
 * @param rect
 *            the rectangle which should get a shadow
 * @param g2
 *            the graphics context to draw the shadow on
 */
public static void drawShadow(final Rectangle2D rect, final Graphics2D g2) {
	Graphics2D g2S = (Graphics2D) g2.create();

	Rectangle2D shadow = new Rectangle2D.Double(rect.getX() + 5, rect.getY() + ProcessDrawer.HEADER_HEIGHT + 5,
			rect.getWidth(), rect.getHeight() - ProcessDrawer.HEADER_HEIGHT);
	GeneralPath bottom = new GeneralPath();
	bottom.moveTo(shadow.getX(), rect.getMaxY());
	bottom.lineTo(rect.getMaxX(), rect.getMaxY());
	bottom.lineTo(shadow.getMaxX(), shadow.getMaxY());
	bottom.lineTo(shadow.getMinX(), shadow.getMaxY());
	bottom.closePath();
	g2S.setPaint(new GradientPaint((float) rect.getX(), (float) rect.getMaxY(), Color.gray, (float) rect.getX(),
			(float) shadow.getMaxY(), TRANSPARENT_GRAY));
	g2S.fill(bottom);

	GeneralPath right = new GeneralPath();
	right.moveTo(rect.getMaxX(), shadow.getMinY());
	right.lineTo(shadow.getMaxX(), shadow.getMinY());
	right.lineTo(shadow.getMaxX(), shadow.getMaxY());
	right.lineTo(rect.getMaxX(), rect.getMaxY());
	right.closePath();
	g2S.setPaint(new GradientPaint((float) rect.getMaxX(), (float) shadow.getY(), Color.gray, (float) shadow.getMaxX(),
			(float) shadow.getY(), TRANSPARENT_GRAY));
	g2S.fill(right);

	g2S.dispose();
}
 
Example 10
Project: openjdk-jdk10   File: NonOpaqueDestLCDAATest.java   View Source Code Vote up 5 votes
static void clear(Graphics2D  g, int type, int w, int h) {
    Graphics2D gg = (Graphics2D) g.create();
    if (type > OPAQUE) {
        gg.setColor(new Color(0, 0, 0, 0));
        gg.setComposite(AlphaComposite.Src);
    } else {
        gg.setColor(new Color(0xAD, 0xD8, 0xE6));
    }
    gg.fillRect(0, 0, w, h);
}
 
Example 11
Project: rapidminer   File: AnnotationDrawer.java   View Source Code Vote up 5 votes
/**
 * Shadows the given rectangle. Gives a disabled look to the given area.
 *
 * @param rect
 *            the area to draw the shadow over
 * @param g
 *            the context to draw upon
 */
private void overshadowRect(final Rectangle2D rect, final Graphics2D g) {
	Graphics2D g2 = (Graphics2D) g.create();

	g2.setColor(GRAY_OUT);
	g2.fill(rect);

	g2.dispose();
}
 
Example 12
Project: rapidminer   File: AnnotationDrawer.java   View Source Code Vote up 5 votes
/**
 * Draws indicator in case the annotation text overflows on the y axis.
 *
 * @param anno
 *            the annotation
 * @param g
 *            the graphics context to draw upon
 * @param loc
 *            the location of the annotation
 * @param printing
 *            if we are currently printing
 */
private void drawOverflowIndicator(final WorkflowAnnotation anno, final Graphics2D g, final Rectangle2D loc,
		final boolean printing) {
	if (printing) {
		// never draw them for printing
		return;
	}
	Graphics2D g2 = (Graphics2D) g.create();

	int size = 20;
	int xOffset = 10;
	int yOffset = 10;
	int stepSize = size / 4;
	int dotSize = 3;
	int x = (int) loc.getMaxX() - size - xOffset;
	int y = (int) loc.getMaxY() - size - yOffset;
	GradientPaint gp = new GradientPaint(x, y, Color.WHITE, x, y + size * 1.5f, Color.LIGHT_GRAY);
	g2.setPaint(gp);
	g2.fillRect(x, y, size, size);

	g2.setColor(Color.BLACK);
	g2.drawRect(x, y, size, size);

	g2.fillOval(x + stepSize, y + stepSize * 2, dotSize, dotSize);
	g2.fillOval(x + stepSize * 2, y + stepSize * 2, dotSize, dotSize);
	g2.fillOval(x + stepSize * 3, y + stepSize * 2, dotSize, dotSize);

	g2.dispose();
}
 
Example 13
Project: JavaPPTX   File: PPWindowImage.java   View Source Code Vote up 5 votes
private void fillBackground(Graphics2D g) {
   Graphics2D g2 = (Graphics2D) g.create();
   Rectangle2D window = new Rectangle2D.Double(0, 0, sw, sh);
   g2.setComposite(AlphaComposite.Clear);
   g2.fill(window);
   g2.dispose();
}
 
Example 14
Project: DicomViewer   File: AbstractSliderComponent_1.java   View Source Code Vote up 5 votes
/** dessine un cursseur dont le centre en X est centerX, et le centre en Y est centerY */
public static void drawCursor(final Graphics2D g, final Color fillColor, final Color drawColor, final int centerX, final int centerY) {
    Graphics2D g2 = (Graphics2D) g.create();
    g2.setColor(fillColor);
    g2.fillRoundRect(centerX - CURSOR_W / 2, centerY - CURSOR_H / 2, CURSOR_W, CURSOR_H, ARC_SIZE, ARC_SIZE);

    g2.setColor(drawColor);
    g2.drawRoundRect(centerX - CURSOR_W / 2, centerY - CURSOR_H / 2, CURSOR_W, CURSOR_H, ARC_SIZE, ARC_SIZE);
    g2.dispose();
}
 
Example 15
Project: rapidminer   File: SimilarityKDistanceVisualization.java   View Source Code Vote up 5 votes
private void drawPoints(Graphics2D g, int pixWidth, int pixHeight) {
	double sx = 0.0d;
	double sy = 0.0d;
	sx = ((double) pixWidth - LABEL_MARGIN_X) / (maxX - minX);
	sy = ((double) pixHeight - LABEL_MARGIN_Y) / (maxY - minY);

	Graphics2D coordinateSpace = (Graphics2D) g.create();
	coordinateSpace.translate(LABEL_MARGIN_X, LABEL_MARGIN_Y);
	drawGrid(coordinateSpace, -minX, -minY, sx, sy);
	drawPoints(coordinateSpace, -minX, -minY, sx, sy);
	coordinateSpace.dispose();
}
 
Example 16
Project: openjdk-jdk10   File: FontPanel.java   View Source Code Vote up 4 votes
private void calcFontMetrics( Graphics2D g2d, int w, int h ) {
    FontMetrics fm;
    Graphics2D g2 = (Graphics2D)g2d.create();

    /// ABP
    if ( g2Transform != NONE && textToUse != FILE_TEXT ) {
        g2.setFont( g2.getFont().deriveFont( getAffineTransform( g2Transform )) );
        fm = g2.getFontMetrics();
    }
    else {
        fm = g2.getFontMetrics();
    }

    maxAscent = fm.getMaxAscent();
    maxDescent = fm.getMaxDescent();
    if (maxAscent == 0) maxAscent = 10;
    if (maxDescent == 0) maxDescent = 5;
    if ( textToUse == RANGE_TEXT || textToUse == ALL_GLYPHS ) {
        /// Give slight extra room for each character
        maxAscent += 3;
        maxDescent += 3;
        gridWidth = fm.getMaxAdvance() + 6;
        gridHeight = maxAscent + maxDescent;
        if ( force16Cols )
          numCharAcross = 16;
        else
          numCharAcross = ( w - 10 ) / gridWidth;
        numCharDown = ( h - 10 ) / gridHeight;

        canvasInset_X = ( w - numCharAcross * gridWidth ) / 2;
        canvasInset_Y = ( h - numCharDown * gridHeight ) / 2;
        if ( numCharDown == 0 || numCharAcross == 0 )
          throw new CannotDrawException( isPrinting ? CANT_FIT_PRINT : CANT_FIT_DRAW );

        if ( !isPrinting )
          resetScrollbar( verticalBar.getValue() * numCharAcross );
    }
    else {
        maxDescent += fm.getLeading();
        canvasInset_X = 5;
        canvasInset_Y = 5;
        /// gridWidth and numCharAcross will not be used in this mode...
        gridHeight = maxAscent + maxDescent;
        numCharDown = ( h - canvasInset_Y * 2 ) / gridHeight;

        if ( numCharDown == 0 )
          throw new CannotDrawException( isPrinting ? CANT_FIT_PRINT : CANT_FIT_DRAW );
        /// If this is text loaded from file, prepares the LineBreak'ed
        /// text layout at this point
        if ( textToUse == FILE_TEXT ) {
            if ( !isPrinting )
              f2dt.fireChangeStatus( "LineBreaking Text... Please Wait", false );
            lineBreakTLs = new Vector();
            for ( int i = 0; i < fileText.length; i++ ) {
                AttributedString as =
                  new AttributedString( fileText[i], g2.getFont().getAttributes() );

                LineBreakMeasurer lbm =
                  new LineBreakMeasurer( as.getIterator(), g2.getFontRenderContext() );

                while ( lbm.getPosition() < fileText[i].length() )
                  lineBreakTLs.add( lbm.nextLayout( (float) w ));

            }
        }
        if ( !isPrinting )
          resetScrollbar( verticalBar.getValue() );
    }
}
 
Example 17
Project: rapidminer   File: ScatterPlotter.java   View Source Code Vote up 4 votes
private void draw(Graphics2D g, int pixWidth, int pixHeight) {
	double sx = 0.0d;
	double sy = 0.0d;
	try {
		if (drawAxes) {
			sx = ((double) pixWidth - LABEL_MARGIN_Y)
					/ (xTransformation.transform(maxX) - xTransformation.transform(minX));
			sy = ((double) pixHeight - LABEL_MARGIN_X)
					/ (yTransformation.transform(maxY) - yTransformation.transform(minY));
		} else {
			sx = pixWidth / (xTransformation.transform(maxX) - xTransformation.transform(minX));
			sy = pixHeight / (yTransformation.transform(maxY) - yTransformation.transform(minY));
		}
	} catch (IllegalArgumentException e) {
		g.scale(1, -1);
		g.drawString("Cannot apply axis transformation. Please make sure that the value range", 0, -60);
		g.drawString("can be transformed by the selected axis transformation, for example", 0, -40);
		g.drawString("negative values or zero cannot be transformed by a log scale transformation", 0, -20);
		g.drawString("(applying a normalization operator to the desired range might help). ", 0, 0);
		return;
	}

	Graphics2D coordinateSpace = (Graphics2D) g.create();
	if (drawAxes) {
		coordinateSpace.translate(LABEL_MARGIN_Y, LABEL_MARGIN_X);
	}

	if (Double.isNaN(sx) || Double.isNaN(sy)) {
		coordinateSpace.scale(1, -1);
		coordinateSpace.drawString("No data points available (yet).", 0, -20);
		coordinateSpace.drawString("Zooming out with a right click might help.", 0, 0);
	} else {
		if (drawAxes) {
			transform.translate(LABEL_MARGIN_Y, LABEL_MARGIN_X);
		}
		transform.scale(sx, sy);
		transform.translate(-xTransformation.transform(minX), -yTransformation.transform(minY));

		drawGrid(coordinateSpace, -xTransformation.transform(minX), -yTransformation.transform(minY), sx, sy);
		drawPoints(coordinateSpace, -xTransformation.transform(minX), -yTransformation.transform(minY), sx, sy);
		drawToolTip(coordinateSpace, -xTransformation.transform(minX), -yTransformation.transform(minY), sx, sy);
	}
	coordinateSpace.dispose();
}
 
Example 18
Project: OpenJSharp   File: FontPanel.java   View Source Code Vote up 4 votes
private void calcFontMetrics( Graphics2D g2d, int w, int h ) {
    FontMetrics fm;
    Graphics2D g2 = (Graphics2D)g2d.create();

    /// ABP
    if ( g2Transform != NONE && textToUse != FILE_TEXT ) {
        g2.setFont( g2.getFont().deriveFont( getAffineTransform( g2Transform )) );
        fm = g2.getFontMetrics();
    }
    else {
        fm = g2.getFontMetrics();
    }

    maxAscent = fm.getMaxAscent();
    maxDescent = fm.getMaxDescent();
    if (maxAscent == 0) maxAscent = 10;
    if (maxDescent == 0) maxDescent = 5;
    if ( textToUse == RANGE_TEXT || textToUse == ALL_GLYPHS ) {
        /// Give slight extra room for each character
        maxAscent += 3;
        maxDescent += 3;
        gridWidth = fm.getMaxAdvance() + 6;
        gridHeight = maxAscent + maxDescent;
        if ( force16Cols )
          numCharAcross = 16;
        else
          numCharAcross = ( w - 10 ) / gridWidth;
        numCharDown = ( h - 10 ) / gridHeight;

        canvasInset_X = ( w - numCharAcross * gridWidth ) / 2;
        canvasInset_Y = ( h - numCharDown * gridHeight ) / 2;
        if ( numCharDown == 0 || numCharAcross == 0 )
          throw new CannotDrawException( isPrinting ? CANT_FIT_PRINT : CANT_FIT_DRAW );

        if ( !isPrinting )
          resetScrollbar( verticalBar.getValue() * numCharAcross );
    }
    else {
        maxDescent += fm.getLeading();
        canvasInset_X = 5;
        canvasInset_Y = 5;
        /// gridWidth and numCharAcross will not be used in this mode...
        gridHeight = maxAscent + maxDescent;
        numCharDown = ( h - canvasInset_Y * 2 ) / gridHeight;

        if ( numCharDown == 0 )
          throw new CannotDrawException( isPrinting ? CANT_FIT_PRINT : CANT_FIT_DRAW );
        /// If this is text loaded from file, prepares the LineBreak'ed
        /// text layout at this point
        if ( textToUse == FILE_TEXT ) {
            if ( !isPrinting )
              f2dt.fireChangeStatus( "LineBreaking Text... Please Wait", false );
            lineBreakTLs = new Vector();
            for ( int i = 0; i < fileText.length; i++ ) {
                AttributedString as =
                  new AttributedString( fileText[i], g2.getFont().getAttributes() );

                LineBreakMeasurer lbm =
                  new LineBreakMeasurer( as.getIterator(), g2.getFontRenderContext() );

                while ( lbm.getPosition() < fileText[i].length() )
                  lineBreakTLs.add( lbm.nextLayout( (float) w ));

            }
        }
        if ( !isPrinting )
          resetScrollbar( verticalBar.getValue() );
    }
}
 
Example 19
Project: rapidminer   File: ProcessDrawer.java   View Source Code Vote up 3 votes
/**
 * Draws the process(es) background based on the {@link ProcessRendererModel} data and then
 * calls all registered {@link ProcessDrawDecorator}s for the background render phase.
 *
 * @param process
 *            the process to draw the background for
 * @param g2
 *            the graphics context to draw upon
 * @param printing
 *            if {@code true} we are printing instead of drawing to the screen
 */
public void drawBackground(final ExecutionUnit process, final Graphics2D g2, final boolean printing) {
	Graphics2D gBG = (Graphics2D) g2.create();
	renderBackground(process, gBG, printing);
	gBG.dispose();

	// let decorators draw
	drawPhaseDecorators(process, g2, RenderPhase.BACKGROUND, printing);
}
 
Example 20
Project: rapidminer   File: ProcessDrawer.java   View Source Code Vote up 3 votes
/**
 * Draws the process(es) foreground based on the {@link ProcessRendererModel} data and then
 * calls all registered {@link ProcessDrawDecorator}s for the foreground render phase.
 *
 * @param process
 *            the process to draw the foreground for
 * @param g2
 *            the graphics context to draw upon
 * @param printing
 *            if {@code true} we are printing instead of drawing to the screen
 */
public void drawForeground(final ExecutionUnit process, final Graphics2D g2, final boolean printing) {
	Graphics2D gBG = (Graphics2D) g2.create();
	renderForeground(process, gBG, printing);
	gBG.dispose();

	// let decorators draw
	drawPhaseDecorators(process, g2, RenderPhase.FOREGROUND, printing);
}