Class GClip

All Implemented Interfaces:
Cloneable

public class GClip extends GraphicE
This class wraps an Area in a GraphicE, in order to create a clipping area from GFillableE.
Author:
Federico Vera <[email protected]>
  • Constructor Details

    • GClip

      public GClip(GClip e)
      Copy constructor
      Parameters:
      e - GClip to copy
      Throws:
      IllegalArgumentException - if e is null
    • GClip

      public GClip()
      Basic GClip constructor
    • GClip

      public GClip(Area area)
      Constructs a GClip from a given area. Please note that when this constructor is used, then traslate(int, int) won't work.
      If you really need to traslate a GClip, then you should previously add a GTransform to the graphic
      Parameters:
      area - Area object to be used as clip
      Throws:
      IllegalArgumentException - if area is null
  • Method Details

    • traslate

      public void traslate(int x, int y)
      Description copied from class: GraphicE
      Traslates this element on X and Y
      Specified by:
      traslate in class GraphicE
      Parameters:
      x - size in px of the horizontal translation
      y - size in px of the vertical translation
    • add

      public void add(GFillableE e)
      Adds the given element to the clipping area
      Parameters:
      e - element to add
    • subtract

      public void subtract(GFillableE e)
      Subtracts the given element from the clipping area
      Parameters:
      e - element to subtract
    • draw

      public void draw(Graphics2D g)
      Description copied from class: GraphicE
      Draws the component on the given graphics
      Specified by:
      draw in class GraphicE
      Parameters:
      g - where to draw
    • clone

      public GraphicE clone()
      Specified by:
      clone in class GraphicE