Class GClip

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class GClip
    extends GraphicE
    This class wraps an Area in a GraphicE, in order to create a clipping area from GFillableE.
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      GClip()
      Basic GClip constructor
      GClip​(GClip e)
      Copy constructor
      GClip​(java.awt.geom.Area area)
      Constructs a GClip from a given area.
    • Constructor Detail

      • GClip

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

        public GClip()
        Basic GClip constructor
      • GClip

        public GClip​(java.awt.geom.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:
        java.lang.IllegalArgumentException - if area is null
    • Method Detail

      • 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 the clipping area
        Parameters:
        e - element to add
      • subtract

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

        public void draw​(java.awt.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