/** * Generates a polygon with an inside radius of 0. * @param sides number of sides * @param outsideRadius the outside radius * @param normalize normalize * @return the generated shape */ public static Shape generatePolygon(int sides, int outsideRadius, boolean normalize) { return generatePolygon(sides, outsideRadius, 0, normalize); }
/** * @param font the font * @param ch a single character * @return the shape */ public static Shape generateShapeFromText(Font font, char ch) { return generateShapeFromText(font, String.valueOf(ch)); }
/** * Sets the clip on a graphics object by merging a supplied clip with the existing one. The new * clip will be an intersection of the old clip and the supplied clip. The old clip shape will * be returned. This is useful for resetting the old clip after an operation is performed. * * @param g * the graphics object to update * @param clip * a new clipping region to add to the graphics clip. * @return the current clipping region of the supplied graphics object. This may return {@code * null} if the current clip is {@code null}. * @throws NullPointerException * if any parameter is {@code null} * @deprecated Use {@link ShapeUtils#mergeClip(Graphics,Shape)} instead */ @Deprecated public static Shape mergeClip(Graphics g, Shape clip) { return ShapeUtils.mergeClip(g, clip); }
public static Shape generatePolygon(int sides, int outsideRadius, boolean normalize) { return generatePolygon(sides, outsideRadius, 0, normalize); }
public static Shape generateShapeFromText(Font font, char ch) { return generateShapeFromText(font, String.valueOf(ch)); }
@Override protected void doPaint(Graphics2D g, Object component, int width, int height) { Shape shape = provideShape(g, component, width, height); switch (getStyle()) { case BOTH: drawBackground(g,shape,width,height); drawBorder(g,shape,width,height); break; case FILLED: drawBackground(g,shape,width,height); break; case OUTLINE: drawBorder(g,shape,width,height); break; } // background // border // leave the clip to support masking other painters ShapeUtils.mergeClip(g,shape); /* Area area = new Area(g.getClip()); area.intersect(new Area(shape));//new Rectangle(0,0,width,height))); g.setClip(area);*/ //g.setClip(shape); }
public static Shape generatePolygon(int sides, int outsideRadius, boolean normalize) { return generatePolygon(sides, outsideRadius, 0, normalize); }
public static Shape generateShapeFromText(Font font, char ch) { return generateShapeFromText(font, String.valueOf(ch)); }
@Override protected void doPaint(Graphics2D g, Object component, int width, int height) { Shape shape = provideShape(g, component, width, height); switch (getStyle()) { case BOTH: drawBackground(g,shape,width,height); drawBorder(g,shape,width,height); break; case FILLED: drawBackground(g,shape,width,height); break; case OUTLINE: drawBorder(g,shape,width,height); break; } // background // border // leave the clip to support masking other painters ShapeUtils.mergeClip(g,shape); /* Area area = new Area(g.getClip()); area.intersect(new Area(shape));//new Rectangle(0,0,width,height))); g.setClip(area);*/ //g.setClip(shape); }
public static Shape generatePolygon(int sides, int outsideRadius, boolean normalize) { return generatePolygon(sides, outsideRadius, 0, normalize); }
public static Shape generateShapeFromText(Font font, char ch) { return generateShapeFromText(font, String.valueOf(ch)); }
@Override protected void doPaint(Graphics2D g, Object component, int width, int height) { Shape shape = provideShape(g, component, width, height); switch (getStyle()) { case BOTH: drawBackground(g,shape,width,height); drawBorder(g,shape,width,height); break; case FILLED: drawBackground(g,shape,width,height); break; case OUTLINE: drawBorder(g,shape,width,height); break; } // background // border // leave the clip to support masking other painters ShapeUtils.mergeClip(g,shape); /* Area area = new Area(g.getClip()); area.intersect(new Area(shape));//new Rectangle(0,0,width,height))); g.setClip(area);*/ //g.setClip(shape); }
public static Shape generatePolygon(int sides, int outsideRadius, boolean normalize) { return generatePolygon(sides, outsideRadius, 0, normalize); }
public static Shape generateShapeFromText(Font font, char ch) { return generateShapeFromText(font, String.valueOf(ch)); }
public static Shape generatePolygon(int sides, int outsideRadius, int insideRadius, boolean normalize) { Shape shape = generatePolygon(sides, outsideRadius, insideRadius); if (normalize) { Rectangle2D bounds = shape.getBounds2D(); GeneralPath path = new GeneralPath(shape); shape = path.createTransformedShape(AffineTransform.getTranslateInstance( -bounds.getX(), -bounds.getY())); } return shape; }
public static Shape generatePolygon(int sides, int outsideRadius, int insideRadius, boolean normalize) { Shape shape = generatePolygon(sides, outsideRadius, insideRadius); if (normalize) { Rectangle2D bounds = shape.getBounds2D(); GeneralPath path = new GeneralPath(shape); shape = path.createTransformedShape(AffineTransform.getTranslateInstance( -bounds.getX(), -bounds.getY())); } return shape; }
public static Shape generatePolygon(int sides, int outsideRadius, int insideRadius, boolean normalize) { Shape shape = generatePolygon(sides, outsideRadius, insideRadius); if (normalize) { Rectangle2D bounds = shape.getBounds2D(); GeneralPath path = new GeneralPath(shape); shape = path.createTransformedShape(AffineTransform.getTranslateInstance( -bounds.getX(), -bounds.getY())); } return shape; }
public static Shape generatePolygon(int sides, int outsideRadius, int insideRadius, boolean normalize) { Shape shape = generatePolygon(sides,outsideRadius,insideRadius); if(normalize) { Rectangle2D bounds = shape.getBounds2D(); GeneralPath path = new GeneralPath(shape); shape = path.createTransformedShape( AffineTransform.getTranslateInstance(-bounds.getX(), -bounds.getY())); } return shape; }
/** * Generates a polygon * @param sides number of sides * @param outsideRadius the outside radius * @param insideRadius the inside radius * @param normalize normalize * @return the generated shape */ public static Shape generatePolygon(int sides, int outsideRadius, int insideRadius, boolean normalize) { Shape shape = generatePolygon(sides, outsideRadius, insideRadius); if (normalize) { Rectangle2D bounds = shape.getBounds2D(); GeneralPath path = new GeneralPath(shape); shape = path.createTransformedShape(AffineTransform.getTranslateInstance( -bounds.getX(), -bounds.getY())); } return shape; }