Search Results

Search found 1 results on 1 pages for 'user2923880'.

Page 1/1 | 1 

  • Java 2D clip area to shape

    - by user2923880
    I'm quite new to graphics in java and I'm trying to create a shape that clips to the bottom of another shape. Here is an example of what I'm trying to achieve: Where the white line at the base of the shape is the sort of clipped within the round edges. The current way I am doing this is like so: g2.setColor(gray); Shape shape = getShape(); //round rectangle g2.fill(shape); Rectangle rect = new Rectangle(shape.getBounds().x, shape.getBounds().y, width, height - 3); Area area = new Area(shape); area.subtract(new Area(rect)); g2.setColor(white); g2.fill(area); I'm still experimenting with the clip methods but I can't seem to get it right. Is this current method ok (performance wise, since the component repaints quite often) or is there a more efficient way? Thanks in advance.

    Read the article

1