Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public BufferedImage getImage(RenderingHints rh) {
- if (needReDraw) {
- image = new BufferedImage(size, size, BufferedImage.TYPE_4BYTE_ABGR);
- Graphics2D g = image.createGraphics();
- if(rh!=null)g.setRenderingHints(rh);
- g.rotate(angle);
- for (int i = 0; i < color.length; i++) {
- g.setColor(new Color(color[i][0], color[i][1], color[i][2]));
- g.fillPolygon(pointX[i], pointY[i], pointX[i].length);
- }
- needReDraw = false;
- }
- return image;
- }
- public void rotate(int angle){
- this.angle = Math.toRadians(angle);
- needReDraw = true;
- }
- @Override
- public void draw(Graphics2D g) {
- g.drawImage(getImage(g.getRenderingHints()), 0, 0, null);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement