本文整理汇总了Java中java.awt.Graphics2D.drawBytes方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics2D.drawBytes方法的具体用法?Java Graphics2D.drawBytes怎么用?Java Graphics2D.drawBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Graphics2D
的用法示例。
在下文中一共展示了Graphics2D.drawBytes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modeSpecificDrawLine
import java.awt.Graphics2D; //导入方法依赖的package包/类
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 );
}