Class GFXAttr

  • Direct Known Subclasses:
    GFXFillAttr, GFXLineAttr, GFXTextAttr

    public class GFXAttr
    extends Object
    The graphic attribute object is a base class for different display attributes and holds information about common attibute values such as background and foreground colour, shading, style etc.
    • Constructor Detail

      • GFXAttr

        public GFXAttr()
        Default constructor.

        Populates the graphic attribute with the following settings:

                 Style                     = solid
                 Shading scale     = full shading
                 Shade                     = solid
                 Foreground colour = black
                 Background colour = white
         
      • GFXAttr

        public GFXAttr​(GFXAttr oSource)
        Copy consturctor.

        Copies all attribute values.

        Parameters:
        oSource - Source attribute object to copy
      • GFXAttr

        public GFXAttr​(int nNewStyle,
                       int lNewShade,
                       GFXColour oNewColour,
                       GFXColour oNewColourBg)
        Constructor.

        Creates an Attribute object with the settings as specified by the input values.

        Parameters:
        nNewStyle - Specifies the style of the attribute
        lNewShade - Specifies the shade of the attribute
        oNewColour - Specifies the foreground colour
        oNewColourBg - Specifies the background colour
    • Method Detail

      • colour

        public GFXColour colour()
        Get the foreground colour for this attribute.
        Returns:
        The foreground colour as a jfGfxColour object
      • colour

        public void colour​(GFXColour oNewColour)
        Set the foreground colour for this attribute.
        Parameters:
        oNewColour - The new foreground colour as a jfGfxColour object
      • colourBg

        public GFXColour colourBg()
        Get the background colour for this attribute.
        Returns:
        The background colour as a jfGfxColour object
      • colourBg

        public void colourBg​(GFXColour oNewColourBg)
        Set the background colour for this attribute.
        Parameters:
        oNewColourBg - The new background colour as a jfGfxColour object
      • shade

        public int shade()
        Get the shading value for this attribute. This is a value between 0 (invisible) to the value of ShadeScale (solid).
        Returns:
        The shading value
      • shade

        public void shade​(int lNewShade)
        Set the shading value for this attribute. This is a value between 0 (invisible) to the value of ShadeScale (solid).
        Parameters:
        lNewShade - The new shading value
      • shadeScale

        public int shadeScale()
        Get the upper bound for shading.
        Returns:
        The upper bound for shading.
      • shadeScale

        public void shadeScale​(int lNewScale)
        Set the upper bound for shading.
        Parameters:
        lNewScale - The new upper bound for shading.
      • shadeColour

        public GFXColour shadeColour()
        Get the shading colour.
        Returns:
        The shading colour as a jfGfxColour object
      • defaultShadeScale

        public static int defaultShadeScale()
        Get the default upper bound for shading
        Returns:
        The default upper bound for shading.
      • style

        public int style()
        Get the style for this attribute
        Returns:
        The style as a StyleCode enumeration
      • style

        public void style​(int nNewStyle)
        Set the style for this attribute
        Parameters:
        nNewStyle - The new style as a StyleCode enumeration
      • graphicContext

        public GFXGraphicContext graphicContext()
        Return the graphic context associated with this graphic attribute object.
        Returns:
        Pointer to the graphic context. A null pointer is returned if the context has never been set.
      • graphicContext

        public void graphicContext​(GFXGraphicContext poGraphicContext)
        Set a new graphic context for this attribute object.
        Parameters:
        poGraphicContext - - New graphic context to associate with this graphic attribute object.
      • equivalent

        public boolean equivalent​(GFXAttr oCompare)
        Equality comparison.

        Compares on an attribute value basis. Two attributes are considered equal if their values compare for equality.

        Parameters:
        oCompare - Attribute object to compare against.
        Returns:
        TRUE if all members are equal, FALSE otherwise.
      • equals

        public boolean equals​(Object object)
        Equality comparison operator.

        Compares on an attribute value basis. Two attributes are considered equal if their values compare for equality.

        Overrides:
        equals in class Object
        Parameters:
        object - Attribute object to compare against.
        Returns:
        TRUE if the attribute objects are considered equal; FALSE otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • copyFrom

        public void copyFrom​(GFXAttr oSource)
        Replace all attributes with those from the source object.

        The standard assignment copies everything, including enabled and disabled status. Graphic source information is also copied.

        Parameters:
        oSource - Source attribute object to copy.