|
|
@ -27,6 +27,7 @@ public class DrawUtils { |
|
|
|
drawOutlineText(g,font,x,y,0,0,font_thickness,outline_thickness,text_color,shadow_color,message); |
|
|
|
drawOutlineText(g,font,x,y,0,0,font_thickness,outline_thickness,text_color,shadow_color,message); |
|
|
|
} |
|
|
|
} |
|
|
|
static void drawOutlineText(Graphics g, Font font, double x, double y, double xoffset, double yoffset, int font_thickness, int outline_thickness, Color text_color, Color shadow_color, String message) { |
|
|
|
static void drawOutlineText(Graphics g, Font font, double x, double y, double xoffset, double yoffset, int font_thickness, int outline_thickness, Color text_color, Color shadow_color, String message) { |
|
|
|
|
|
|
|
if (message.length()>0) { |
|
|
|
AttributedString as = new AttributedString(message); |
|
|
|
AttributedString as = new AttributedString(message); |
|
|
|
as.addAttribute(TextAttribute.FONT, font); |
|
|
|
as.addAttribute(TextAttribute.FONT, font); |
|
|
|
g.setColor(shadow_color); |
|
|
|
g.setColor(shadow_color); |
|
|
@ -53,6 +54,7 @@ public class DrawUtils { |
|
|
|
g2.setColor(text_color); |
|
|
|
g2.setColor(text_color); |
|
|
|
g2.drawString(as.getIterator(),(int)(x+xoffset),(int)(y+yoffset)); |
|
|
|
g2.drawString(as.getIterator(),(int)(x+xoffset),(int)(y+yoffset)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
public static void drawCenteredOutlineText(Graphics g, Font font, double x, double y, int outline_size, Color text_color, Color shadow_color, String message) { |
|
|
|
public static void drawCenteredOutlineText(Graphics g, Font font, double x, double y, int outline_size, Color text_color, Color shadow_color, String message) { |
|
|
|
Rectangle2D textBounds = TextUtils.calculateStringBoundsFont(message, font); |
|
|
|
Rectangle2D textBounds = TextUtils.calculateStringBoundsFont(message, font); |
|
|
|
drawOutlineText(g,font,x,y,-textBounds.getWidth()/2,-textBounds.getHeight()/2,1,outline_size,text_color,shadow_color,message); |
|
|
|
drawOutlineText(g,font,x,y,-textBounds.getWidth()/2,-textBounds.getHeight()/2,1,outline_size,text_color,shadow_color,message); |
|
|
|