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

The following are Jave code examples for showing how to use getTransform() 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: defense-solutions-proofs-of-concept   File: RotatableImagePanel.java   View Source Code Vote up 7 votes
@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;
    AffineTransform origXform = g2d.getTransform();
    AffineTransform newXform = (AffineTransform) (origXform.clone());
    //center of rotation is center of the panel
    int xRot = this.getWidth() / 2;
    int yRot = this.getHeight() / 2;
    newXform.rotate((2 * Math.PI) - currentAngle, xRot, yRot);
    g2d.setTransform(newXform);
    //draw image centered in panel
    int x = (getWidth() - image.getWidth(this)) / 2;
    int y = (getHeight() - image.getHeight(this)) / 2;
    g2d.drawImage(image, x, y, this);
    g2d.setTransform(origXform);
}
 
Example 2
Project: litiengine   File: CombatEntityVision.java   View Source Code Vote up 6 votes
@Override
public void renderFogOfWar(final Graphics2D g) {
  if (this.fogOfWar == null) {
    return;
  }

  final AffineTransform oldTransform = g.getTransform();
  final AffineTransform at = new AffineTransform();
  at.scale(Game.getCamera().getRenderScale(), Game.getCamera().getRenderScale());
  at.translate(Game.getCamera().getPixelOffsetX(), Game.getCamera().getPixelOffsetY());

  g.setTransform(at);
  g.setColor(FogOfWarColor);
  g.fill(this.fogOfWar);
  g.setTransform(oldTransform);
}
 
Example 3
Project: geomapapp   File: GMAProfile.java   View Source Code Vote up 6 votes
public void draw(Graphics2D g) {
	arc = null;;
	arc2 = null;;
	if( path==null)return;
	AffineTransform at = g.getTransform();
	if( !enabled || line==null) return;
	g.setStroke( new BasicStroke(4.f/(float)map.getZoom()) );
	g.setColor(Color.white);
	g.draw( path );
	double wrap = map.getWrap();
	if( wrap>0.) {
		g.translate(wrap, 0.);
		g.draw( path );
	}
	g.setTransform(at);
}
 
Example 4
Project: VASSAL-src   File: Labeler.java   View Source Code Vote up 6 votes
public void draw(Graphics g, int x, int y, Component obs, double zoom) {
    updateCachedImage();
    piece.draw(g, x, y, obs, zoom);

// FIXME: We should be drawing the text at the right size, not scaling it!
    final Point p = getLabelPosition();
    final int labelX = x + (int) (zoom * p.x);
    final int labelY = y + (int) (zoom * p.y);

    AffineTransform saveXForm = null;
    final Graphics2D g2d = (Graphics2D) g;

    if (rotateDegrees != 0) {
      saveXForm = g2d.getTransform();
      final AffineTransform newXForm = AffineTransform.getRotateInstance(
        Math.toRadians(rotateDegrees), x, y);
      g2d.transform(newXForm);
    }

    imagePainter.draw(g, labelX, labelY, zoom, obs);

    if (rotateDegrees != 0) {
      g2d.setTransform(saveXForm);
    }
  }
 
Example 5
Project: litiengine   File: RenderEngine.java   View Source Code Vote up 5 votes
public static void fillShape(final Graphics2D g, final Shape shape) {
  if (shape == null) {
    return;
  }

  final AffineTransform oldTransForm = g.getTransform();
  final AffineTransform t = new AffineTransform();
  t.scale(Game.getCamera().getRenderScale(), Game.getCamera().getRenderScale());
  t.translate(Game.getCamera().getPixelOffsetX(), Game.getCamera().getPixelOffsetY());

  g.setTransform(t);
  g.fill(shape);
  g.setTransform(oldTransForm);
}
 
Example 6
Project: geomapapp   File: MGGData.java   View Source Code Vote up 5 votes
protected void drawCurrentSeg(Graphics2D g, boolean on) {
		if( currentSeg==null ) return;
		Color color = g.getColor();
		Stroke stroke = g.getStroke();
		AffineTransform at = g.getTransform();
		g.setColor( on ? ON_COLOR : OFF_COLOR );

//		***** GMA 1.5.2: TESTING
//		g.setStroke( new BasicStroke( 1f/ (float)map.getZoom()) );
		g.setStroke( new BasicStroke( 5f/ (float)map.getZoom()) );
//		***** GMA 1.5.2

		double wrap = map.getWrap();
		if( wrap>0. ) {
			g.translate(-wrap, 0.);
			g.draw( currentSeg );
			g.translate(wrap, 0.);
			g.draw( currentSeg );
			g.translate(wrap, 0.);
			g.draw( currentSeg );
		} else {
			g.draw( currentSeg );
		}
		g.setColor(color);
		g.setStroke(stroke);
		g.setTransform( at);
	}
 
Example 7
Project: FaceAnnotationTool   File: MyImagePanel.java   View Source Code Vote up 5 votes
public void drawStaticEllipses(Graphics2D g2d) {
	AffineTransform old = g2d.getTransform();
	// -----------------------------------------//
	ArrayList<Ellipse> staticEllipses = mImg.getEllipseStatic();
	if (staticEllipses == null)
		return;
	int i = 0;
	for (Ellipse e : staticEllipses) {
		e = e.offset(minX, minY);
		BasicStroke bs = UniversalTool.getPreferableStroke(Math.max(e.major, e.minor) * 2);

		// do rotation
		g2d.rotate(e.angle, e.x, e.y);
		// draw elps

		Ellipse2D.Double ed = e.getErectedEllipse2D();
		if(i == highlightedStaticEllipseIdx){
			g2d.setColor(Color.CYAN);
		}else{
			g2d.setColor(Color.black);
		}
		
		g2d.setStroke(bs);
		g2d.draw(ed);

		g2d.setColor(Color.yellow);
		g2d.setStroke(new BasicStroke(bs.getLineWidth() / 2));

		g2d.draw(ed);

		// reset transform
		g2d.setTransform(old);
		i++;
	}
}
 
Example 8
Project: agar.io   File: EZ.java   View Source Code Vote up 5 votes
@Override public void paint(Graphics2D g2) {
  if (this.isShowing) {
    //g2.setFont(new Font(fontName, Font.PLAIN, fontSize));
    g2.setFont(  dFont.deriveFont( (float) fontSize) ); 
    g2.setColor(color);
    // only print if the message has visible characters.
    if (msg.trim().length() > 0) {
      AffineTransform tmp = g2.getTransform();
      g2.setTransform(EZElement.transformHelper(this));
      g2.drawString(msg, -getWidth() / 2, getHeight() / 3);
      g2.setTransform(tmp);
    }
  }
}
 
Example 9
Project: AWGW   File: DisplayMap.java   View Source Code Vote up 5 votes
public void paintIcon(Component comp, Graphics g, int x, int y)
{
    Graphics2D g2 = (Graphics2D) g;
    AffineTransform savedTransform = g2.getTransform(); // save current
    displayObj.draw(null, comp, g2, new Rectangle(x, y, getIconWidth(),
            getIconHeight()));
    g2.setTransform(savedTransform); // restore coordinate system
}
 
Example 10
Project: geomapapp   File: MGGData.java   View Source Code Vote up 5 votes
public void draw( Graphics2D g ) {
	Rectangle area = g.getClipBounds();
	currentPoint = null;
	if( !intersects(area) ) return;
	Color color = g.getColor();
	g.setColor( OFF_COLOR );
	GeneralPath path = new GeneralPath();
	float offset = (float)this.offset;
	for( int seg=0 ; seg<cptIndex.length ; seg++ ) {
		path.moveTo( offset+cptX[seg][0], cptY[seg][0] );
		for( int i=0 ; i<cptIndex[seg].length ; i++ ) {
			path.lineTo( offset+cptX[seg][i], cptY[seg][i] );
		}
	}
	g.draw(path);
	double wrap = map.getWrap();
	if(wrap>0) {
		AffineTransform xform = g.getTransform();
		offset += (float)wrap;
		while( mapBounds.getX()+(double)offset < area.getX()+area.getWidth() ) {
			g.translate( (double)wrap, 0.d );
			g.draw(path);
			offset += (float)wrap;
		}
		g.setTransform( xform );
	}
	g.setColor( ON_COLOR );
	drawCurrentSeg(g, true);
	g.setColor( color );
}
 
Example 11
Project: geomapapp   File: ImageLayer.java   View Source Code Vote up 5 votes
public void draw(Graphics2D g, AffineTransform aTrans, Rectangle2D bounds) {
	AffineTransform at0 = g.getTransform();
	g.transform( aTrans );
	g.translate( x, y );
	g.scale( scale, scale );
	g.drawRenderedImage( image, new AffineTransform() );
	g.setTransform( at0 );
}
 
Example 12
Project: jdk8u-jdk   File: FontPanel.java   View Source Code Vote up 5 votes
private void tlDrawLine( Graphics2D g2, TextLayout tl,
                                   float baseX, float baseY ) {
    /// ABP - keep track of old tform, restore it later
    AffineTransform oldTx = null;
    oldTx = g2.getTransform();
    g2.translate( baseX, baseY );
    g2.transform( getAffineTransform( g2Transform ) );

    tl.draw( g2, (float) 0, (float) 0 );

    /// ABP - restore old tform
    g2.setTransform ( oldTx );

}
 
Example 13
Project: geomapapp   File: MapImage.java   View Source Code Vote up 5 votes
public void draw( Graphics2D g ) {
	if( image==null )return;
	AffineTransform at = g.getTransform();
	g.translate( x0, y0 );
	g.scale( scale, scale );
	g.drawRenderedImage(image, new AffineTransform() );
}
 
Example 14
Project: java-course   File: BarChartComponent.java   View Source Code Vote up 5 votes
/**
 * Draws description for each axis.
 * 
 * @param g
 *            The {@link Graphics} object.
 */
private void printDescription(Graphics g) {
    String text = chart.getxDescription();
    FontMetrics fm = g.getFontMetrics();
    int width = getTextWidth(text, g);

    // Draws description for x-axis
    g.setColor(Color.black);
    g.drawString(text, rect.x + (rect.width - width) / 2, rect.height
            - SPACE);

    // Draws description for y-axis
    Graphics2D g2d = (Graphics2D) g.create();
    AffineTransform defaultAt = g2d.getTransform();
    AffineTransform at = new AffineTransform();
    at.rotate(3 * Math.PI / 2);

    g2d.setTransform(at);
    g2d.setColor(Color.black);

    text = chart.getyDescription();
    width = fm.stringWidth(text);

    g2d.drawString(text,
            -(rect.y + (rect.height + width * 2 + SPACE) / 2 - yPoint),
            SPACE * 2);
    g2d.setTransform(defaultAt);
    g2d.dispose();
}
 
Example 15
Project: geomapapp   File: D18oObservations.java   View Source Code Vote up 4 votes
public void draw(Graphics2D g) {
//	if(!display) return;
int yr1 = 1900;
int yr2 = 2005;
try {
	long[] interval = timeInterval();
	Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
	if( db.before.isSelected() ) {
			cal.setTimeInMillis(interval[0]);
			yr1 = cal.get(cal.YEAR);
	}
	if( db.after.isSelected() ) {
		cal.setTimeInMillis(interval[1]);
		yr2 = cal.get(cal.YEAR);
	}
} catch(Exception e) {
}
//	System.out.println( yr1 +"\t"+ yr2);
	float size = 2.0f + 6f/(float)map.getZoom();
	Arc2D.Float dot = new Arc2D.Float(-size/2f, -size/2f, size, size, 0f, 360f, Arc2D.CHORD);
	float size1 = 2.0f + 7f/(float)map.getZoom();
	GeneralPath triangle = new GeneralPath();
	triangle.moveTo(0f, size1/2f );
	triangle.lineTo(size1/2f, -size1/2f );
	triangle.lineTo(-size1/2f, -size1/2f );
	triangle.closePath();
//	Rectangle2D.Float square = new Rectangle2D.Float(-size1/2f, -size1/2f, size1, size1);
	AffineTransform at = g.getTransform();
	g.setStroke( new BasicStroke( .5f/(float)map.getZoom() ) );
	RenderingHints hints = g.getRenderingHints();
	g.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING,
			RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
	g.setRenderingHint( RenderingHints.KEY_ANTIALIASING,
			RenderingHints.VALUE_ANTIALIAS_ON);

	Shape shape = dot;
	for(int k=0 ; k<xyd.length ; k++) {
	//	Shape shape = triangle;
	//	if( xyd[k][5]<=1991f ) shape = dot;
		if( xyd[k][5]>yr2 )continue;
		if( xyd[k][5]<yr1 )continue;
		g.translate( (double)xyd[k][0], (double)xyd[k][1] );
	//	g.setColor( Color.black );
	//	g.draw(shape);
		g.setColor( color[k] );
		g.fill(shape);
		g.setColor( Color.black );
		g.draw(shape);
		g.setTransform( at );
	}
	g.setFont( (new Font("Serif", Font.BOLD, 1)).deriveFont( size1*1.5f));
	Rectangle2D rect = map.getClipRect2D();
	double s = (double) size1;
	double x = rect.getX() + s;
	double y = rect.getY() + 2.*s;
//	g.translate( x, y );
//	g.setColor( Color.white );
//	g.fill( dot );
//	g.setColor( Color.black );
//	g.draw( dot );
//	g.translate( s, s/2.);
//	String year = db.startF.getText();
//	String dateString = db.before.isSelected()
//		? "before 1/1/"+year
//		: "after 1/1/"+year;
//	g.drawString( dateString, 0, 0);
//	g.drawString( "before 1/1/1991", 0, 0);
//	g.setTransform(at);
//	g.translate( x, y+s*2.0 );
//	g.setColor( Color.white );
//	g.fill( triangle );
//	g.setColor( Color.black );
//	g.draw( triangle );
//	g.translate( s, s/2.);
//	g.drawString( "after 1/1/1991", 0, 0);
	g.setTransform(at);
	g.setRenderingHints( hints);
}
 
Example 16
Project: FaceAnnotationTool   File: MyImagePanel.java   View Source Code Vote up 4 votes
public void drawElps(Graphics2D g2d, ArrayList<Ellipse> elpses) {
	if (!unfinished.isEmpty()){
		this.activedEllipseIdx = -1;
		mainFrame.coordListTH.deselect();
	}
		
	AffineTransform old = g2d.getTransform();
	// -----------------------------------------//

	int i = 0;
	for (Ellipse e : elpses) {

		ArrayList<Point_> keyPoints = e.getKeyPoints();
		BasicStroke bs = UniversalTool.getPreferableStroke(Math.max(e.major, e.minor));

		g2d.setStroke(bs);
		// do rotation
		g2d.rotate(e.angle, e.x, e.y);
		// draw elps

		if (i == this.activedEllipseIdx) {
			g2d.setColor(Color.magenta);
		} else {
			g2d.setColor(Color.GREEN);
		}

		Ellipse2D.Double ed = e.getErectedEllipse2D();
		g2d.draw(ed);

		// reset transform
		g2d.setTransform(old);
		// draw keypoints

		if (i == this.activedEllipseIdx) {
			g2d.setColor(Color.white);
		} else {
			g2d.setColor(Color.red);
		}
		for (Point_ p : keyPoints) {

			g2d.fill(UniversalTool.getPointOval(p, 2.2 * bs.getLineWidth()));
		}
		i++;
	}
}
 
Example 17
Project: Tarski   File: mxCurveLabelShape.java   View Source Code Vote up 4 votes
/**
 * 
 */
public void paintShape(mxGraphics2DCanvas canvas, String text, mxCellState state,
    Map<String, Object> style) {
  Rectangle rect = state.getLabelBounds().getRectangle();
  Graphics2D g = canvas.getGraphics();

  if (labelGlyphs == null) {
    updateLabelBounds(text, style);
  }

  if (labelGlyphs != null && (g.getClipBounds() == null || g.getClipBounds().intersects(rect))) {
    // Creates a temporary graphics instance for drawing this shape
    float opacity = mxUtils.getFloat(style, mxConstants.STYLE_OPACITY, 100);
    Graphics2D previousGraphics = g;
    g = canvas.createTemporaryGraphics(style, opacity, state);

    Font font = mxUtils.getFont(style, canvas.getScale());
    g.setFont(font);

    Color fontColor = mxUtils.getColor(style, mxConstants.STYLE_FONTCOLOR, Color.black);
    g.setColor(fontColor);

    g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, FONT_FRACTIONALMETRICS);

    for (int j = 0; j < labelGlyphs.length; j++) {
      mxLine parallel = labelGlyphs[j].glyphGeometry;

      if (labelGlyphs[j].visible && parallel != null && parallel != mxCurve.INVALID_POSITION) {
        mxPoint parallelEnd = parallel.getEndPoint();
        double x = parallelEnd.getX();
        double rotation = (Math.atan(parallelEnd.getY() / x));

        if (x < 0) {
          // atan only ranges from -PI/2 to PI/2, have to offset
          // for negative x values
          rotation += Math.PI;
        }

        final AffineTransform old = g.getTransform();
        g.translate(parallel.getX(), parallel.getY());
        g.rotate(rotation);
        Shape letter = labelGlyphs[j].glyphShape;
        g.fill(letter);
        g.setTransform(old);
      }
    }

    g.dispose();
    g = previousGraphics;
  }
}
 
Example 18
Project: geomapapp   File: SurveyLine.java   View Source Code Vote up 4 votes
@Override
public void draw(Graphics2D g) {
	float wrap = (float)map.getWrap();
	
	//get the limits of the displayed map
	Rectangle2D rect = map.getClipRect2D();
	double xmin = rect.getMinX();
	double xmax = rect.getMaxX();
	
	Projection proj = map.getProjection();
	Point2D.Double pt = new Point2D.Double();
	pt.x = getStartLon();
	pt.y = getStartLat();
	Point2D.Double p_start = (Point2D.Double) proj.getMapXY(pt);

	if( wrap>0f ) {
		while( p_start.x <= xmin ){p_start.x+=wrap;}
		while( p_start.x >= xmax ){p_start.x-=wrap;}
	}
	
	pt.x = getEndLon();
	pt.y = getEndLat();
	Point2D.Double p_end = (Point2D.Double) proj.getMapXY(pt);

	if( wrap>0f ) {
		while( p_end.x <= xmin ){p_end.x+=wrap;}
		while( p_end.x > wrap + xmin ){p_end.x-=wrap;}
	}
	
	//draw the shortest line - either p_start.x to p_end.x or the x+wrap values. 
	if ( ((p_start.x - p_end.x) * (p_start.x - p_end.x)) > 
		((p_start.x - (p_end.x + wrap)) * (p_start.x - (p_end.x + wrap))) )  {p_end.x += wrap;}
	if ( ((p_start.x - p_end.x) * (p_start.x - p_end.x)) > 
	(((p_start.x + wrap) - p_end.x) * ((p_start.x + wrap) - p_end.x)) )  {p_start.x += wrap;}
	
	if (lineNum == 1) g.setColor( Color.RED ); 
	else g.setColor( Color.black );
	
	double zoom = map.getZoom();
	g.setStroke( new BasicStroke( 2f/(float)zoom ));

   	double arr_size = 6./zoom;
   	double sq_size = 6./zoom;
       double dx = p_end.x - p_start.x, dy = p_end.y - p_start.y;
       double angle = Math.atan2(dy, dx);
       double len = Math.sqrt(dx*dx + dy*dy);

       AffineTransform at = g.getTransform(); 
       g.translate(p_start.x, p_start.y);
       g.rotate(angle);

       //draw the line
       g.draw(new Line2D.Double(0, 0, len, 0));
       //draw the arrow
       Path2D arrow = new Path2D.Double();
       double xpts[] = {len/3d, len/3d-arr_size, len/3d-arr_size, len/3d};
       double ypts[] = {0, -arr_size, arr_size, 0};
       arrow.moveTo(xpts[0], ypts[0]);
       arrow.lineTo(xpts[1], ypts[1]);
       arrow.lineTo(xpts[2], ypts[2]);
       arrow.closePath();
	if (lineNum == 1) g.setColor( Color.ORANGE ); 
	else g.setColor( Color.ORANGE );
       g.fill(arrow);
	if (lineNum == 1) g.setColor( Color.RED ); 
	else g.setColor( Color.black );
       //draw squares at the end points
       Rectangle2D startSq = new Rectangle2D.Double(0d-sq_size/2d, 0d-sq_size/2d, sq_size, sq_size);
       Rectangle2D endSq = new Rectangle2D.Double(len-sq_size/2d, 0d-sq_size/2d,  sq_size, sq_size);
       g.fill(startSq);
       g.fill(endSq);

       g.setTransform(at);
       
}
 
Example 19
Project: SE2017-Team2   File: CrDrawing.java   View Source Code Vote up 4 votes
/**
 * Draws an arrow representing a relation
 * @param g
 * @param e1
 * @param e2
 * @param c
 * @param id
 * @param isConditional
 */
private void drawArrow(Graphics2D g, Event e1, Event e2, Color c, String id, boolean isConditional) {
	Tuple<Position, Position> tuple = shortest(e1, e2);
	Position p1 = tuple.f;
	Position p2 = tuple.s;
	relationPos.add(p1); 
	relationPos.add(p2); 
	AffineTransform oldXForm = g.getTransform();
	g.setColor(c);
	int ARR_SIZE = 8;
	Stroke oldS = g.getStroke();
	int strokeSize = ARR_SIZE/4;
	Stroke newS = new BasicStroke(strokeSize);
	g.setStroke(newS);
		
	double dx = p2.x() - p1.x(), dy = p2.y() - p1.y();
	double angle = Math.atan2(dy, dx);
	
	int len = (int) Math.sqrt(dx*dx + dy*dy);
	AffineTransform at = AffineTransform.getTranslateInstance(p1.x(), p1.y());
	at.concatenate(AffineTransform.getRotateInstance(angle));
	g.transform(at);
	Font fontUp = new Font("Times New Roman", Font.BOLD, 18);
	Font fontDw = new Font("Times New Roman", Font.BOLD, -18);
	FontMetrics mUp = g.getFontMetrics(fontUp);
	if (isConditional) {
		if (p1.x() > p2.x()) {
			g.setFont(fontDw);
			g.drawString(id, (len/2), -strokeSize+MARGIN);
		}
		else {
			g.setFont(fontUp);
			g.drawString(id, (len/2)-mUp.stringWidth(id), -strokeSize);
		}
		len -= CIRCLE_RADIUS;
		g.drawLine(0, 0, len-ARR_SIZE, 0);
		g.fillRoundRect(len, -(CIRCLE_RADIUS/2), CIRCLE_RADIUS, CIRCLE_RADIUS, CIRCLE_RADIUS, CIRCLE_RADIUS);
	}
	else {
		if (p1.x() > p2.x()) {
			g.setFont(fontDw);
			g.drawString(id, CIRCLE_RADIUS+(len/2), -strokeSize+MARGIN);
		}
		else {
			g.setFont(fontUp);
			g.drawString(id, CIRCLE_RADIUS+(len/2)-mUp.stringWidth(id), -strokeSize);
		}
		g.drawLine(CIRCLE_RADIUS, 0, len-ARR_SIZE, 0);
		g.fillRoundRect(0, -(CIRCLE_RADIUS/2), CIRCLE_RADIUS, CIRCLE_RADIUS, CIRCLE_RADIUS, CIRCLE_RADIUS);
	}
	g.fillPolygon(new int[] {len, len-ARR_SIZE, len-ARR_SIZE, len},
                    new int[] {0, -ARR_SIZE, ARR_SIZE, 0}, 4);
	//reset
	g.setStroke(oldS);
	g.setTransform(oldXForm);
}
 
Example 20
Project: OpenJSharp   File: FontPanel.java   View Source Code Vote up 4 votes
private void modeSpecificDrawLine( Graphics2D g2, String line,
                                   int baseX, int baseY ) {
    /// ABP - keep track of old tform, restore it later
    AffineTransform oldTx = null;
    oldTx = g2.getTransform();
    g2.translate( baseX, baseY );
    g2.transform( getAffineTransform( g2Transform ) );

    switch ( drawMethod ) {
      case DRAW_STRING:
        g2.drawString( line, 0, 0 );
        break;
      case DRAW_CHARS:
        g2.drawChars( line.toCharArray(), 0, line.length(), 0, 0 );
        break;
      case DRAW_BYTES:
        try {
            byte lineBytes[] = line.getBytes( "ISO-8859-1" );
            g2.drawBytes( lineBytes, 0, lineBytes.length, 0, 0 );
        }
        catch ( Exception e ) {
            e.printStackTrace();
        }
        break;
      case DRAW_GLYPHV:
        GlyphVector gv =
          testFont.createGlyphVector( g2.getFontRenderContext(), line );
        g2.drawGlyphVector( gv, (float) 0, (float) 0 );
        break;
      case TL_DRAW:
        TextLayout tl = new TextLayout( line, testFont,
                                        g2.getFontRenderContext() );
        tl.draw( g2, (float) 0, (float) 0 );
        break;
      case GV_OUTLINE:
        GlyphVector gvo =
          testFont.createGlyphVector( g2.getFontRenderContext(), line );
        g2.draw( gvo.getOutline( (float) 0, (float) 0 ));
        break;
      case TL_OUTLINE:
        TextLayout tlo =
          new TextLayout( line, testFont,
                          g2.getFontRenderContext() );
        AffineTransform at = new AffineTransform();
        g2.draw( tlo.getOutline( at ));
    }

    /// ABP - restore old tform
    g2.setTransform ( oldTx );

}