本文整理汇总了Java中java.awt.RenderingHints.put方法的典型用法代码示例。如果您正苦于以下问题:Java RenderingHints.put方法的具体用法?Java RenderingHints.put怎么用?Java RenderingHints.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.RenderingHints
的用法示例。
在下文中一共展示了RenderingHints.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import java.awt.RenderingHints; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g2d.addRenderingHints(renderHints);
g2d.setPaint(Color.BLACK);
Stroke stroke = new BasicStroke(2.f,
BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
g2d.setStroke(stroke);
PintarTextos(g2d);
}
示例2: paintComponent
import java.awt.RenderingHints; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g); //paint background
if (diagramaAtual == null) {
return;
}
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setPaint(Color.BLACK);
Stroke stroke = new BasicStroke(2.f,
BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER);
Canvas.setStroke(stroke);
Canvas.drawRect(box.getLocation().x, box.getLocation().y, box.getWidth(), box.getHeight());
Canvas.setPaint(Color.GRAY);
Canvas.drawRect(box.getLocation().x + 1, box.getLocation().y + 1, box.getWidth(), box.getHeight());
//Canvas.setPaint(Color.BLACK);
}
示例3: paint
import java.awt.RenderingHints; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
RenderingHints renderHints =
new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
super.paint(g);
for (IObjetoPintavel p: pintaveis) {
p.setOutroPintor(true);
p.DoPaint(Canvas);
p.setOutroPintor(false);
}
}
示例4: paint
import java.awt.RenderingHints; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
super.paint(g);
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
paint2D(Canvas);
}
示例5: paint
import java.awt.RenderingHints; //导入方法依赖的package包/类
public void paint(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHints(rh);
Dimension size = getSize();
if (initialize) {
reset(size.width, size.height);
initialize = false;
}
this.step(size.width, size.height);
render(size.width, size.height, g2);
}
示例6: checkedRenderingHints
import java.awt.RenderingHints; //导入方法依赖的package包/类
public static RenderingHints checkedRenderingHints(RenderingHints rHints) {
if (!forceSpeed) return rHints;
RenderingHints hints = (RenderingHints)rHints.clone();
hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
hints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_SPEED);
hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
hints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
return hints;
}
示例7: makeHints
import java.awt.RenderingHints; //导入方法依赖的package包/类
RenderingHints makeHints(Map hints) {
RenderingHints model = new RenderingHints(hints);
model.put(SunHints.KEY_RENDERING,
SunHints.Value.get(SunHints.INTKEY_RENDERING,
renderHint));
model.put(SunHints.KEY_ANTIALIASING,
SunHints.Value.get(SunHints.INTKEY_ANTIALIASING,
antialiasHint));
model.put(SunHints.KEY_TEXT_ANTIALIASING,
SunHints.Value.get(SunHints.INTKEY_TEXT_ANTIALIASING,
textAntialiasHint));
model.put(SunHints.KEY_FRACTIONALMETRICS,
SunHints.Value.get(SunHints.INTKEY_FRACTIONALMETRICS,
fractionalMetricsHint));
model.put(SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST,
Integer.valueOf(lcdTextContrast));
Object value;
switch (interpolationHint) {
case SunHints.INTVAL_INTERPOLATION_NEAREST_NEIGHBOR:
value = SunHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR;
break;
case SunHints.INTVAL_INTERPOLATION_BILINEAR:
value = SunHints.VALUE_INTERPOLATION_BILINEAR;
break;
case SunHints.INTVAL_INTERPOLATION_BICUBIC:
value = SunHints.VALUE_INTERPOLATION_BICUBIC;
break;
default:
value = null;
break;
}
if (value != null) {
model.put(SunHints.KEY_INTERPOLATION, value);
}
model.put(SunHints.KEY_STROKE_CONTROL,
SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
strokeHint));
return model;
}
示例8: ExternalPaint
import java.awt.RenderingHints; //导入方法依赖的package包/类
public void ExternalPaint(Graphics g) {
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
for (int i = subItens.size() - 1; i > -1; i--) {
Elementar e = subItens.get(i);
if (e.CanPaint()) {
e.DoPaint(Canvas);
}
}
}
示例9: ExternalPaintSelecao
import java.awt.RenderingHints; //导入方法依赖的package包/类
public void ExternalPaintSelecao(Graphics g) {
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
for (int i = getItensSelecionados().size() - 1; i > -1; i--) {
FormaElementar e = getItensSelecionados().get(i);
e.HidePontos(true);
if (e.CanPaint()) {
e.DoPaint(Canvas);
}
e.HidePontos(false);
}
}
示例10: getListCellRendererComponent
import java.awt.RenderingHints; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
Legenda.ItemDeLegenda entry = (Legenda.ItemDeLegenda) value;
setText(entry.getTexto());
BufferedImage off_Image = new BufferedImage(ehLina ? 32 : 16, 16, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = off_Image.createGraphics();
RenderingHints renderHints =
new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g.addRenderingHints(renderHints);
g.setColor(entry.getCor());
if (ehLina) {
g.fillRect(1, 6, 30, 4);
} else {
g.fillRect(1, 1, 14, 14);
}
ImageIcon img = new ImageIcon(off_Image);
setIcon(img);
if (isSelected) {
setBackground(HIGHLIGHT_COLOR);
setForeground(Color.white);
} else {
setBackground(Color.white);
setForeground(Color.black);
}
return this;
}
示例11: paintComponent
import java.awt.RenderingHints; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g); //paint background
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
Graphics2D Canvas = (Graphics2D) g;
Canvas.addRenderingHints(renderHints);
Canvas.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
Canvas.setPaint(Color.BLACK);
ProcessPaint(Canvas);
}
示例12: drawArrow
import java.awt.RenderingHints; //导入方法依赖的package包/类
private void drawArrow(Graphics2D g, int x1, int y1, int x2, int y2) {
RenderingHints renderHints
= new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
renderHints.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.addRenderingHints(renderHints);
g.setStroke(new BasicStroke(
getSetaLargura(),
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND));
//g.setPaint(Color.BLACK);
int ARR_SIZE = 3 + getSetaLargura();
double dx = x2 - x1, dy = y2 - y1;
double angle = Math.atan2(dy, dx);
int len = (int) Math.sqrt(dx * dx + dy * dy);
AffineTransform at = AffineTransform.getTranslateInstance(x1, y1);
at.concatenate(AffineTransform.getRotateInstance(angle));
//AffineTransform bkp = g.getTransform();
g.setTransform(at);
// Draw horizontal arrow starting in (0, 0)
g.drawLine(ARR_SIZE, 0, len - ARR_SIZE, 0);
if (isSetaPontaEsquerda()) {
g.fillPolygon(new int[]{len, len - ARR_SIZE, len - ARR_SIZE, len},
new int[]{0, -ARR_SIZE, ARR_SIZE, 0}, 4);
}
if (isSetaPontaDireita()) {
g.fillPolygon(new int[]{0, ARR_SIZE, ARR_SIZE, 0},
new int[]{0, -ARR_SIZE, ARR_SIZE, 0}, 4);
}
}
示例13: initRenderingHints
import java.awt.RenderingHints; //导入方法依赖的package包/类
private void initRenderingHints() {
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
setRenderingHints(hints);
}
示例14: _defaultImageRenderingHints
import java.awt.RenderingHints; //导入方法依赖的package包/类
private RenderingHints _defaultImageRenderingHints() {
RenderingHints hints = new RenderingHints(null);
hints.put(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
return hints;
}
示例15: getDesktopAAHints
import java.awt.RenderingHints; //导入方法依赖的package包/类
synchronized RenderingHints getDesktopAAHints() {
/* Equate "DEFAULT" to "OFF", which it is in our implementation.
* Doing this prevents unnecessary pipeline revalidation where
* the value OFF is detected as a distinct value by SunGraphics2D
*/
Object fontSmoothingHint = VALUE_TEXT_ANTIALIAS_DEFAULT;
Integer fontSmoothingContrast = null;
Boolean smoothingOn = (Boolean)map.get("win.text.fontSmoothingOn");
if (smoothingOn != null && smoothingOn.equals(Boolean.TRUE)) {
Integer typeID = (Integer)map.get("win.text.fontSmoothingType");
/* "1" is GASP/Standard but we'll also use that if the return
* value is anything other than "2" for LCD.
*/
if (typeID == null || typeID.intValue() <= 1 ||
typeID.intValue() > 2) {
fontSmoothingHint = VALUE_TEXT_ANTIALIAS_GASP;
} else {
/* Recognise 0 as BGR and everything else as RGB - note
* that 1 is the expected value for RGB.
*/
Integer orientID = (Integer)
map.get("win.text.fontSmoothingOrientation");
/* 0 is BGR, 1 is RGB. Other values, assume RGB */
if (orientID == null || orientID.intValue() != 0) {
fontSmoothingHint = VALUE_TEXT_ANTIALIAS_LCD_HRGB;
} else {
fontSmoothingHint = VALUE_TEXT_ANTIALIAS_LCD_HBGR;
}
fontSmoothingContrast = (Integer)
map.get("win.text.fontSmoothingContrast");
if (fontSmoothingContrast == null) {
fontSmoothingContrast = Integer.valueOf(140);
} else {
/* Windows values are scaled 10x those of Java 2D */
fontSmoothingContrast =
Integer.valueOf(fontSmoothingContrast.intValue()/10);
}
}
}
RenderingHints hints = new RenderingHints(null);
hints.put(KEY_TEXT_ANTIALIASING, fontSmoothingHint);
if (fontSmoothingContrast != null) {
hints.put(KEY_TEXT_LCD_CONTRAST, fontSmoothingContrast);
}
return hints;
}