Hot Door CORE  0.7.1
Adobe® Illustrator® Plug-in Library
hdicoreArtColor.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_ART_COLOR__
8 #define __HDI_CORE_ART_COLOR__
9 
10 #include "hdicoreAngle.h"
11 #include "hdicoreArtboardPoint.h"
12 #include "hdicoreSize.h"
13 #include "hdicoreTransformMatrix.h"
14 
15 namespace hdi
16 {
17  namespace plugin
18  {
19  class ArtColor;
20  }
21 
22  namespace core
23  {
24  class Gradient;
25  class Pattern;
26 
32  class ArtColor
33  {
34  public:
38  enum Type
39  {
40  TypeUnknown = 0,
41  // Basic colors
42  TypeNone = 1 << 0,
43  TypeGray = 1 << 1,
44  TypeRGB = 1 << 2,
45  TypeCMYK = 1 << 3,
46  TypeLab = 1 << 4,
47  TypeHSB = 1 << 5, // Same as HSV
48  // "Named" colors
49  TypeNamedRGB = 1 << 10,
50  TypeNamedCMYK = 1 << 11,
51  TypeNamedLab = 1 << 12,
52  // Other
53  TypePattern = 1 << 20,
54  TypeGradient = 1 << 21,
55  // Helpers
56  AnonymousTypes = (TypeGray | TypeRGB | TypeCMYK | TypeLab | TypeHSB),
57  NamedTypes = (TypeNamedRGB | TypeNamedCMYK | TypeNamedLab)
58  };
59 
64  {
65  NoFlag = 0,
66  SpotColorFlag = 1 << 0,
67  RegistrationColorFlag = 1 << 1
68  };
69 
74  class Channels
75  {
76  public:
80  struct RGB
81  {
85  double red;
86 
90  double green;
91 
95  double blue;
96 
102  (RGB)();
103 
111  (RGB)(const RGB& obj_);
112 
122  (RGB)(const double r_, const double g_, const double b_);
123 
129  virtual (~RGB)();
130 
140  RGB& operator=(const RGB& rhs_);
141 
150  bool operator==(const RGB& rhs_) const;
151 
160  bool operator!=(const RGB& rhs_) const;
161  };
162 
163  typedef std::auto_ptr<RGB> RGBAP;
164 
168  struct CMYK
169  {
173  double cyan;
174 
178  double magenta;
179 
183  double yellow;
184 
188  double black;
189 
195  (CMYK)();
196 
204  (CMYK)(const CMYK& obj_);
205 
216  (CMYK)(const double c_, const double m_, const double y_, const double k_);
217 
223  virtual (~CMYK)();
224 
234  CMYK& operator=(const CMYK& rhs_);
235 
244  bool operator==(const CMYK& rhs_) const;
245 
254  bool operator!=(const CMYK& rhs_) const;
255  };
256 
257  typedef std::auto_ptr<CMYK> CMYKAP;
258 
262  struct Lab
263  {
267  double lightness;
268 
272  double a;
273 
277  double b;
278 
284  Lab();
285 
293  Lab(const Lab& obj_);
294 
304  Lab(const double l_, const double a_, const double b_);
305 
311  virtual ~Lab();
312 
322  Lab& operator=(const Lab& rhs_);
323 
332  bool operator==(const Lab& rhs_) const;
333 
342  bool operator!=(const Lab& rhs_) const;
343  };
344 
345  typedef std::auto_ptr<Lab> LabAP;
346 
350  struct HSB
351  {
356 
360  double saturation;
361 
365  double brightness;
366 
372  HSB();
373 
381  HSB(const HSB& obj_);
382 
392  HSB(const Angle& h_, const double s_, const double b_);
393 
399  virtual ~HSB();
400 
410  HSB& operator=(const HSB& rhs_);
411 
420  bool operator==(const HSB& rhs_) const;
421 
430  bool operator!=(const HSB& rhs_) const;
431  };
432 
433  typedef std::auto_ptr<HSB> HSBAP;
434 
441 
445  double gray;
446 
451 
456 
461 
466 
472  Channels();
473 
481  Channels(const Channels& obj_);
482 
495  Channels(
496  const Type master_,
497  const double gray_,
498  const RGB& rgb_,
499  const CMYK& cmyk_,
500  const Lab& lab_,
501  const HSB& hsb_
502  );
503 
509  virtual ~Channels();
510 
520  Channels& operator=(const Channels& rhs_);
521  };
522 
523  typedef std::auto_ptr<Channels> ChannelsAP;
524 
529  {
530  public:
537 
543 
551 
557  double length;
558 
567 
573 
579 
585  GradientStyle();
586 
594  GradientStyle(const GradientStyle& grad_);
595 
610  const core::Gradient& gradient_,
611  const core::ArtboardPoint& origin_,
612  const core::Angle& angle_,
613  const double length_,
614  const core::TransformMatrix& matrix_,
615  const core::Angle& hiliteAngle_,
616  const double hiliteLength_
617  );
618 
624  virtual ~GradientStyle();
625 
635  GradientStyle& operator=(const GradientStyle& rhs_);
636  };
637 
638  typedef std::auto_ptr<GradientStyle> GradientStyleAP;
639 
644  {
645  public:
652 
658 
663 
667  double scaleX;
668 
672  double scaleY;
673 
678 
682  bool reflect;
683 
688 
693 
698 
703 
709  PatternStyle();
710 
718  PatternStyle(const PatternStyle& patt_);
719 
737  PatternStyle(
738  const core::Pattern& pattern_,
739  const double shiftDist_,
740  const core::Angle& shiftAngle_,
741  const double scaleX_,
742  const double scaleY_,
743  const core::Angle& rotation_,
744  const bool reflect_,
745  const core::Angle& reflectAngle_,
746  const core::Angle& shearAngle_,
747  const core::Angle& shearAxis_,
748  const core::TransformMatrix& transform_
749  );
750 
756  virtual ~PatternStyle();
757 
767  PatternStyle& operator=(const PatternStyle& rhs_);
768  };
769 
770  typedef std::auto_ptr<PatternStyle> PatternStyleAP;
771 
779  ArtColor(const ArtColor& c_);
780 
788  ArtColor(const double grayVal_);
789 
799  ArtColor(const double rVal_, const double gVal_, const double bVal_);
800 
811  ArtColor(const double cVal_, const double mVal_, const double yVal_, const double kVal_);
812 
820  ArtColor(const GradientStyle& gs_);
821 
829  ArtColor(const PatternStyle& ps_);
830 
836  ArtColor();
837 
849  static ArtColor FromLab(const double lVal_, const double aVal_, const double bVal_);
850 
860  static ArtColor FromHSB(const Angle& hVal_, const double sVal_, const double bVal_);
861 
867  virtual ~ArtColor();
868 
876  virtual Type colorType() const;
877 
885  virtual std::string name() const;
886 
897  virtual ArtColor asGray() const;
898 
909  virtual ArtColor asRGB() const;
910 
921  virtual ArtColor asLab() const;
922 
933  virtual ArtColor asHSB() const;
934 
945  virtual ArtColor asCMYK() const;
946 
955  virtual Channels channels() const;
956 
965  virtual GradientStyle gradient() const;
966 
975  virtual PatternStyle pattern() const;
976 
995  virtual bool makeNamed(
996  const std::string& name_,
997  const double tint_ = 0.0,
998  const NamedFlags flags_ = SpotColorFlag
999  );
1000 
1009  virtual NamedFlags namedFlags() const;
1010 
1019  virtual ArtColor& operator=(const ArtColor& rhs_);
1020 
1031  virtual bool operator==(const ArtColor& rhs_) const;
1032 
1043  virtual bool operator!=(const ArtColor& rhs_) const;
1044 
1050  static ArtColor red();
1051 
1057  static ArtColor orange();
1058 
1064  static ArtColor yellow();
1065 
1071  static ArtColor green();
1072 
1078  static ArtColor cyan();
1079 
1085  static ArtColor blue();
1086 
1092  static ArtColor purple();
1093 
1099  static ArtColor magenta();
1100 
1106  static ArtColor white();
1107 
1113  static ArtColor lightGray();
1114 
1120  static ArtColor gray();
1121 
1127  static ArtColor darkGray();
1128 
1134  static ArtColor black();
1135 
1142  static ArtColor none();
1143 
1144 
1145  private:
1146  friend plugin::ArtColor* __accessImpl(const ArtColor&);
1147  friend ArtColor __accessCtor(const plugin::ArtColor&);
1148 
1152  plugin::ArtColor* __impl;
1153 
1159  ArtColor(const plugin::ArtColor&);
1160  };
1161 
1162  typedef std::auto_ptr<ArtColor> ArtColorAP;
1163 
1164  extern plugin::ArtColor* __accessImpl(const ArtColor&);
1165  extern ArtColor __accessCtor(const plugin::ArtColor&);
1166  }
1167 }
1168 
1172 );
1173 
1177 );
1178 
1179 #endif
1180 // __HDI_CORE_ART_COLOR__
Stores all the possible representations of a color-based ArtColor in all supported color models; the ...
Definition: hdicoreArtColor.h:74
Header file for describing angles.
double scaleX
Fraction to scale the prototype along the x-axis before filling.
Definition: hdicoreArtColor.h:667
core::Angle shearAxis
Axis to shear with respect to.
Definition: hdicoreArtColor.h:697
Lab lab
Stores the Lab channels.
Definition: hdicoreArtColor.h:460
double highlightLength
For a radial gradient, the distance of the hilight from the origin expressed as a fraction of the rad...
Definition: hdicoreArtColor.h:578
Describes a set of CMYK channels.
Definition: hdicoreArtColor.h:168
double blue
Stores the RGB color blue channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:95
CMYK cmyk
Stores the CMYK channels.
Definition: hdicoreArtColor.h:455
core::Angle angle
For a linear gradient, the angle of the gradient in degrees from the X axis. The ramp extends from th...
Definition: hdicoreArtColor.h:550
HSB hsb
Stores the HSB channels.
Definition: hdicoreArtColor.h:465
core::Angle highlightAngle
For a radial gradient, the angle to the blend highlight point. Not used for linear gradients...
Definition: hdicoreArtColor.h:572
Describes a set of Lab channels.
Definition: hdicoreArtColor.h:262
core::Angle shearAngle
Angle to slant the shear by.
Definition: hdicoreArtColor.h:692
double gray
Stores the grayscale color gray channel (0.0 is white, 1.0 is black)
Definition: hdicoreArtColor.h:445
NamedFlags
Option flags for use when creating a named color.
Definition: hdicoreArtColor.h:63
core::ArtboardPoint origin
For a linear gradient, the origin of the gradient in page coordinates, which is 0 on the gradient ram...
Definition: hdicoreArtColor.h:542
core::Gradient * gradient
Gradient to which the style applies. The lifetime of the object is only as long as the GradientStyle ...
Definition: hdicoreArtColor.h:536
core::Angle shiftAngle
Angle to translate the unscaled prototype before filling.
Definition: hdicoreArtColor.h:662
Handles general pattern-related functionality.
Definition: hdicorePattern.h:27
double red
Stores the RGB color red channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:85
core::Pattern * pattern
Pattern to which the style applies. The lifetime of the object is only as long as the PatternStyle wh...
Definition: hdicoreArtColor.h:651
core::Angle rotation
Angle to rotate the prototype before filling.
Definition: hdicoreArtColor.h:677
Header file for describing a 2D transformation matrix.
Describes a set of HSB channels.
Definition: hdicoreArtColor.h:350
Type
Describes the format/type of an ArtColor object.
Definition: hdicoreArtColor.h:38
double yellow
Stores the CMYK color yellow channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:183
double scaleY
Fraction to scale the prototype along the y-axis before filling.
Definition: hdicoreArtColor.h:672
Angle hue
Stores the HSB color hue channel.
Definition: hdicoreArtColor.h:355
Allows for 2-dimensional transformations in a single application via matrix math. ...
Definition: hdicoreTransformMatrix.h:26
core::TransformMatrix transform
Additional transformation arising from manipulating the path.
Definition: hdicoreArtColor.h:702
double lightness
Stores the Lab color lightness channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:267
core::Angle reflectAngle
Axis around which to reflect.
Definition: hdicoreArtColor.h:687
double brightness
Stores the HSB color brightness channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:365
Header file for describing 2D dimensions (width and height)
double shiftDistance
Distance to translate the unscaled prototype before filling, measured from the ruler origin...
Definition: hdicoreArtColor.h:657
Header file for geometric point manipulation on the Illustrator artboard.
core::TransformMatrix matrix
The accumulated transformations of the gradient. It is not necessarily the same as the transformation...
Definition: hdicoreArtColor.h:566
double magenta
Stores the CMYK color magenta channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:178
double b
Stores the Lab color b-dimension channel, in the range [-1.0,1.0].
Definition: hdicoreArtColor.h:277
Definition: hdicoreaiArray.h:12
Describes a set of RGB channels.
Definition: hdicoreArtColor.h:80
double saturation
Stores the HSB color saturation channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:360
Handles general gradient-related functionality.
Definition: hdicoreGradient.h:24
double green
Stores the RGB color green channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:90
RGB rgb
Stores the RGB channels.
Definition: hdicoreArtColor.h:450
double a
Stores the Lab color a-dimension channel, in the range [-1.0,1.0].
Definition: hdicoreArtColor.h:272
double cyan
Stores the CMYK color cyan channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:173
Describes a gradient that has been applied to some art.
Definition: hdicoreArtColor.h:528
double length
For a linear gradient, the distance in points over which the gradient ramp is applied. The ramp is scaled so that 100% of its value is this length. For a radial gradient, the radius of the containing circle.
Definition: hdicoreArtColor.h:557
Describes an angle, and allows for easy conversion between various units.
Definition: hdicoreAngle.h:25
Describes a point on the Illustrator artboard.
Definition: hdicoreArtboardPoint.h:28
bool reflect
When true, the prototype is reflected before filling.
Definition: hdicoreArtColor.h:682
double black
Stores the CMYK color black channel, in the range [0.0,1.0].
Definition: hdicoreArtColor.h:188
Describes the color of art on the artboard.
Definition: hdicoreArtColor.h:32
Type master
Stores the "master" type of channel data stored in the target object. The gray, rgb, cmyk, or lab member that matches this member will have the most accurate values as all other members were derived via color conversion.
Definition: hdicoreArtColor.h:440
Describes a pattern that has been applied to some art.
Definition: hdicoreArtColor.h:643