Package java.awt

Examples of java.awt.TexturePaint


      throw new RuntimeException(ex);
    }

    if (params.size() == 1) {
      Rectangle2D rect = new Rectangle2D.Double(0, 0, img.getWidth(), img.getHeight());
      return new TexturePaint(img, rect);
    }

    if (params.size() == 3) {
      float w = ((Number) params.get(1)).floatValue();
      float h = ((Number) params.get(2)).floatValue();
      Rectangle2D rect = new Rectangle2D.Double(0, 0, w, h);
      return new TexturePaint(img, rect);
    }

    assert false;
    return null;
  }
View Full Code Here


    @Override
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        Graphics2D g2d = (Graphics2D) g.create();

        BufferedImage buf = MyBorderFactory.imageToBufferedImage(image);
        TexturePaint paint = new TexturePaint(buf, new Rectangle2D.Double(0, 0, buf.getWidth(), buf.getHeight()));
        g2d.setPaint(paint);
        g2d.fillRoundRect(x, y, width-1, height-1, 10, 10);
       
        g2d.setColor(Color.LIGHT_GRAY);
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
View Full Code Here

    @Override
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        Graphics2D g2d = (Graphics2D) g.create();

        BufferedImage buf = MyBorderFactory.imageToBufferedImage(image);
        TexturePaint paint = new TexturePaint(buf, new Rectangle2D.Double(0, 0, buf.getWidth(), buf.getHeight()));
        g2d.setPaint(paint);
        g2d.fillRect(x, y, width, height);
    }
View Full Code Here

        d = dist.getLowerLeftCorner();
        g2d.drawImage(buf.getSubimage(s.x, s.y, s.width, s.height), null, d.x, d.y);

        s = src.getLeft();
        d = dist.getLeft();
        TexturePaint t = new TexturePaint(buf.getSubimage(s.x, s.y, s.width, s.height), s);
        g2d.setPaint(t);   fillRect(g2d, d);

        s = src.getRight();
        d = dist.getRight();
        t = new TexturePaint(buf.getSubimage(s.x, s.y, s.width, s.height), s);
        g2d.setPaint(t);   fillRect(g2d, d);

        s = src.getTop();
        d = dist.getTop();
        t = new TexturePaint(buf.getSubimage(s.x, s.y, s.width, s.height), s);
        g2d.setPaint(t);   fillRect(g2d, d);

        s = src.getBottom();
        d = dist.getBottom();
        t = new TexturePaint(buf.getSubimage(s.x, s.y, s.width, s.height), s);
        g2d.setPaint(t);   fillRect(g2d, d);

        s = src.getCenter();
        d = dist.getCenter();
        t = new TexturePaint(buf.getSubimage(s.x, s.y, s.width, s.height), s);
        g2d.setPaint(t);   fillRect(g2d, d);
    }
View Full Code Here

        Graphics2D g2d = (Graphics2D) g.create();

        // ImageIcon って便利
        ImageIcon icon = new ImageIcon(SchemaEditorImpl.class.getResource(ICON16));
        BufferedImage buf = SchemaUtils.imageToBufferedImage(icon);
        TexturePaint paint = new TexturePaint(buf, new Rectangle2D.Double(0, 0, buf.getWidth(), buf.getHeight()));
        g2d.setPaint(paint);
        g2d.fillRect(x, y, width, height);
    }
View Full Code Here

     * equality.  Since this class is not serializable, we expect null as the
     * result.
     */
    public void testTexturePaintSerialization() {

        final Paint p1 = new TexturePaint(
            new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB),
            new Rectangle2D.Double(0, 0, 5, 5)
        );
        Paint p2 = null;

View Full Code Here

    big.fillRect(0, 0, 15, 15);
    big.setColor(Main.pref.getColor(marktr("outside downloaded area"),
        Color.YELLOW));
    big.drawLine(0, 15, 15, 0);
    Rectangle r = new Rectangle(0, 0, 15, 15);
    hatched = new TexturePaint(bi, r);
  }
View Full Code Here

     * equality.  Since this class is not serializable, we expect null as the
     * result.
     */
    public void testTexturePaintSerialization() {

        final Paint p1 = new TexturePaint(
            new BufferedImage(5, 5, BufferedImage.TYPE_INT_RGB),
            new Rectangle2D.Double(0, 0, 5, 5)
        );
        Paint p2 = null;

View Full Code Here

    /**
     * Check that the equals() method distinguishes all fields.
     */
    public void testTexturePaintEquals() {
        final Paint p1 = new TexturePaint(
            new BufferedImage(100, 200, BufferedImage.TYPE_INT_RGB), new Rectangle2D.Double()
        );
        final Paint p2 = new TexturePaint(
            new BufferedImage(100, 200, BufferedImage.TYPE_INT_RGB), new Rectangle2D.Double()
        );
        assertEquals(p1, p2);
    }
View Full Code Here

                            AlphaComposite.SRC_OVER, alpha);
                    if (graphics != null) graphics.setComposite(ac);
                }

                if(img != null) {
                    paint = new TexturePaint(
                            img, new Rectangle2D.Double(0, 0, img.getWidth(), img.getHeight()));
                }
            }
            catch (Exception e) {
                e.printStackTrace();
View Full Code Here

TOP

Related Classes of java.awt.TexturePaint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.