Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
hdi::core::ArtColor Class Reference

Describes the color of art on the artboard. More...

#include <hdicoreArtColor.h>

Classes

class  Channels
 Stores all the possible representations of a color-based ArtColor in all supported color models; the original model is indicated by the master member. More...
 
class  GradientStyle
 Describes a gradient that has been applied to some art. More...
 
class  PatternStyle
 Describes a pattern that has been applied to some art. More...
 

Public Types

enum  Type {
  TypeUnknown = 0, TypeNone = 1 << 0, TypeGray = 1 << 1, TypeRGB = 1 << 2,
  TypeCMYK = 1 << 3, TypeLab = 1 << 4, TypeHSB = 1 << 5, TypeNamedRGB = 1 << 10,
  TypeNamedCMYK = 1 << 11, TypeNamedLab = 1 << 12, TypePattern = 1 << 20, TypeGradient = 1 << 21,
  AnonymousTypes = (TypeGray | TypeRGB | TypeCMYK | TypeLab | TypeHSB), NamedTypes = (TypeNamedRGB | TypeNamedCMYK | TypeNamedLab)
}
 Describes the format/type of an ArtColor object.
 
enum  NamedFlags { SpotColor = 1 << 0, RegistrationColor = 1 << 1 }
 Option flags for use when creating a named color.
 
typedef std::auto_ptr< ChannelsChannelsAP
 
typedef std::auto_ptr< GradientStyleGradientStyleAP
 
typedef std::auto_ptr< PatternStylePatternStyleAP
 

Public Member Functions

 ArtColor (const ArtColor &c_)
 Constructs an ArtColor object from an existing ArtColor object (copy constructor) More...
 
 ArtColor (const double grayVal_)
 Constructs a grayscale ArtColor object from a single color component in the range [0.0,1.0]. More...
 
 ArtColor (const double rVal_, const double gVal_, const double bVal_)
 Constructs an RGB ArtColor object from three color components in the range [0.0,1.0]. More...
 
 ArtColor (const double cVal_, const double mVal_, const double yVal_, const double kVal_)
 Constructs a CMYK ArtColor object from four color components in the range [0.0,1.0]. More...
 
 ArtColor (const GradientStyle &gs_)
 Constructs an ArtColor object from a GradientStyle. More...
 
 ArtColor (const PatternStyle &ps_)
 Constructs an ArtColor object from a PatternStyle. More...
 
 ArtColor ()
 Constructs an ArtColor object that hasn't been assigned; that is, a stroke/fill set to "none". More...
 
virtual ~ArtColor ()
 Destructs an ArtColor object. More...
 
virtual Type colorType () const
 Gets the type/format of the color. More...
 
virtual std::string name () const
 Gets the name of a custom color. More...
 
virtual ArtColor asGray () const
 Gets the target ArtColor object in a grayscale format. More...
 
virtual ArtColor asRGB () const
 Gets the target ArtColor object in an RGB format. More...
 
virtual ArtColor asLab () const
 Gets the target ArtColor object in a Lab format. More...
 
virtual ArtColor asHSB () const
 Gets the target ArtColor object in a HSB format. More...
 
virtual ArtColor asCMYK () const
 Gets the target ArtColor object in a CMYK format. More...
 
virtual Channels channels () const
 Gets the underlying channel data for the target ArtColor. More...
 
virtual GradientStyle gradient () const
 Gets the underlying gradient style for the target ArtColor. More...
 
virtual PatternStyle pattern () const
 Gets the underlying pattern for the target ArtColor. More...
 
virtual bool makeNamed (const std::string &name_, const double tint_=0.0, const NamedFlags flags_=SpotColor)
 Converts an "anonymous" color to a "named" color. More...
 
virtual ArtColoroperator= (const ArtColor &rhs_)
 Allows one ArtColor object to be assigned from another. More...
 
virtual bool operator== (const ArtColor &rhs_) const
 Allows two ArtColor objects to be compared with the == operator. More...
 
virtual bool operator!= (const ArtColor &rhs_) const
 Allows two ArtColor objects to be compared with the != operator. More...
 

Static Public Member Functions

static ArtColor FromLab (const double lVal_, const double aVal_, const double bVal_)
 Constructs a Lab ArtColor object from its color components. More...
 
static ArtColor FromHSB (const Angle &hVal_, const double sVal_, const double bVal_)
 Constructs a HSB ArtColor object from its color components. More...
 
static ArtColor red ()
 Static accessor to return an ArtColor object for pure red. More...
 
static ArtColor orange ()
 Static accessor to return an ArtColor object for pure orange. More...
 
static ArtColor yellow ()
 Static accessor to return an ArtColor object for pure yellow. More...
 
static ArtColor green ()
 Static accessor to return an ArtColor object for pure green. More...
 
static ArtColor cyan ()
 Static accessor to return an ArtColor object for pure cyan. More...
 
static ArtColor blue ()
 Static accessor to return an ArtColor object for pure blue. More...
 
static ArtColor purple ()
 Static accessor to return an ArtColor object for pure purple. More...
 
static ArtColor magenta ()
 Static accessor to return an ArtColor object for pure magenta. More...
 
static ArtColor white ()
 Static accessor to return an ArtColor object for pure white (0% black) More...
 
static ArtColor lightGray ()
 Static accessor to return an ArtColor object for pure white (25% black) More...
 
static ArtColor gray ()
 Static accessor to return an ArtColor object for pure white (50% black) More...
 
static ArtColor darkGray ()
 Static accessor to return an ArtColor object for pure white (75% black) More...
 
static ArtColor black ()
 Static accessor to return an ArtColor object for pure white (100% black) More...
 
static ArtColor none ()
 Static accessor to return an ArtColor object for "none". More...
 

Friends

plugin::ArtColor * __accessImpl (const ArtColor &)
 
ArtColor __accessCtor (const plugin::ArtColor &)
 

Detailed Description

Describes the color of art on the artboard.

Contains color data, in a variety of formats, and color metadata (e.g. names). Can be grayscale, RGB, Lab, or CMYK (Illustrator has no alpha channel support, though)

Constructor & Destructor Documentation

hdi::core::ArtColor::ArtColor ( const ArtColor c_)

Constructs an ArtColor object from an existing ArtColor object (copy constructor)

Author
GW
Date
08/2013
Parameters
c_Existing ArtColor object
hdi::core::ArtColor::ArtColor ( const double  grayVal_)

Constructs a grayscale ArtColor object from a single color component in the range [0.0,1.0].

Author
GW
Date
08/2013
Parameters
grayVal_The grayscale color component, with 0.0 being white and 1.0 being black
hdi::core::ArtColor::ArtColor ( const double  rVal_,
const double  gVal_,
const double  bVal_ 
)

Constructs an RGB ArtColor object from three color components in the range [0.0,1.0].

Author
GW
Date
08/2013
Parameters
rVal_The red color component
gVal_The green color component
bVal_The blue color component
hdi::core::ArtColor::ArtColor ( const double  cVal_,
const double  mVal_,
const double  yVal_,
const double  kVal_ 
)

Constructs a CMYK ArtColor object from four color components in the range [0.0,1.0].

Author
GW
Date
08/2013
Parameters
cVal_The cyan color component
mVal_The magenta color component
yVal_The yellow color component
kVal_The black color component
hdi::core::ArtColor::ArtColor ( const GradientStyle gs_)

Constructs an ArtColor object from a GradientStyle.

Author
GW
Date
11/2016
Parameters
gs_The GradientStyle object, from which the ArtColor will be derived
hdi::core::ArtColor::ArtColor ( const PatternStyle ps_)

Constructs an ArtColor object from a PatternStyle.

Author
GW
Date
11/2016
Parameters
ps_The PatternStyle object, from which the ArtColor will be derived
hdi::core::ArtColor::ArtColor ( )

Constructs an ArtColor object that hasn't been assigned; that is, a stroke/fill set to "none".

Author
GW
Date
08/2013
virtual hdi::core::ArtColor::~ArtColor ( )
virtual

Destructs an ArtColor object.

Author
GW
Date
08/2013

Member Function Documentation

virtual ArtColor hdi::core::ArtColor::asCMYK ( ) const
virtual

Gets the target ArtColor object in a CMYK format.

Author
GW
Date
08/2013
Returns
A copy of the target ArtColor object, but formatted in CMYK
Note
If the type of the target ArtColor is not a basic or "named" color, then black will be returned.
virtual ArtColor hdi::core::ArtColor::asGray ( ) const
virtual

Gets the target ArtColor object in a grayscale format.

Author
GW
Date
08/2013
Returns
A copy of the target ArtColor object, but formatted in grayscale
Note
If the type of the target ArtColor is not a basic or "named" color, then black will be returned.
virtual ArtColor hdi::core::ArtColor::asHSB ( ) const
virtual

Gets the target ArtColor object in a HSB format.

Author
GW
Date
03/2015
Returns
A copy of the target ArtColor object, but formatted in HSB
Note
If the type of the target ArtColor is not a basic or "named" color, then black will be returned.
virtual ArtColor hdi::core::ArtColor::asLab ( ) const
virtual

Gets the target ArtColor object in a Lab format.

Author
GW
Date
08/2013
Returns
A copy of the target ArtColor object, but formatted in Lab
Note
If the type of the target ArtColor is not a basic or "named" color, then black will be returned.
virtual ArtColor hdi::core::ArtColor::asRGB ( ) const
virtual

Gets the target ArtColor object in an RGB format.

Author
GW
Date
08/2013
Returns
A copy of the target ArtColor object, but formatted in RGB
Note
If the type of the target ArtColor is not a basic or "named" color, then black will be returned.
static ArtColor hdi::core::ArtColor::black ( )
static

Static accessor to return an ArtColor object for pure white (100% black)

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::blue ( )
static

Static accessor to return an ArtColor object for pure blue.

Author
GW
Date
08/2013
virtual Channels hdi::core::ArtColor::channels ( ) const
virtual

Gets the underlying channel data for the target ArtColor.

Author
GW
Date
07/2014
Returns
A new Channels struct for the target ArtColor; if the type of the art color is Unknown, Gradient, or Pattern then the master member will be unknown and all channels will be 0.0
virtual Type hdi::core::ArtColor::colorType ( ) const
virtual

Gets the type/format of the color.

Author
GW
Date
08/2013
Returns
An enum value to describe the type of color
static ArtColor hdi::core::ArtColor::cyan ( )
static

Static accessor to return an ArtColor object for pure cyan.

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::darkGray ( )
static

Static accessor to return an ArtColor object for pure white (75% black)

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::FromHSB ( const Angle hVal_,
const double  sVal_,
const double  bVal_ 
)
static

Constructs a HSB ArtColor object from its color components.

Author
GW
Date
03/2015
Parameters
hVal_The hue color component
sVal_The saturation color component, in the range [0.0,1.0]
bVal_The brightness color component, in the range [0.0,1.0]
static ArtColor hdi::core::ArtColor::FromLab ( const double  lVal_,
const double  aVal_,
const double  bVal_ 
)
static

Constructs a Lab ArtColor object from its color components.

Author
GW
Date
08/2013
Parameters
lVal_The lightness color component, in the range [0.0,1.0]
aVal_The a dimension color component, in the range [-1.0,1.0]
bVal_The b dimension color component, in the range [-1.0,1.0]
Note
This is a named constructor due to argument type conflicts with that of the RGB constructor
virtual GradientStyle hdi::core::ArtColor::gradient ( ) const
virtual

Gets the underlying gradient style for the target ArtColor.

Author
GW
Date
12/2013
Returns
A new GradientStyle struct for the target ArtColor; if the type of the art color is not "Gradient" then the "gradient" member will be NULL
static ArtColor hdi::core::ArtColor::gray ( )
static

Static accessor to return an ArtColor object for pure white (50% black)

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::green ( )
static

Static accessor to return an ArtColor object for pure green.

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::lightGray ( )
static

Static accessor to return an ArtColor object for pure white (25% black)

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::magenta ( )
static

Static accessor to return an ArtColor object for pure magenta.

Author
GW
Date
08/2013
virtual bool hdi::core::ArtColor::makeNamed ( const std::string &  name_,
const double  tint_ = 0.0,
const NamedFlags  flags_ = SpotColor 
)
virtual

Converts an "anonymous" color to a "named" color.

Author
GW
Date
08/2013
Parameters
name_New name for the color, as UTF-8
tint_How much to tint the color
flags_Whether the color is a spot color or registration color
Returns
true if the conversion occurred, false otherwise
Note
Illustrator only supports named RGB, CMYK, and Lab colors natively. As such, a gray or HSB color will be converted to RGB before becoming named. Other types, such as gradients and patterns, cannot be named at all.
Named colors are automatically placed in Illustrator's Swatches panel with the provided name.
The names "All", "None", "Cyan", "Magenta", "Yellow", and "Black" are reserved by Illustrator.
virtual std::string hdi::core::ArtColor::name ( ) const
virtual

Gets the name of a custom color.

Author
GW
Date
08/2013
Returns
The UTF-8 name of the custom color, otherwise returns "" (empty string)
static ArtColor hdi::core::ArtColor::none ( )
static

Static accessor to return an ArtColor object for "none".

Illustrator typically interprets a "none" color as completely transparent

Author
GW
Date
08/2013
virtual bool hdi::core::ArtColor::operator!= ( const ArtColor rhs_) const
virtual

Allows two ArtColor objects to be compared with the != operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the != operator
Returns
true if the objects are inequal, false otherwise
Note
Two ArtColor objects are unequal when their types or components are unequal.
virtual ArtColor& hdi::core::ArtColor::operator= ( const ArtColor rhs_)
virtual

Allows one ArtColor object to be assigned from another.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the = operator; the object to copy values from
Returns
The target ArtColor object, but with its value updated to match that of rhs_
virtual bool hdi::core::ArtColor::operator== ( const ArtColor rhs_) const
virtual

Allows two ArtColor objects to be compared with the == operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the == operator
Returns
true if the objects are equal, false otherwise
Note
Two ArtColor objects are equal when their types and components are equal.
static ArtColor hdi::core::ArtColor::orange ( )
static

Static accessor to return an ArtColor object for pure orange.

Author
GW
Date
08/2013
virtual PatternStyle hdi::core::ArtColor::pattern ( ) const
virtual

Gets the underlying pattern for the target ArtColor.

Author
GW
Date
12/2013
Returns
A new PatternStyle struct for the target ArtColor; if the type of the art color is not "Pattern" then the "pattern" member will be NULL
static ArtColor hdi::core::ArtColor::purple ( )
static

Static accessor to return an ArtColor object for pure purple.

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::red ( )
static

Static accessor to return an ArtColor object for pure red.

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::white ( )
static

Static accessor to return an ArtColor object for pure white (0% black)

Author
GW
Date
08/2013
static ArtColor hdi::core::ArtColor::yellow ( )
static

Static accessor to return an ArtColor object for pure yellow.

Author
GW
Date
08/2013