Package java.awt

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


    }
  }

  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

            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

    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

        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

            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

            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

      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

    int w2 = Math.min(getWidth(), w);
    int h2 = Math.min(getHeight(), w);
    Rectangle r = new Rectangle(getWidth()/2-w2/2,getHeight()/2-h2/2, w2, h2);
   
    if(c.getAlpha()<255) {
      TexturePaint checkers = getCheckerPaint();
      g.setPaint(checkers);
      g.fillRect(r.x, r.y, r.width, r.height);
    }
    g.setColor(c);
    g.fillRect(r.x, r.y, r.width, r.height);
View Full Code Here

    if(slider.hasFocus()) {
      PlafPaintUtils.paintFocus(g2,r,3);
    }
   
    bi.getRaster().setDataElements(0,0,1,trackRect.height,intArray);
    TexturePaint p = new TexturePaint(bi,new Rectangle(0,trackRect.y,1,bi.getHeight()));
    g2.setPaint(p);
    g2.fillRect(r.x,r.y,r.width,r.height);
   
    PlafPaintUtils.drawBevel(g2, r);
  }
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.