From 7d7c32b6e25319fae2d4b5026a9dd8e77044d5be Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 1 Feb 2006 22:03:56 +0000 Subject: [PATCH] Added a little flag that subclasses can use to tell whether the layout is being painted as part of the 'main' rendering of the text, or whether it's an auxiliary rendering used for such things as shadows or outlines. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1777 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/swing/Label.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/java/com/samskivert/swing/Label.java b/src/java/com/samskivert/swing/Label.java index 823959ad..e426f50b 100644 --- a/src/java/com/samskivert/swing/Label.java +++ b/src/java/com/samskivert/swing/Label.java @@ -598,6 +598,7 @@ public class Label implements SwingConstants, LabelStyleConstants // using "real" outlines (via TextLayout.getOutline), method textColor = gfx.getColor(); gfx.setColor(_alternateColor); + _mainDraw = false; layout.draw(gfx, rx, y); layout.draw(gfx, rx, y + 1); layout.draw(gfx, rx, y + 2); @@ -606,18 +607,23 @@ public class Label implements SwingConstants, LabelStyleConstants layout.draw(gfx, rx + 2, y); layout.draw(gfx, rx + 2, y + 1); layout.draw(gfx, rx + 2, y + 2); + _mainDraw = true; gfx.setColor(textColor); layout.draw(gfx, rx + 1, y + 1); } else if ((_style & SHADOW) != 0) { textColor = gfx.getColor(); gfx.setColor(_alternateColor); + _mainDraw = false; layout.draw(gfx, rx, y + 1); + _mainDraw = true; gfx.setColor(textColor); layout.draw(gfx, rx + 1, y); } else if ((_style & BOLD) != 0) { + _mainDraw = false; layout.draw(gfx, rx, y); + _mainDraw = true; layout.draw(gfx, rx + 1, y); } else { @@ -798,6 +804,11 @@ public class Label implements SwingConstants, LabelStyleConstants * be rendered with the graphics context color. */ protected Color _textColor = null; + /** Will be true only when we're drawing a textlayout for the "main" + * portion of the label. If we are in OUTLINE mode, we draw each layout + * 9 times: the last one is the only main one. */ + protected boolean _mainDraw = true; + // /** Used for debugging. */ // protected String _invalidator;