Examples of TexturePaint


Examples of java.awt.TexturePaint

      this.wallsPatternImageCache = SwingTools.getPatternImage(this.preferences.getWallPattern(),
          backgroundColor, foregroundColor);
      this.wallsPatternBackgroundCache = backgroundColor;
      this.wallsPatternForegroundCache = foregroundColor;
    }
    return new TexturePaint(this.wallsPatternImageCache,
        new Rectangle2D.Float(0, 0, 10 / planScale, 10 / planScale));
  }
View Full Code Here

Examples of java.awt.TexturePaint

      // Paint plan icon in an image
      BufferedImage image = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB);
      final Graphics2D imageGraphics = (Graphics2D)image.getGraphics();
      PieceOfFurniturePlanIcon.super.paintIcon(c, imageGraphics, 0, 0);                 
      // Fill the pixels of plan icon with texture image
      imageGraphics.setPaint(new TexturePaint(textureImage,
          new Rectangle2D.Float(0, 0, -getIconWidth() / pieceWidth * pieceTexture.getWidth(),
              -getIconHeight() / pieceDepth * pieceTexture.getHeight())));
      imageGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_IN));
      imageGraphics.fillRect(0, 0, getIconWidth(), getIconHeight());                 
      imageGraphics.dispose();
View Full Code Here

Examples of java.awt.TexturePaint

        g.setColor(Color.white);
        g.fillRect(0, 0, 2 * k, 2 * k);
        g.setColor(Color.lightGray);
        g.fillRect(0, 0, k, k);
        g.fillRect(k, k, k, k);
        checkerPaint = new TexturePaint(bi, new Rectangle(0, 0, bi.getWidth(), bi.getHeight()));
    }
View Full Code Here

Examples of java.awt.TexturePaint

            }
            g.setPaint(checkerPaint);
            g.fill(frame);
        }

        TexturePaint tp = new TexturePaint(img, new Rectangle(trackRect.x, 0, img.getWidth(), 1));
        g.setPaint(tp);
        AffineTransform oldTransform = null;

        oldTransform = g.getTransform();
        AffineTransform transform = new AffineTransform();
View Full Code Here

Examples of java.awt.TexturePaint

    Graphics2D gg = (Graphics2D)g;
    gg.setColor(Color.LIGHT_GRAY);
    gg.fillRect(0, 0, getWidth(), getHeight());

    if (background != null) {
      TexturePaint paint = new TexturePaint(background, new Rectangle(0, 0, background.getWidth(), background.getHeight()));
      gg.setPaint(paint);
      gg.fillRect(0, 0, getWidth(), getHeight());
      gg.setPaint(null);
    }
View Full Code Here

Examples of java.awt.TexturePaint

      vialSprite = new Sprite("vial.png");
      vialSprite.setPosition(100, 100);

      try {
        BufferedImage bgImage = ImageIO.read(TweenApplet.class.getResource("/aurelienribon/tweenengine/applets/gfx/transparent-dark.png"));
        bgPaint = new TexturePaint(bgImage, new Rectangle(0, 0, bgImage.getWidth(), bgImage.getHeight()));
      } catch (IOException ex) {
      }
    }
View Full Code Here

Examples of java.awt.TexturePaint

      imgLogoSprite = new Sprite("img-logo.png");
      blankStripSprite = new Sprite("blankStrip.png");

      try {
        BufferedImage bgImage = ImageIO.read(TimelineApplet.class.getResource("/aurelienribon/tweenengine/applets/gfx/transparent-dark.png"));
        bgPaint = new TexturePaint(bgImage, new Rectangle(0, 0, bgImage.getWidth(), bgImage.getHeight()));
      } catch (IOException ex) {
      }
    }
View Full Code Here

Examples of java.awt.TexturePaint

     * 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;

        try {
View Full Code Here

Examples of java.awt.TexturePaint

        PSTilingPattern patternObj = (PSTilingPattern) pattern;
        if (this.patternType != patternObj.patternType) {
            return false;
        }

        TexturePaint patternTexture = patternObj.getTexturePaint();

        if ( ((patternTexture == null) && (texture != null))
             || ((patternTexture != null) && (texture == null))) {
            return false;
        }

        if ((patternTexture != null) && (texture != null)) {
            // compare textures data
            int width = texture.getImage().getWidth();
            int height = texture.getImage().getHeight();

            int widthPattern = patternTexture.getImage().getWidth();
            int heightPattern = patternTexture.getImage().getHeight();

            if (width != widthPattern) {
                return false;
            }
            if (height != heightPattern) {
                return false;
            }
            int [] rgbData = new int[width * height];
            int [] rgbDataPattern = new int[widthPattern * heightPattern];

            texture.getImage().getRGB(0, 0, width, height, rgbData, 0, width);
            patternTexture.getImage().getRGB(0, 0, widthPattern, heightPattern,
                    rgbDataPattern, 0, widthPattern);

            for (int i = 0; i < rgbData.length; i++) {
                if (rgbData[i] != rgbDataPattern[i]) {
                    return false;
View Full Code Here

Examples of java.awt.TexturePaint

    }
    else if (paint instanceof TexturePaint)
    {
      try
      {
        final TexturePaint tp = (TexturePaint)paint;
        final BufferedImage img = tp.getImage();
        final Rectangle2D rect = tp.getAnchorRect();
        final com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(img, null);
        final PdfPatternPainter pattern = cb.createPattern(image.getWidth(), image.getHeight());
        final AffineTransform inverse = this.normalizeMatrix();
        inverse.translate(rect.getX(), rect.getY());
        inverse.scale(rect.getWidth() / image.getWidth(), -rect.getHeight() / image.getHeight());
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.