Package java.awt

Examples of java.awt.TexturePaint


    int[]      p;

    p  = mixPixels( pntBackPix, pntBackPixN, c );
    img = new BufferedImage( 1, 6, BufferedImage.TYPE_INT_ARGB );
    img.setRGB( 0, 0, 1, 6, p, 0, 1 );
    sv.pntSVBackBot[ NORMAL ] = new TexturePaint( img, new Rectangle( 0, 0, 1, 6 ));
    img = new BufferedImage( 1, 6, BufferedImage.TYPE_INT_ARGB );
    img.setRGB( 0, 0, 1, 6, createdArmedPixels( p ), 0, 1 );
    sv.pntSVBackBot[ ARMED ] = new TexturePaint( img, new Rectangle( 0, 0, 1, 6 ));
    img = new BufferedImage( 1, 6, BufferedImage.TYPE_INT_ARGB );
    img.setRGB( 0, 0, 1, 6, createdDisabledPixels( p ), 0, 1 );
    sv.pntSVBackBot[ DISABLED ] = new TexturePaint( img, new Rectangle( 0, 0, 1, 6 ));

    sv.pntBack    = c;
    sv.isGradient  = false;
  }
View Full Code Here


    setMinimumSize( new Dimension( getMinimumSize().width, barExtent ));
    setPreferredSize( new Dimension( getPreferredSize().width, barExtent ));

    img1    = new BufferedImage( 1, barExtent, BufferedImage.TYPE_INT_ARGB );
    img1.setRGB( 0, 0, 1, barExtent, pntBarGradientPixels, 0, 1 );
    pntBackground = new TexturePaint( img1, new Rectangle( 0, 0, 1, barExtent ));
    img2    = new BufferedImage( 1, markExtent, BufferedImage.TYPE_INT_ARGB );
    img2.setRGB( 0, 0, 1, markExtent, pntMarkGradientPixels, 0, 1 );
    pntMarkFlag  = new TexturePaint( img2, new Rectangle( 0, 0, 1, markExtent ));
    img3    = new BufferedImage( 1, markExtent, BufferedImage.TYPE_INT_ARGB );
    img3.setRGB( 0, 0, 1, markExtent, pntMarkDragPixels, 0, 1 );
    pntMarkFlagDrag = new TexturePaint( img3, new Rectangle( 0, 0, 1, markExtent ));

    setOpaque( true );
// not necessary; it also kills the VK_TAB response of DocumentFrame!
//    setFocusable( true );
View Full Code Here

         *   - the texture image can be (or is already) cached in an OpenGL
         *     texture object
         */
        @Override
        boolean isPaintValid(SunGraphics2D sg2d) {
            TexturePaint paint = (TexturePaint)sg2d.paint;
            OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
            BufferedImage bi = paint.getImage();

            // see if texture-non-pow2 extension is available
            if (!dstData.isTexNonPow2Available()) {
                int imgw = bi.getWidth();
                int imgh = bi.getHeight();
View Full Code Here

        g2d.fillRect(0, s2, s2, s2);
        g2d.setColor(colors[2]);
        g2d.fillRect(s2, s2, s2, s2);
        g2d.dispose();
        Rectangle2D bounds = new Rectangle2D.Float(0, 0, size, size);
        return new TexturePaint(img, bounds);
    }
View Full Code Here

      ig.fillRect(1,1, 2, 2);
      ig.dispose();
     
      // Create a texture paint from the buffered image
      Rectangle r = new Rectangle(0, 0, width, height);
      TexturePaint tp = null;
      if (tp == null){
        tp = new TexturePaint(image, r);
      }
     
      Paint old = g2.getPaint();
      g2.setPaint(tp);
      g2.fillRect(0,0, getWidth(), height);
View Full Code Here

        }

      }
      else if (paint instanceof TexturePaint)
      {
        TexturePaint tp = (TexturePaint)paint;
        Image image = tp.getImage();

              LosslessImage losslessImage = new LosslessImage(image);
              int imageWidth = losslessImage.getWidth();
              int imageHeight = losslessImage.getHeight();
              DefineBitsLossless tag = DefineBitsLosslessBuilder.build(losslessImage.getPixels(), imageWidth, imageHeight);
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.lowagie.text.Image image = com.lowagie.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

        Graphics2D g2 = bi.createGraphics();
        for (int i = 0; i < c.length; i++) {
            g2.setColor(c[i]);
            g2.fillRect(0, i*a, a, a);
        }
        return new TexturePaint(bi, new Rectangle(0, 0, a, a*(c.length+1)));
    }
View Full Code Here

        BufferedImage bi = new BufferedImage(a, a, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = bi.createGraphics();
        g2.setColor(c);
        g2.fill(new Polygon(new int[] {a/2, a, a}, new int[] {a, a/2, a}, 3));
        g2.fill(new Polygon(new int[] {0, a/2, a, 0}, new int[] {a/2, 0, 0, a}, 4));
        return new TexturePaint(bi, new Rectangle(0, 0, a, a));
    }
View Full Code Here

        BufferedImage bi = new BufferedImage(a, a, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = bi.createGraphics();
        g2.setColor(c);
        g2.fill(new Polygon(new int[] {0, 0, a/2}, new int[] {a, a/2, a}, 3));
        g2.fill(new Polygon(new int[] {0, a/2, a, a}, new int[] {0, 0, a/2, a}, 4));
        return new TexturePaint(bi, new Rectangle(0, 0, a, a));
    }
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.