diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/demos/j2d/CustomText.java | 15 | ||||
-rwxr-xr-x | src/demos/j2d/FlyingText.java | 4 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/demos/j2d/CustomText.java b/src/demos/j2d/CustomText.java index 6032d23..05c0048 100755 --- a/src/demos/j2d/CustomText.java +++ b/src/demos/j2d/CustomText.java @@ -384,6 +384,12 @@ public class CustomText extends Demo { return false; } + public Rectangle2D getBounds(CharSequence str, + Font font, + FontRenderContext frc) { + return getBounds(str.toString(), font, frc); + } + public Rectangle2D getBounds(String str, Font font, FontRenderContext frc) { @@ -395,6 +401,15 @@ public class CustomText extends Demo { stringBounds.getHeight() + dropShadowDepth); } + public void drawGlyphVector(Graphics2D graphics, GlyphVector str, int x, int y) { + graphics.setColor(DROP_SHADOW_COLOR); + graphics.drawGlyphVector(str, x + dropShadowDepth, y + dropShadowDepth); + graphics.setColor(Color.WHITE); + graphics.setPaint(new GradientPaint(x, y, color1, + x, y + gradientSize / 2, color2, + true)); + graphics.drawGlyphVector(str, x, y); + } public void draw(Graphics2D graphics, String str, int x, int y) { graphics.setColor(DROP_SHADOW_COLOR); diff --git a/src/demos/j2d/FlyingText.java b/src/demos/j2d/FlyingText.java index 205263e..81deeec 100755 --- a/src/demos/j2d/FlyingText.java +++ b/src/demos/j2d/FlyingText.java @@ -359,6 +359,8 @@ public class FlyingText extends Demo { 0); gl.glRotatef(info.angle, 0, 0, 1); renderer.draw(info.text, 0, 0); + // We need to call flush() only because we're modifying the modelview matrix + renderer.flush(); } // Now render the actual text @@ -371,6 +373,8 @@ public class FlyingText extends Demo { gl.glRotatef(info.angle, 0, 0, 1); renderer.setColor(info.r, info.g, info.b, 1); renderer.draw(info.text, 0, 0); + // We need to call flush() only because we're modifying the modelview matrix + renderer.flush(); } renderer.endRendering(); |