Examples of TexturePaint


Examples of java.awt.TexturePaint

        }
        if(!hit)
          array[a] = colors[colors.length-1].getRGB();
      }
      bi.getRaster().setDataElements(0, 0, 1, height, array);
      paint = new TexturePaint( bi, new Rectangle(0,y,1,height) );
      verticalGradients.put(key,paint);
    }
    return paint;
  }
View Full Code Here

Examples of java.awt.TexturePaint

  private static Hashtable checkers;
  public static TexturePaint getCheckerBoard(int checkerSize) {
    if(checkers==null)
      checkers = new Hashtable();
    Integer key = new Integer(checkerSize);
    TexturePaint paint = (TexturePaint)checkers.get(key);
    if(paint==null) {
      BufferedImage bi = new BufferedImage(2*checkerSize, 2*checkerSize, BufferedImage.TYPE_INT_RGB);
      Graphics2D g = bi.createGraphics();
      g.setColor(Color.white);
      g.fillRect(0,0,2*checkerSize,2*checkerSize);
      g.setColor(Color.lightGray);
      g.fillRect(0,0,checkerSize,checkerSize);
      g.fillRect(checkerSize,checkerSize,checkerSize,checkerSize);
      g.dispose();
      paint = new TexturePaint(bi,new Rectangle(0,0,bi.getWidth(),bi.getHeight()));
      checkers.put(key, paint);
    }
    return paint;
  }
View Full Code Here

Examples of java.awt.TexturePaint

        tileg2d.fillOval(2, 2, tile.getWidth() - 2, tile.getHeight() - 2);
        tileg2d.dispose();
        Rectangle2D rect = new Rectangle2D.Double(
                2, 2,
                tile.getWidth() / 2.0, tile.getHeight() / 2.0);
        this.paint = new TexturePaint(tile, rect);
    }
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.