Examples of TexturePaint


Examples of java.awt.TexturePaint

        tG2.setBackground(GfrColor.WHITE_2);
        tG2.clearRect(0, 0, sw, sh);
        tG2.setColor(GfrColor.GRAY_8);
        tlt.draw(tG2, 0, tlt.getAscent());
        Rectangle r = new Rectangle(0, 0, sw, sh);
        return new TexturePaint(bi, r);
    }
View Full Code Here

Examples of java.awt.TexturePaint

            g.fillRect(size / 2, size / 2, size / 2, size / 2);
        } finally {
            g.dispose();
        }
       
        return new TexturePaint(img,new Rectangle(0,0,size,size));
    }
View Full Code Here

Examples of java.awt.TexturePaint

      previousZoom = zoomFactor;
    }

    // Create a texture paint from the buffered image
    Rectangle r = new Rectangle(0, 0, img.getWidth(), img.getHeight());
    TexturePaint tp = new TexturePaint(img, r);

    // Add the texture paint to the graphics context.
    g2.setPaint(tp);

    // Create and render a rectangle filled with the texture.
View Full Code Here

Examples of java.awt.TexturePaint

    }
  }

  public void loadImage(String imageFile) throws IOException {
    BufferedImage wpImage = ImageIO.read(new File(imageFile));
    TexturePaint paint = new TexturePaint(wpImage, new Rectangle(0, 0, wpImage.getWidth(), wpImage.getHeight()));
    gd.setPaint(paint);
    gd.fillRect(0, 0, wpImage.getWidth(), wpImage.getHeight());
  }
View Full Code Here

Examples of java.awt.TexturePaint

            else
                cb.setShadingStroke(pat);
        }
        else if (paint instanceof TexturePaint) {
            try {
                TexturePaint tp = (TexturePaint)paint;
                BufferedImage img = tp.getImage();
                Rectangle2D rect = tp.getAnchorRect();
                com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(img, null);
                PdfPatternPainter pattern = cb.createPattern(image.getWidth(), image.getHeight());
                AffineTransform inverse = this.normalizeMatrix();
                inverse.translate(rect.getX(), rect.getY());
                inverse.scale(rect.getWidth() / image.getWidth(), -rect.getHeight() / image.getHeight());
View Full Code Here

Examples of java.awt.TexturePaint

    private void createPaint() {
    try {
      BufferedImage bim = ImageIO.read(new File(image));
      Rectangle rect = new Rectangle(width, height);
      paint = new TexturePaint(bim, rect);
    } catch (IOException ioex) {
      log.error("SerializableTexturePaint.createPaint: "+ioex.getMessage());
    }
    }
View Full Code Here

Examples of java.awt.TexturePaint

        bg.setPaint(Color.red);
        bg.fillRect(0, 0, 10, 10);
        bg.setPaint(Color.yellow);
        bg.fillRect(10, 10, 10, 10);
        bg.dispose();
        TexturePaint fillTexture = new TexturePaint(buf, new Rectangle(10, 20, 20, 20));
        g.setPaint(defaultPaint);
        g.drawString("Texture Paint", 10, 10);
        g.setPaint(fillTexture);
        g.fill(rect);
    }
View Full Code Here

Examples of java.awt.TexturePaint

            else
                cb.setShadingStroke(pat);
        }
        else if (paint instanceof TexturePaint) {
            try {
                TexturePaint tp = (TexturePaint)paint;
                BufferedImage img = tp.getImage();
                Rectangle2D rect = tp.getAnchorRect();
                com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(img, null);
                PdfPatternPainter pattern = cb.createPattern(image.getWidth(), image.getHeight());
                AffineTransform inverse = this.normalizeMatrix();
                inverse.translate(rect.getX(), rect.getY());
                inverse.scale(rect.getWidth() / image.getWidth(), -rect.getHeight() / image.getHeight());
View Full Code Here

Examples of java.awt.TexturePaint

            else
                cb.setShadingStroke(pat);
        }
        else if (paint instanceof TexturePaint) {
            try {
                TexturePaint tp = (TexturePaint)paint;
                BufferedImage img = tp.getImage();
                Rectangle2D rect = tp.getAnchorRect();
                com.itextpdf.text.Image image = com.itextpdf.text.Image.getInstance(img, null);
                PdfPatternPainter pattern = cb.createPattern(image.getWidth(), image.getHeight());
                AffineTransform inverse = this.normalizeMatrix();
                inverse.translate(rect.getX(), rect.getY());
                inverse.scale(rect.getWidth() / image.getWidth(), -rect.getHeight() / image.getHeight());
View Full Code Here

Examples of java.awt.TexturePaint

      g.setColor(Color.white);
      g.fillRect(0,0,2*t,2*t);
      g.setColor(Color.lightGray);
      g.fillRect(0,0,t,t);
      g.fillRect(t,t,t,t);
      checkerPaint = new TexturePaint(bi,new Rectangle(0,0,bi.getWidth(),bi.getHeight()));
    }
    return checkerPaint;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.