use of java.awt.RenderingHints in project jdk8u_jdk by JetBrains.
the class AffineTransformOp method getRenderingHints.
/**
* Returns the rendering hints used by this transform operation.
*
* @return The <CODE>RenderingHints</CODE> object associated with this op.
*/
public final RenderingHints getRenderingHints() {
if (hints == null) {
Object val;
switch(interpolationType) {
case TYPE_NEAREST_NEIGHBOR:
val = RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
break;
case TYPE_BILINEAR:
val = RenderingHints.VALUE_INTERPOLATION_BILINEAR;
break;
case TYPE_BICUBIC:
val = RenderingHints.VALUE_INTERPOLATION_BICUBIC;
break;
default:
// Should never get here
throw new InternalError("Unknown interpolation type " + interpolationType);
}
hints = new RenderingHints(RenderingHints.KEY_INTERPOLATION, val);
}
return hints;
}
use of java.awt.RenderingHints in project jabref by JabRef.
the class JTextAreaWithPlaceholder method paintComponent.
@Override
protected void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
if (this.getText().isEmpty()) {
Font prev = graphics.getFont();
Color prevColor = graphics.getColor();
graphics.setColor(UIManager.getColor("textInactiveText"));
int textHeight = graphics.getFontMetrics().getHeight();
int x = this.getInsets().left;
Graphics2D g2d = (Graphics2D) graphics;
RenderingHints hints = g2d.getRenderingHints();
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.drawString(textWhenNotFocused, x, textHeight + this.getInsets().top);
g2d.setRenderingHints(hints);
graphics.setFont(prev);
graphics.setColor(prevColor);
}
}
use of java.awt.RenderingHints in project jabref by JabRef.
the class JTextFieldWithPlaceholder method paintComponent.
@Override
protected void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
if (this.getText().isEmpty()) {
int height = this.getHeight();
Font prev = graphics.getFont();
Color prevColor = graphics.getColor();
graphics.setColor(UIManager.getColor("textInactiveText"));
int textHeight = graphics.getFontMetrics().getHeight();
int textBottom = (((height - textHeight) / 2) + textHeight) - 4;
int x = this.getInsets().left;
Graphics2D g2d = (Graphics2D) graphics;
RenderingHints hints = g2d.getRenderingHints();
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.drawString(textWhenNotFocused, x, textBottom);
g2d.setRenderingHints(hints);
graphics.setFont(prev);
graphics.setColor(prevColor);
}
}
use of java.awt.RenderingHints in project poi by apache.
the class PPGraphics2D method setRenderingHints.
/**
* Replaces the values of all preferences for the rendering
* algorithms with the specified <code>hints</code>.
* The existing values for all rendering hints are discarded and
* the new set of known hints and values are initialized from the
* specified {@link Map} object.
* Hint categories include controls for rendering quality and
* overall time/quality trade-off in the rendering process.
* Refer to the <code>RenderingHints</code> class for definitions of
* some common keys and values.
* @param hints the rendering hints to be set
* @see RenderingHints
*/
public void setRenderingHints(Map<?, ?> hints) {
this._hints = new RenderingHints(null);
this._hints.putAll(hints);
}
Aggregations