當前位置: 首頁>>代碼示例>>Java>>正文


Java RenderingHints.KEY_ANTIALIASING屬性代碼示例

本文整理匯總了Java中java.awt.RenderingHints.KEY_ANTIALIASING屬性的典型用法代碼示例。如果您正苦於以下問題:Java RenderingHints.KEY_ANTIALIASING屬性的具體用法?Java RenderingHints.KEY_ANTIALIASING怎麽用?Java RenderingHints.KEY_ANTIALIASING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.RenderingHints的用法示例。


在下文中一共展示了RenderingHints.KEY_ANTIALIASING屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: readObject

/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream) 
    throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.borderStroke = SerialUtilities.readStroke(stream);
    this.borderPaint = SerialUtilities.readPaint(stream);
    this.backgroundPaint = SerialUtilities.readPaint(stream);
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.renderingHints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING, 
            RenderingHints.VALUE_ANTIALIAS_ON);

    // register as a listener with sub-components...
    if (this.title != null) {
        this.title.addChangeListener(this);
    }

    for (int i = 0; i < getSubtitleCount(); i++) {
        getSubtitle(i).addChangeListener(this);
    }
    this.plot.addChangeListener(this);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:JFreeChart.java

示例2: paint

@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);
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:19,代碼來源:MasterCli.java

示例3: paintComponent

@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);
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:27,代碼來源:Editor.java

示例4: paint

@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);
    }
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:18,代碼來源:PainelPintador.java

示例5: paint

@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);
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:24,代碼來源:InspectorItemBase.java

示例6: paint

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);
}
 
開發者ID:kevingilboy,項目名稱:COE1186,代碼行數:19,代碼來源:TimerBasedAnimation.java

示例7: TreePanel

/**
 * Constructs a new tree panel which handles drawing of the current tree.
 * 
 * @param window
 *            The window used for position related information.
 * 
 * @param manager
 *            The style manager used to handle colors.
 */
public TreePanel(final Window window, final StyleManager manager) {
	this.mWindow = window;
	this.mHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	this.mHints.put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
	this.mHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
	this.mHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
	this.mManager = manager;
	this.addMouseMotionListener(this);

	this.setPreferredSize(window.getTreePanelSize());
	this.setBorder(LineBorder.createBlackLineBorder());
	this.setBackground(manager.getTreepanelColor());
}
 
開發者ID:ZabuzaW,項目名稱:TreeFlood,代碼行數:22,代碼來源:TreePanel.java

示例8: render

@Override
public BufferedImage render(final BufferedImage baseImage) {

    int width = baseImage.getWidth();
    int height = baseImage.getHeight();

    // create an opaque image
    RenderingHints hints = new RenderingHints(
            RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_OFF);

    hints.add(new RenderingHints(RenderingHints.KEY_COLOR_RENDERING,
            RenderingHints.VALUE_COLOR_RENDER_QUALITY));
    hints.add(new RenderingHints(RenderingHints.KEY_ALPHA_INTERPOLATION,
            RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY));

    hints.add(new RenderingHints(RenderingHints.KEY_RENDERING,
            RenderingHints.VALUE_RENDER_QUALITY));

    BufferedImage imageWithBackground = new BufferedImage(width, height,
            BufferedImage.TYPE_INT_RGB);

    Graphics2D graph = (Graphics2D) imageWithBackground.getGraphics();
    graph.setRenderingHints(hints);
    graph.setPaint(new GradientPaint(0, 0, colorFrom, width, height, colorTo));
    graph.fill(new Rectangle2D.Double(0, 0, width, height));
    graph.drawImage(baseImage, 0, 0, null);
    graph.dispose();

    return imageWithBackground;
}
 
開發者ID:febit,項目名稱:febit,代碼行數:31,代碼來源:GradientBackgroundFilter.java

示例9: updateImageBuffer

public void updateImageBuffer(int width, int height)
{
	this.imageBuffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
	this.imageBufferGraphics = (Graphics2D) imageBuffer.getGraphics();

	RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
	this.imageBufferGraphics.setFont(font);

	imageBufferGraphics.setRenderingHints(rh);
	standardTransform = imageBufferGraphics.getTransform();
}
 
開發者ID:fossasia,項目名稱:zooracle,代碼行數:11,代碼來源:PhotoEditorPanel.java

示例10: readObject

/**
 * Provides serialization support.
 *
 * @param stream  the input stream.
 *
 * @throws IOException  if there is an I/O error.
 * @throws ClassNotFoundException  if there is a classpath problem.
 */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    this.borderStroke = SerialUtilities.readStroke(stream);
    this.borderPaint = SerialUtilities.readPaint(stream);
    this.backgroundPaint = SerialUtilities.readPaint(stream);
    this.progressListeners = new EventListenerList();
    this.changeListeners = new EventListenerList();
    this.renderingHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);

    // register as a listener with sub-components...
    if (this.title != null) {
        this.title.addChangeListener(this);
    }

    for (int i = 0; i < getSubtitleCount(); i++) {
        getSubtitle(i).addChangeListener(this);
    }

    if (this.legend != null) {
        this.legend.addChangeListener(this);
    }

    //if (this.plot != null) {
    // the plot can never be null.
    this.plot.addChangeListener(this);
    //}

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:37,代碼來源:JFreeChart.java

示例11: ExternalPaint

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);
        }
    }
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:27,代碼來源:Diagrama.java

示例12: ExternalPaintSelecao

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);
    }
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:29,代碼來源:Diagrama.java

示例13: getListCellRendererComponent

@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;
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:37,代碼來源:JListItemParaItemLegenda.java

示例14: paintComponent

@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);
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:24,代碼來源:QuadroDeEdicao.java

示例15: drawArrow

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);
        }
    }
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:39,代碼來源:Desenhador.java


注:本文中的java.awt.RenderingHints.KEY_ANTIALIASING屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。