当前位置: 首页>>代码示例>>Java>>正文


Java RenderingHints类代码示例

本文整理汇总了Java中java.awt.RenderingHints的典型用法代码示例。如果您正苦于以下问题:Java RenderingHints类的具体用法?Java RenderingHints怎么用?Java RenderingHints使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RenderingHints类属于java.awt包,在下文中一共展示了RenderingHints类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paintBackground

import java.awt.RenderingHints; //导入依赖的package包/类
@Override
protected void paintBackground(Graphics g) {
	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	g2.setColor(getComponent().getBackground());
	g2.fillRoundRect(0, 0, getComponent().getWidth(), getComponent().getHeight(),
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS, RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:10,代码来源:TextAreaUI.java

示例2: paint

import java.awt.RenderingHints; //导入依赖的package包/类
public void paint(Graphics g) {
	if (antiAlias) {
		Graphics2D g2 = (Graphics2D) g;
		g2.setRenderingHint(RenderingHints.KEY_RENDERING,
				RenderingHints.VALUE_RENDER_QUALITY);
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
				RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
		/*g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
				RenderingHints.VALUE_FRACTIONALMETRICS_ON);*/
		super.paint(g2);
	} else {
		super.paint(g);
	}
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:17,代码来源:HTMLEditorPane.java

示例3: createColoredRectangleIcon

import java.awt.RenderingHints; //导入依赖的package包/类
protected Icon createColoredRectangleIcon(Color color) {
	// create buffered image for colored icon
	BufferedImage bufferedImage = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
	Graphics2D g2 = bufferedImage.createGraphics();
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias!
			RenderingHints.VALUE_ANTIALIAS_ON);

	if (color != null) {
		// fill image with item color
		Color newColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
		g2.setColor(newColor);
	} else {
		g2.setColor(Color.gray);
	}
	g2.fillRect(0, 0, 10, 10);

	return new ImageIcon(bufferedImage);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:19,代码来源:ColorRGBComboBoxCellRenderer.java

示例4: wrapMacFancy

import java.awt.RenderingHints; //导入依赖的package包/类
public static JPanel wrapMacFancy(JPanel content) {
	JPanel panel = new JPanel(new BorderLayout()) {

		private static final long serialVersionUID = 941275105778632480L;

		@Override
		public void paintComponent(Graphics g) {
			Color border = new Color(64, 64, 64, 64);
			Color bg = new Color(128, 128, 128, 64);

			Graphics2D g2 = (Graphics2D) g;
			g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
			g2.setColor(bg);
			g2.fillRoundRect(1, 1, this.getWidth()-2, this.getHeight()-2, 10, 10);
			g2.setColor(border);
			g2.drawRoundRect(0, 0, this.getWidth()-1, this.getHeight()-1, 10, 10);
		}
	};
	
	panel.setOpaque(false);
	content.setOpaque(false);
	panel.add(content, BorderLayout.CENTER);
	
	return panel;
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:26,代码来源:ViewUtils.java

示例5: pane

import java.awt.RenderingHints; //导入依赖的package包/类
/** Constructs an antialias-capable JTextPane with a DefaultHighlighter associated with it.
 * @param attributes - see {@link edu.mit.csail.sdg.alloy4.OurUtil#make OurUtil.make(component, attributes...)}
 */
public static JTextPane pane(Object... attributes) {
   JTextPane ans = new JTextPane() {
      static final long serialVersionUID = 0;
      @Override public void paint(Graphics gr) {
         if (antiAlias && gr instanceof Graphics2D) {
            ((Graphics2D)gr).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         }
         super.paint(gr);
      }
   };
   OurUtil.make(ans, attributes);
   ans.setHighlighter(new DefaultHighlighter());
   map.put(ans, Boolean.TRUE);
   return ans;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:19,代码来源:OurAntiAlias.java

示例6: 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);
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:28,代码来源:Editor.java

示例7: Blit

import java.awt.RenderingHints; //导入依赖的package包/类
public void Blit(SurfaceData srcData,
                 SurfaceData dstData,
                 Composite comp,
                 Region clip,
                 int srcx, int srcy,
                 int dstx, int dsty,
                 int width, int height)
{
    ColorModel srcCM = srcData.getColorModel();
    ColorModel dstCM = dstData.getColorModel();
    // REMIND: Should get RenderingHints from sg2d
    CompositeContext ctx = comp.createContext(srcCM, dstCM,
                                              new RenderingHints(null));
    Raster srcRas = srcData.getRaster(srcx, srcy, width, height);
    WritableRaster dstRas =
        (WritableRaster) dstData.getRaster(dstx, dsty, width, height);

    if (clip == null) {
        clip = Region.getInstanceXYWH(dstx, dsty, width, height);
    }
    int span[] = {dstx, dsty, dstx+width, dsty+height};
    SpanIterator si = clip.getSpanIterator(span);
    srcx -= dstx;
    srcy -= dsty;
    while (si.nextSpan(span)) {
        int w = span[2] - span[0];
        int h = span[3] - span[1];
        Raster tmpSrcRas = srcRas.createChild(srcx + span[0], srcy + span[1],
                                              w, h, 0, 0, null);
        WritableRaster tmpDstRas = dstRas.createWritableChild(span[0], span[1],
                                                              w, h, 0, 0, null);
        ctx.compose(tmpSrcRas, tmpDstRas, tmpDstRas);
    }
    ctx.dispose();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:Blit.java

示例8: AffineTransformOp

import java.awt.RenderingHints; //导入依赖的package包/类
/**
 * Construct AffineTransformOp with the given xform and rendering hints.
 * 
 * @param xform AffineTransform that will applied to the source image
 * @param hints rendering hints that will be used during transformation
 * @throws ImagingOpException if the transform matrix is noninvertible
 */
public AffineTransformOp (AffineTransform xform, RenderingHints hints)
{
  this.transform = xform;
  this.hints = hints;
  if (xform.getDeterminant() == 0)
    throw new ImagingOpException(null);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AffineTransformOp.java

示例9: paintBorder

import java.awt.RenderingHints; //导入依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setColor(new Color(0x666666));
    g2d.fillRect(x + 5, y + 5, width - 11, height - 11);
    paintHeader(g2d, x, y, width, height);
    if (node.getParentNodeContainer().getSelection().contains(node)) {
        g2d.setColor(UIHelper.getColor("Node.border:selected"));
    } else {
        g2d.setColor(UIHelper.getColor("Node.border"));
    }
    g2d.drawRect(x + 5, y + 5, width - 11, height - 11);
    g2d.setColor(UIHelper.getColor("Node.Header.title"));
    g2d.drawString(title, 19, 22);
    g2d.dispose();
}
 
开发者ID:VISNode,项目名称:VISNode,代码行数:18,代码来源:JNodeBorder.java

示例10: getScaledImage

import java.awt.RenderingHints; //导入依赖的package包/类
private BufferedImage getScaledImage() {
    BufferedImage image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = image.createGraphics();
    g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
    g2d.drawImage(this.image.getImage(), 0, 0, getWidth(), getHeight(), null);
    return image;
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:8,代码来源:RNNfilter.java

示例11: paintComponent

import java.awt.RenderingHints; //导入依赖的package包/类
@Override
protected void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D)g;
    
    g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
    
    Composite oldC = g2d.getComposite();
    Shape s = getMask( getWidth(), getHeight() );

    g2d.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, 0.25f*currentAlpha ) );
    g2d.setColor( Color.black );
    g2d.fill( getShadowMask(s) );
    
    g2d.setColor( UIManager.getColor( "ToolTip.background" ) ); //NOI18N
    g2d.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, currentAlpha ) );
    Point2D p1 = s.getBounds().getLocation();
    Point2D p2 = new Point2D.Double(p1.getX(), p1.getY()+s.getBounds().getHeight());
    if( isMouseOverEffect )
        g2d.setPaint( new GradientPaint( p2, getMouseOverGradientStartColor(), p1, getMouseOverGradientFinishColor() ) );
    else
        g2d.setPaint( new GradientPaint( p2, getDefaultGradientStartColor(), p1, getDefaultGradientFinishColor() ) );
    g2d.fill(s);
    g2d.setColor( Color.black );
    g2d.draw(s);
    g2d.setComposite( oldC );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:BalloonManager.java

示例12: paintIcon

import java.awt.RenderingHints; //导入依赖的package包/类
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
    if( g instanceof Graphics2D ) {
        Graphics2D g2d = (Graphics2D) g;
        //turn on high quality bitmap rendering
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
        g2d.translate(x, y);
        g2d.drawImage(img, at, null);
        g2d.translate(-x, -y);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ProgressLabel.java

示例13: render

import java.awt.RenderingHints; //导入依赖的package包/类
private void render(Image im, int type, String s) {
    Graphics2D g2d = (Graphics2D) im.getGraphics();
    clear(g2d, type, im.getWidth(null), im.getHeight(null));
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
    Font f = new Font("Dialog", Font.BOLD, 40);// g2d.getFont().deriveFont(32.0f);
    g2d.setColor(Color.white);
    g2d.setFont(g2d.getFont().deriveFont(36.0f));
    g2d.drawString(s, 10, im.getHeight(null) / 2);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:NonOpaqueDestLCDAATest.java

示例14: ChoiceV2Renderer

import java.awt.RenderingHints; //导入依赖的package包/类
public ChoiceV2Renderer(ChoiceV2 choice) {
    BufferedImage yes =
        new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g = yes.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                       RenderingHints.VALUE_ANTIALIAS_ON);
    g.setColor(Color.BLUE);
    g.drawLine(0, 5, 3, 10);
    g.drawLine(1, 5, 4, 10);
    g.drawLine(3, 10, 10, 0);
    g.drawLine(4, 9, 9, 0);
    g.dispose();
    BufferedImage blank =
        new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
    yesImage = new ImageIcon(yes);
    blankImage = new ImageIcon(blank);
    this.choice = choice;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:Font2DTest.java

示例15: getGUISnapshots

import java.awt.RenderingHints; //导入依赖的package包/类
static Snapshot[] getGUISnapshots() {
    List snapshots = new ArrayList();   //System.err.println("gGUI: thread = "+Thread.currentThread());
    Window[] windows = Window.getWindows(); //System.err.println("gGUI: windows = "+windows.length);
    for (int wi = 0; wi < windows.length; wi++) {
        Window w = windows[wi]; //System.err.println("gGUI: w["+wi+"] = "+w+", is visible = "+w.isVisible());
        if (!w.isVisible()) {
            continue;
        }
        Dimension d = w.getSize();  //System.err.println("gGUI:  size = "+d);
        if (d.width == 0 || d.height == 0) {
            continue;
        }
        BufferedImage bi = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g = bi.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT);
        w.paint(g);
        Raster raster = bi.getData();
        Object data = raster.getDataElements(0, 0, d.width, d.height, null);
        int[] dataArr;  //System.err.println("gGUI: data = "+data);
        if (data instanceof int[]) {
            dataArr = (int[]) data;
        } else {
            continue;
        }
        String title = null;
        if (w instanceof Frame) {
            title = ((Frame) w).getTitle();
        } else if (w instanceof Dialog) {
            title = ((Dialog) w).getTitle();
        }   //System.err.println("gGUI: title = "+title);
        snapshots.add(new Snapshot(w, title, d.width, d.height, dataArr));
    }
    Snapshot[] snapshotArr = (Snapshot[]) snapshots.toArray(new Snapshot[] {});
    lastGUISnapshots = snapshotArr;
    return snapshotArr;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:RemoteAWTService.java


注:本文中的java.awt.RenderingHints类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。