use of java.awt.RenderingHints in project jgnash by ccavanaugh.
the class VerticalTextIcon method paintIcon.
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
RenderingHints oldHints = g2.getRenderingHints();
Font oldFont = g.getFont();
Color oldColor = g.getColor();
AffineTransform oldTransform = g2.getTransform();
if (fm == null) {
fm = g.getFontMetrics(font);
}
g2.setRenderingHints(renderHints);
g.setFont(font);
g.setColor(Color.black);
if (clockwise) {
g2.translate(x + getIconWidth(), y);
g2.rotate(Math.PI / 2);
} else {
g2.translate(x, y + getIconHeight());
g2.rotate(-Math.PI / 2);
}
//g.drawString(text, 0, fm.getLeading() + fm.getAscent());
g.drawString(text, 0, fm.getLeading() + fm.getAscent() - (fm.getDescent() / 2));
g.setFont(oldFont);
g.setColor(oldColor);
g2.setTransform(oldTransform);
g2.setRenderingHints(oldHints);
}
use of java.awt.RenderingHints in project libgdx by libgdx.
the class ShadowEffect method blur.
private void blur(BufferedImage image) {
float[] matrix = GAUSSIAN_BLUR_KERNELS[blurKernelSize - 1];
Kernel gaussianBlur1 = new Kernel(matrix.length, 1, matrix);
Kernel gaussianBlur2 = new Kernel(1, matrix.length, matrix);
RenderingHints hints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
ConvolveOp gaussianOp1 = new ConvolveOp(gaussianBlur1, ConvolveOp.EDGE_NO_OP, hints);
ConvolveOp gaussianOp2 = new ConvolveOp(gaussianBlur2, ConvolveOp.EDGE_NO_OP, hints);
BufferedImage scratchImage = EffectUtil.getScratchImage();
for (int i = 0; i < blurPasses; i++) {
gaussianOp1.filter(image, scratchImage);
gaussianOp2.filter(scratchImage, image);
}
}
use of java.awt.RenderingHints in project openblocks by mikaelhg.
the class Comment method paint.
/**
* overrides javax.Swing.JPanel.paint()
*/
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
if (active) {
g2.setColor(getBorderColor().brighter());
} else {
g2.setColor(getBorderColor());
}
g2.fill(body);
if (active) {
g2.setColor(Comment.background.brighter());
} else {
g2.setColor(Comment.background);
}
g2.fill(textarea);
if (active) {
g2.setColor(Color.white);
} else {
g2.setColor(Color.lightGray);
}
g2.draw(textarea);
if (active) {
g2.setColor(Color.lightGray.brighter());
} else {
g2.setColor(Color.lightGray);
}
g2.fill(resize);
super.paint(g);
}
use of java.awt.RenderingHints in project jdk8u_jdk by JetBrains.
the class PostEventQueue method getDesktopAAHintsByName.
/* "false", "off", ""default" aren't explicitly tested, they
* just fall through to produce a null return which all are equated to
* "false".
*/
private static RenderingHints getDesktopAAHintsByName(String hintname) {
Object aaHint = null;
hintname = hintname.toLowerCase(Locale.ENGLISH);
if (hintname.equals("on")) {
aaHint = VALUE_TEXT_ANTIALIAS_ON;
} else if (hintname.equals("gasp")) {
aaHint = VALUE_TEXT_ANTIALIAS_GASP;
} else if (hintname.equals("lcd") || hintname.equals("lcd_hrgb")) {
aaHint = VALUE_TEXT_ANTIALIAS_LCD_HRGB;
} else if (hintname.equals("lcd_hbgr")) {
aaHint = VALUE_TEXT_ANTIALIAS_LCD_HBGR;
} else if (hintname.equals("lcd_vrgb")) {
aaHint = VALUE_TEXT_ANTIALIAS_LCD_VRGB;
} else if (hintname.equals("lcd_vbgr")) {
aaHint = VALUE_TEXT_ANTIALIAS_LCD_VBGR;
}
if (aaHint != null) {
RenderingHints map = new RenderingHints(null);
map.put(KEY_TEXT_ANTIALIASING, aaHint);
return map;
} else {
return null;
}
}
use of java.awt.RenderingHints in project jdk8u_jdk by JetBrains.
the class GeneralCompositePipe method startSequence.
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR, int[] abox) {
RenderingHints hints = sg.getRenderingHints();
ColorModel model = sg.getDeviceColorModel();
PaintContext paintContext = sg.paint.createContext(model, devR, s.getBounds2D(), sg.cloneTransform(), hints);
CompositeContext compositeContext = sg.composite.createContext(paintContext.getColorModel(), model, hints);
return new TileContext(sg, paintContext, compositeContext, model);
}
Aggregations