Class AcadColor


  • public class AcadColor
    extends Object
    This class allows to convert Autocad colors in Java colors
    Author:
    jmorell
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BYBLOCK
      When Autocad color is 0, then the color of the object is the color of the block where it is placed
      static int BYLAYER
      When Autocad color is 256, then the color of the object is the color of it layer
    • Constructor Summary

      Constructors 
      Constructor Description
      AcadColor​(int code, double r0, double g0, double b0, double r, double g, double b)
      This method is used to build the Autocad color table
    • Field Detail

      • BYLAYER

        public static final int BYLAYER
        When Autocad color is 256, then the color of the object is the color of it layer
        See Also:
        Constant Field Values
      • BYBLOCK

        public static final int BYBLOCK
        When Autocad color is 0, then the color of the object is the color of the block where it is placed
        See Also:
        Constant Field Values
    • Constructor Detail

      • AcadColor

        public AcadColor​(int code,
                         double r0,
                         double g0,
                         double b0,
                         double r,
                         double g,
                         double b)
        This method is used to build the Autocad color table
        Parameters:
        code - Code is the Autocad color number
        r0 - r0 is the red component (0-1)
        g0 - g0 is the green component (0-1)
        b0 - b0 is the blue component (0-1)
        r - r0 is the red component (0-255)
        g - g0 is the green component (0-255)
        b - b0 is the blue component (0-255)
    • Method Detail

      • getColor

        public static Color getColor​(int code)
        This method uses Autocad color table for convert a color in the Autocad color code in a java Color
        Parameters:
        code - This int is the Autocad color number
        Returns:
        Color Java Color corresponding to the Autocad color number argument
      • initTable

        public static AcadColor[] initTable()
        Initialize an Autocad color table
        Returns:
        AcadColor[] Object of this class that represents Acad color to Java color conversion