Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
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 { NoFlag = 0 , SpotColorFlag = 1 << 0 , RegistrationColorFlag = 1 << 1 }
 Option flags for use when creating a named color.
 
typedef std::unique_ptr< ChannelsChannelsUP
 
typedef std::shared_ptr< ChannelsChannelsSP
 
typedef std::weak_ptr< ChannelsChannelsWP
 
typedef std::unique_ptr< GradientStyleGradientStyleUP
 
typedef std::shared_ptr< GradientStyleGradientStyleSP
 
typedef std::weak_ptr< GradientStyleGradientStyleWP
 
typedef std::unique_ptr< PatternStylePatternStyleUP
 
typedef std::shared_ptr< PatternStylePatternStyleSP
 
typedef std::weak_ptr< PatternStylePatternStyleWP
 

Public Member Functions

 ArtColor (const ArtColor &c_)
 Constructs an ArtColor object from an existing ArtColor object (copy constructor)
 
 ArtColor (const double grayVal_)
 Constructs a grayscale ArtColor object from a single color component in the range [0.0,1.0].
 
 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].
 
 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].
 
 ArtColor (const GradientStyle &gs_)
 Constructs an ArtColor object from a GradientStyle.
 
 ArtColor (const PatternStyle &ps_)
 Constructs an ArtColor object from a PatternStyle.
 
 ArtColor ()
 Constructs an ArtColor object that hasn't been assigned.
 
virtual ~ArtColor ()
 Destructs an ArtColor object.
 
virtual Type colorType () const
 Gets the type/format of the color.
 
virtual std::string name () const
 Gets the name of a custom color.
 
virtual ArtColor asGray () const
 Gets the target ArtColor object in a grayscale format.
 
virtual ArtColor asRGB () const
 Gets the target ArtColor object in an RGB format.
 
virtual ArtColor asLab () const
 Gets the target ArtColor object in a Lab format.
 
virtual ArtColor asHSB () const
 Gets the target ArtColor object in a HSB format.
 
virtual ArtColor asCMYK () const
 Gets the target ArtColor object in a CMYK format.
 
virtual Channels channels () const
 Gets the underlying channel data for the target ArtColor.
 
virtual GradientStyle gradient () const
 Gets the underlying gradient style for the target ArtColor.
 
virtual PatternStyle pattern () const
 Gets the underlying pattern for the target ArtColor.
 
virtual bool makeNamed (const std::string &name_, const double tint_=0.0, const NamedFlags flags_=SpotColorFlag)
 Converts an "anonymous" color to a "named" color.
 
virtual double namedTint () const
 Gets the tint for a "named" color, if any.
 
virtual NamedFlags namedFlags () const
 Gets the flags for a "named" color, if any.
 
virtual ArtColoroperator= (const ArtColor &rhs_)
 Allows one ArtColor object to be assigned from another.
 
virtual bool operator== (const ArtColor &rhs_) const
 Allows two ArtColor objects to be compared with the == operator.
 
virtual bool operator!= (const ArtColor &rhs_) const
 Allows two ArtColor objects to be compared with the != operator.
 

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.
 
static ArtColor FromHSB (const Angle &hVal_, const double sVal_, const double bVal_)
 Constructs a HSB ArtColor object from its color components.
 
static ArtColor red ()
 Static accessor to return an ArtColor object for pure red.
 
static ArtColor orange ()
 Static accessor to return an ArtColor object for pure orange.
 
static ArtColor yellow ()
 Static accessor to return an ArtColor object for pure yellow.
 
static ArtColor green ()
 Static accessor to return an ArtColor object for pure green.
 
static ArtColor cyan ()
 Static accessor to return an ArtColor object for pure cyan.
 
static ArtColor blue ()
 Static accessor to return an ArtColor object for pure blue.
 
static ArtColor purple ()
 Static accessor to return an ArtColor object for pure purple.
 
static ArtColor magenta ()
 Static accessor to return an ArtColor object for pure magenta.
 
static ArtColor white ()
 Static accessor to return an ArtColor object for pure white (0% black)
 
static ArtColor lightGray ()
 Static accessor to return an ArtColor object for pure white (25% black)
 
static ArtColor gray ()
 Static accessor to return an ArtColor object for pure white (50% black)
 
static ArtColor darkGray ()
 Static accessor to return an ArtColor object for pure white (75% black)
 
static ArtColor black ()
 Static accessor to return an ArtColor object for pure white (100% black)
 
static ArtColor none ()
 Static accessor to return an ArtColor object for "none".
 

Friends

aip::ArtColor * __accessImpl (const ArtColor &)
 
ArtColor __accessCtor (const aip::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, HSB, or CMYK.

Constructor & Destructor Documentation

◆ ArtColor() [1/7]

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

◆ ArtColor() [2/7]

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

◆ ArtColor() [3/7]

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

◆ ArtColor() [4/7]

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

◆ ArtColor() [5/7]

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

◆ ArtColor() [6/7]

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

◆ ArtColor() [7/7]

hdi::core::ArtColor::ArtColor ( )

Constructs an ArtColor object that hasn't been assigned.

Author
GW
Date
08/2013
Note
For Illustrator, this represents a "none" color. For Photoshop, this doesn't represent any color at all.

◆ ~ArtColor()

virtual hdi::core::ArtColor::~ArtColor ( )
virtual

Destructs an ArtColor object.

Author
GW
Date
08/2013

Member Function Documentation

◆ asCMYK()

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.

◆ asGray()

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.

◆ asHSB()

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.

◆ asLab()

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.

◆ asRGB()

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.

◆ black()

static ArtColor hdi::core::ArtColor::black ( )
static

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

Author
GW
Date
08/2013

◆ blue()

static ArtColor hdi::core::ArtColor::blue ( )
static

Static accessor to return an ArtColor object for pure blue.

Author
GW
Date
08/2013

◆ channels()

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

◆ colorType()

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

◆ cyan()

static ArtColor hdi::core::ArtColor::cyan ( )
static

Static accessor to return an ArtColor object for pure cyan.

Author
GW
Date
08/2013

◆ darkGray()

static ArtColor hdi::core::ArtColor::darkGray ( )
static

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

Author
GW
Date
08/2013

◆ FromHSB()

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]

◆ FromLab()

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

◆ gradient()

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

◆ gray()

static ArtColor hdi::core::ArtColor::gray ( )
static

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

Author
GW
Date
08/2013

◆ green()

static ArtColor hdi::core::ArtColor::green ( )
static

Static accessor to return an ArtColor object for pure green.

Author
GW
Date
08/2013

◆ lightGray()

static ArtColor hdi::core::ArtColor::lightGray ( )
static

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

Author
GW
Date
08/2013

◆ magenta()

static ArtColor hdi::core::ArtColor::magenta ( )
static

Static accessor to return an ArtColor object for pure magenta.

Author
GW
Date
08/2013

◆ makeNamed()

virtual bool hdi::core::ArtColor::makeNamed ( const std::string &  name_,
const double  tint_ = 0.0,
const NamedFlags  flags_ = SpotColorFlag 
)
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 not automatically added to Illustrator's Swatches panel.
The names "All", "None", "Cyan", "Magenta", "Yellow", and "Black" are reserved by Illustrator.

◆ name()

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)

◆ namedFlags()

virtual NamedFlags hdi::core::ArtColor::namedFlags ( ) const
virtual

Gets the flags for a "named" color, if any.

Author
GW
Date
06/2017
Returns
The flags for the color if it is named, NoFlag if none are present or if the color is not named

◆ namedTint()

virtual double hdi::core::ArtColor::namedTint ( ) const
virtual

Gets the tint for a "named" color, if any.

Author
GW
Date
06/2022
Returns
The tint for the color if it is named, 0 otherwise

◆ none()

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

◆ operator!=()

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.

◆ operator=()

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_

◆ operator==()

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.

◆ orange()

static ArtColor hdi::core::ArtColor::orange ( )
static

Static accessor to return an ArtColor object for pure orange.

Author
GW
Date
08/2013

◆ pattern()

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

◆ purple()

static ArtColor hdi::core::ArtColor::purple ( )
static

Static accessor to return an ArtColor object for pure purple.

Author
GW
Date
08/2013

◆ red()

static ArtColor hdi::core::ArtColor::red ( )
static

Static accessor to return an ArtColor object for pure red.

Author
GW
Date
08/2013

◆ white()

static ArtColor hdi::core::ArtColor::white ( )
static

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

Author
GW
Date
08/2013

◆ yellow()

static ArtColor hdi::core::ArtColor::yellow ( )
static

Static accessor to return an ArtColor object for pure yellow.

Author
GW
Date
08/2013