Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
hdicoreArt.h
Go to the documentation of this file.
1 
7 #ifndef __HDI_CORE_ART__
8 #define __HDI_CORE_ART__
9 
10 #include "hdicoreArtboardRect.h"
11 #include "hdicoreTypes.h"
12 
13 namespace hdi
14 {
15  namespace plugin
16  {
17  class Art;
18  }
19 
20  namespace core
21  {
22  namespace ai
23  {
24  class Dictionary;
25  }
26 
27  class Artboard;
28  class ArtStyle;
29  class Layer;
30  class MaskArt;
31  class MeshArt;
32  class PathArt;
33  class Pattern;
34  class PlacedArt;
35  class RasterArt;
36  class Symbol;
37  class TextArt;
38  class UID;
39 
47  class Art
48  {
49  public:
50  typedef std::vector< Artboard* > ArtboardVector;
51  typedef std::vector< Art* > ArtVector;
52  typedef std::vector<MatchArtSpec> MatchArtSpecVector;
53 
58  {
59  // Includes hidden and unpainted objects if they are not guides. Ignores direction handles.
60  VisibleBounds = 1 << 0,
61 
62  // When off, NoStrokeBounds, NoExtendedBounds, and ExcludeUnpaintedObjectBounds can be combined to
63  // ignore certain aspects of the visual bounds.
64  ControlBounds = 1 << 1,
65 
66  // Strokes, effects, and other appearance attributes that may make an object extend past the bezier
67  // outlines are ignored.
68  NoStrokeBounds = 1 << 2,
69 
70  // Implies NoStrokeBounds, but additionally excludes text characters for text on a path or area
71  // text, measuring only the path.
72  NoExtendedBounds = 1 << 3,
73 
74  // Use the setting of the "Use Preview Bounds" user preference to control whether the strokes and
75  // other appearance attributes are included. Cannot be used with NoStrokeBounds (NoStrokeBounds will
76  // take precedence).
77  StrokeDependsOnPref = 1 << 4,
78 
79  // Exclude hidden objects. Can be set with ControlBounds or VisibleBounds.
80  ExcludeHiddenObjectBounds = 1 << 5,
81 
82  // Excludes objects with no fill and no stroke.
83  ExcludeUnpaintedObjectBounds = 1 << 6,
84 
85  // Excludes guides. Can be set with ControlBounds or VisibleBounds.
86  ExcludeGuideBounds = 1 << 7
87  };
88 
93  {
94  ExpandPluginArt = 1 << 0,
95  ExpandText = 1 << 1,
96  ExpandStroke = 1 << 2,
97  ExpandPattern = 1 << 3,
98  ExpandGradientToMesh = 1 << 4,
99  ExpandGradientToPaths = 1 << 5,
100  ExpandSymbolInstances = 1 << 6,
101  ExpandOneAtATime = 1 << 7,
102  ExpandShowProgressBar = 1 << 8,
103  ExpandLockedObjects = 1 << 9
104  };
105 
110  {
111  // No transform
112  TransformOptionNone = 0,
113 
114  // Apply transform to art objects (almost always used)
115  TransformOptionObjects = 1 << 0,
116 
117  // Apply transform to gradient fills
118  TransformOptionFillGradients = 1 << 1,
119 
120  // Apply transform to pattern fills
121  TransformOptionFillPatterns = 1 << 2,
122 
123  // Apply transform to pattern strokes
124  TransformOptionStrokePatterns = 1 << 3,
125 
126 // // Apply transform to stroke widths
127 // TransformOptionScaleStrokes = 1 << 4,
128 
129  // Apply transform to any opacity masks (if they are set as linked)
130  TransformOptionLinkedMasks = 1 << 5,
131 
132  // Apply the transformation recursively
133  TransformOptionChildren = 1 << 6,
134 
135  // Apply the transformation only to selected segments of path art
136  TransformOptionSelectedSegsOnly = 1 << 7
137  };
138 
160  class Iterator
161  {
162  public:
170  Iterator(const Iterator& iter_);
171 
177  ~Iterator();
178 
188  Iterator& operator=(const Iterator& rhs_);
189 
198  bool operator==(const Iterator& rhs_) const;
199 
208  bool operator!=(const Iterator& rhs_) const;
209 
217  Iterator& operator++();
218 
226  Iterator operator++(int);
227 
235  Iterator& operator--();
236 
244  Iterator operator--(int);
245 
254  bool atEnd() const;
255 
264  std::auto_ptr<Art> art() const;
265 
266 
267  private:
268  // Only Art can construct a new Iterator object
269  friend class Art;
270 
274  void* __data;
275 
281  Iterator();
282 
291  explicit Iterator(const Art& art_);
292  };
293 
294  typedef std::auto_ptr<Iterator> IteratorAP;
295 
306  Art();
307 
315  Art(const Art& art_);
316 
324  Art(const AIArtHandle aiArt_);
325 
337  Art(const ArtType type_, const PaintOrder order_, const Art* const prep_ = NULL);
338 
352  Art(
353  const ArtboardPoint& anchor_,
354  const TextOrientation dir_,
355  const PaintOrder order_,
356  const Art* const prep_ = NULL
357  );
358 
364  virtual ~Art();
365 
374  virtual Art& operator=(const Art& rhs_);
375 
386  virtual bool dispose();
387 
399  virtual std::auto_ptr<Art> duplicate(const PaintOrder order_, const Art* const prep_ = NULL) const;
400 
412  virtual AIArtHandle aiArtHandle() const;
413 
421  virtual bool isEmpty() const;
422 
430  virtual bool valid() const;
431 
440  virtual bool operator==(const Art& rhs_) const;
441 
450  virtual bool operator!=(const Art& rhs_) const;
451 
459  virtual ArtType artType() const;
460 
469  virtual std::auto_ptr<UID> uid() const;
470 
481  virtual MaskArt* const mask() const;
482 
496  virtual MeshArt* const mesh() const;
497 
512  virtual PathArt* const path() const;
513 
527  virtual PlacedArt* const placed() const;
528 
542  virtual RasterArt* const raster() const;
543 
558  virtual TextArt* const text() const;
559 
560  #if HDI_CORE_COMPILE_AI21_PLUS
561 
566  virtual void markDirty();
567  #endif
568 
580  virtual void select();
581 
592  virtual void deselect();
593 
604  virtual bool selected() const;
605 
617  virtual bool fullySelected() const;
618 
630  virtual void setSelected(const bool select_);
631 
641  virtual bool editable() const;
642 
652  virtual void setEditable(const bool editable_);
653 
663  virtual bool locked() const;
664 
674  virtual void setLocked(const bool lock_);
675 
683  virtual bool hidden() const;
684 
692  virtual void setHidden(const bool hidden_);
693 
701  virtual bool anyAncestorSelected() const;
702 
710  virtual bool anyAncestorLocked() const;
711 
719  virtual bool anyAncestorHidden() const;
720 
728  virtual ArtAttribute allAttributes() const;
729 
737  virtual void setAllAttributes(const ArtAttribute attrs_);
738 
747  virtual bool attribute(const ArtAttribute attr_) const;
748 
758  virtual void setAttribute(const ArtAttribute attr_, const bool enable_);
759 
767  virtual std::auto_ptr<ai::Dictionary> dictionary() const;
768 
777  virtual ArtboardRect strokeBounds() const;
778 
788  virtual ArtboardRect noStrokeBounds() const;
789 
798  virtual ArtboardRect bounds(const BoundsOptions opts_) const;
799 
806  virtual void updateBounds();
807 
818  virtual ArtboardRect transformBounds(const TransformMatrix& transform_, const BoundsOptions opts_) const;
819 
829  virtual bool updateLinks(const bool force_ = false);
830 
838  virtual double x() const;
839 
847  virtual double y() const;
848 
856  virtual double width() const;
857 
865  virtual double height() const;
866 
874  virtual double perimeter() const;
875 
883  virtual double area() const;
884 
892  virtual bool centerPointVisible() const;
893 
901  virtual void setCenterPointVisible(const bool visible_);
902 
917  virtual std::auto_ptr<Artboard> artboard() const;
918 
929  virtual ArtboardVector allArtboards() const;
930 
938  virtual std::auto_ptr<Layer> layer() const;
939 
950  virtual uint32_t childCount() const;
951 
959  virtual std::auto_ptr<Art> parent() const;
960 
968  virtual std::auto_ptr<Art> firstChild() const;
969 
977  virtual std::auto_ptr<Art> lastChild() const;
978 
986  virtual std::auto_ptr<Art> sibling() const;
987 
995  virtual std::auto_ptr<Art> priorSibling() const;
996 
1004  virtual std::auto_ptr<Art> pluginEditArt() const;
1005 
1013  virtual std::auto_ptr<Symbol> symbol() const;
1014 
1023  virtual bool setSymbol(const Symbol& sym_);
1024 
1039  virtual ArtVector matchingChildren(const MatchArtSpecVector& specs_) const;
1040 
1048  virtual bool hasFill() const;
1049 
1057  virtual bool hasStroke() const;
1058 
1066  virtual bool isLayerGroup() const;
1067 
1075  virtual bool isClipGroup() const;
1076 
1084  virtual std::auto_ptr<ArtStyle> style() const;
1085 
1093  virtual void setStyle(const ArtStyle& style_);
1094 
1102  virtual bool isStyled() const;
1103 
1112  virtual BlendMode blendMode() const;
1113 
1121  virtual void setBlendMode(const BlendMode mode_);
1122 
1131  virtual double opacity() const;
1132 
1140  virtual void setOpacity(const double o_);
1141 
1152  virtual BlendKnockout knockout() const;
1153 
1161  virtual BlendKnockout inheritedKnockout() const;
1162 
1170  virtual void setKnockout(const BlendKnockout ko_);
1171 
1182  virtual void reorder(const PaintOrder order_, const Art* const prep_ = NULL);
1183 
1198  virtual void expand(const ExpandOptions opts_, const uint32_t steps_);
1199 
1208  virtual void rotate(const Angle& angle_, const bool deep_ = false);
1209 
1219  virtual void rotate(const Angle& angle_, const BoundsPinPointType pinPt_, const bool deep_ = false);
1220 
1230  virtual void rotate(const Angle& angle_, const ArtboardPoint& origin_, const bool deep_ = false);
1231 
1240  virtual void scale(const double scaler_, const bool deep_ = false);
1241 
1251  virtual void scale(const double scaler_, const BoundsPinPointType pinPt_, const bool deep_ = false);
1252 
1262  virtual void scale(const double scaler_, const ArtboardPoint& origin_, const bool deep_ = false);
1263 
1273  virtual void scale(const double xScaler_, const double yScaler_, const bool deep_ = false);
1274 
1285  virtual void scale(
1286  const double xScaler_,
1287  const double yScaler_,
1288  const BoundsPinPointType pinPt_,
1289  const bool deep_ = false
1290  );
1291 
1302  virtual void scale(
1303  const double xScaler_,
1304  const double yScaler_,
1305  const ArtboardPoint& origin_,
1306  const bool deep_ = false
1307  );
1308 
1318  virtual void offset(const double x_, const double y_, const bool deep_ = false);
1319 
1330  virtual void move(
1331  const ArtboardPoint& newOrigin_,
1332  const BoundsPinPointType pinPt_,
1333  const bool deep_ = false
1334  );
1335 
1345  virtual void move(
1346  const ArtboardPoint& newOrigin_,
1347  const ArtboardPoint& origin_,
1348  const bool deep_ = false
1349  );
1350 
1359  virtual void transform(const TransformMatrix& matrix_, const bool deep_ = false);
1360 
1369  virtual void transformWithOptions(const TransformMatrix& matrix_, const TransformOptions options_);
1370 
1383  virtual bool canIsolate() const;
1384 
1395  virtual bool isIsolated() const;
1396 
1409  virtual bool isolate(const bool hideOtherArt_);
1410 
1436  Iterator begin() const;
1437 
1438 
1439  private:
1440  friend plugin::Art* __accessImpl(const Art&);
1441  friend Art __accessCtor(plugin::Art*&);
1442 
1446  void* __data;
1447 
1453  void* __impl() const;
1454 
1460  Art(plugin::Art*&);
1461  };
1462 
1463  typedef std::auto_ptr<Art> ArtAP;
1464 
1465  extern plugin::Art* __accessImpl(const Art&);
1466  extern Art __accessCtor(plugin::Art*&);
1467  }
1468 }
1469 
1471  const hdi::core::Art::BoundsOptions lhs_,
1473 );
1474 
1475 hdi::core::Art::BoundsOptions& operator|=(
1478 );
1479 
1481  const hdi::core::Art::ExpandOptions lhs_,
1483 );
1484 
1485 hdi::core::Art::ExpandOptions& operator|=(
1488 );
1489 
1493 );
1494 
1498 );
1499 
1500 #endif
1501 // __HDI_CORE_ART__
virtual bool operator!=(const Art &rhs_) const
Tests whether a given Art object is not the same as another.
virtual std::auto_ptr< Artboard > artboard() const
Gets the "most overlapping" artboard for the target art.
virtual MaskArt *const mask() const
Gets a MaskArt object for this Art object.
BoundsOptions
Allows for querying various attributes of some art's bounds.
Definition: hdicoreArt.h:57
virtual MeshArt *const mesh() const
Gets a MeshArt object for this Art object.
virtual bool isolate(const bool hideOtherArt_)
Isolates the art or one of its parents.
bool operator==(const Iterator &rhs_) const
Tests whether a given Iterator object is the same as another.
virtual void setEditable(const bool editable_)
Sets whether the art is editable.
Iterator begin() const
Gets an iterator for the art in the target's parent group, starting with the target.
Handles general art-related functionality.
Definition: hdicoreArt.h:47
virtual std::auto_ptr< Layer > layer() const
Gets the parent layer for the target art.
virtual double height() const
Gets the height of the bounds of the art.
virtual AIArtHandle aiArtHandle() const
Gets the art handle around which the target object is wrapped.
virtual PathArt *const path() const
Gets a PathArt object for this Art object.
virtual double area() const
Gets the area of the art.
virtual void setAllAttributes(const ArtAttribute attrs_)
Sets a bitwise OR'd enum value for all art attributes.
virtual bool updateLinks(const bool force_=false)
Checks whether any linked objects (linked images or placed objects) contained in the subtree of a giv...
virtual std::auto_ptr< Art > priorSibling() const
Gets the previous sibling art object for the target art.
Allows for raster art manipulation, metadata access, etc.
Definition: hdicoreRasterArt.h:22
virtual bool locked() const
Gets whether the art is locked.
virtual std::auto_ptr< Art > pluginEditArt() const
Gets the editable art object for the target plugin art.
virtual bool operator==(const Art &rhs_) const
Tests whether a given Art object is the same as another.
virtual ArtboardRect bounds(const BoundsOptions opts_) const
Gets the bounds rect for the target art.
std::auto_ptr< Art > art() const
Gets the current art pointed to by the iterator.
Iterator & operator++()
Prefix increment operator for forward iteration.
virtual std::auto_ptr< Art > firstChild() const
Gets the first child art object for the target art.
~Iterator()
Destructs an Iterator object.
virtual void scale(const double scaler_, const bool deep_=false)
Scales the art by a given scaler from its center point.
virtual ArtboardRect noStrokeBounds() const
Gets the bounds rect for the target art, excluding the stroke.
virtual std::auto_ptr< Art > lastChild() const
Gets the last child art object for the target art.
virtual bool anyAncestorSelected() const
Gets whether any ancestor of the art is selected.
virtual bool hasStroke() const
Gets whether the target art object has a stroke.
bool operator!=(const Iterator &rhs_) const
Tests whether a given Iterator object is not the same as another.
Allows for mask manipulation, metadata access, etc.
Definition: hdicoreMaskArt.h:21
virtual bool fullySelected() const
Gets whether the art is fully selected.
virtual std::auto_ptr< Art > sibling() const
Gets the next sibling art object for the target art.
virtual void rotate(const Angle &angle_, const bool deep_=false)
Rotates the target art by a given angle around its center point.
virtual bool hasFill() const
Gets whether the target art object has a fill.
virtual void setCenterPointVisible(const bool visible_)
Sets whether the center point is visible for the target art.
virtual ArtVector matchingChildren(const MatchArtSpecVector &specs_) const
Gets a vector of art in the art tree, rooted at the target, whose specs match those given...
virtual bool editable() const
Gets whether the art is editable.
virtual bool selected() const
Gets whether the art is selected.
virtual std::auto_ptr< ai::Dictionary > dictionary() const
Gets the built-in art data dictionary object for the target art.
virtual bool anyAncestorHidden() const
Gets whether any ancestor of the art is hidden.
virtual void deselect()
Sets the art object and all its children (in the case of a container) to be deselected.
virtual PlacedArt *const placed() const
Gets a PlacedArt object for this Art object.
Allows for mesh manipulation, metadata access, etc.
Definition: hdicoreMeshArt.h:21
Describes a rectangular area on the Illustrator artboard.
Definition: hdicoreArtboardRect.h:25
virtual bool isClipGroup() const
Gets whether the target art object is a group that has clip mask children.
virtual bool isEmpty() const
Gets whether the target Art object is empty (constructed with the default ctor)
Allows for iteration through the siblings of a piece of source art, a la std::vector iteration...
Definition: hdicoreArt.h:160
Iterator & operator--()
Prefix decrement operator for reverse iteration.
TransformOptions
Controls how art should be transformed by the transform() method.
Definition: hdicoreArt.h:109
virtual void setStyle(const ArtStyle &style_)
Sets the art's style.
virtual void reorder(const PaintOrder order_, const Art *const prep_=NULL)
Reorders the target art in Illustrator's drawing order.
virtual bool isStyled() const
Gets whether the target art is part of the styled art of another art object.
virtual void updateBounds()
Updates the bounds rect for the target art by updating Illustrator caches (regarding bounding boxes) ...
Allows for path manipulation, metadata access, trimming, extending, etc.
Definition: hdicorePathArt.h:28
virtual bool hidden() const
Gets whether the art is hidden.
virtual bool setSymbol(const Symbol &sym_)
Sets the original symbol definition object for an instance of a symbol.
Header file for geometric rectangle manipulation on the Illustrator artboard.
Allows for 2-dimensional transformations in a single application via matrix math. ...
Definition: hdicoreTransformMatrix.h:26
bool atEnd() const
Determines whether iteration should stop; works well as the conditional in a for() loop...
virtual void transform(const TransformMatrix &matrix_, const bool deep_=false)
Performs an arbitrary transformation on the target art.
Art()
Constructs an empty Art object.
virtual ArtType artType() const
Gets the type of the art.
Handles general symbol-related functionality.
Definition: hdicoreSymbol.h:24
virtual std::auto_ptr< Symbol > symbol() const
Gets the original symbol definition for an instance of a symbol.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
virtual double width() const
Gets the width of the bounds of the art.
virtual std::auto_ptr< ArtStyle > style() const
Gets the art's style.
Iterator & operator=(const Iterator &rhs_)
Assigns one Iterator object to another.
virtual bool anyAncestorLocked() const
Gets whether any ancestor of the art is locked.
virtual void setSelected(const bool select_)
Sets whether the art is selected.
Describes an art style.
Definition: hdicoreArtStyle.h:27
virtual bool dispose()
Removes the art from the artboard.
Allows for text frame manipulation, selection, metadata access, etc.
Definition: hdicoreTextArt.h:26
virtual void setHidden(const bool hidden_)
Sets whether the art is hidden.
virtual void setLocked(const bool lock_)
Sets whether the art is locked.
virtual bool valid() const
Tests the validity of the target piece of art by searching for it in the document.
Definition: hdicoreaiArray.h:12
virtual ArtAttribute allAttributes() const
Gets a bitwise OR'd enum value of all currently set art attributes.
virtual void transformWithOptions(const TransformMatrix &matrix_, const TransformOptions options_)
Performs an arbitrary transformation on the target art with the given options.
virtual Art & operator=(const Art &rhs_)
Assigns one Art object to another.
Allows for placed art manipulation, metadata access, etc.
Definition: hdicorePlacedArt.h:22
virtual void markDirty()
Marks an Art object for redrawing by incrementing its internal modification time stamp.
virtual double perimeter() const
Gets the perimeter of the art.
virtual void setOpacity(const double o_)
Sets the current opacity value applied to an art object.
ExpandOptions
Controls how art should be expanded by the expand() method.
Definition: hdicoreArt.h:92
virtual ArtboardRect transformBounds(const TransformMatrix &transform_, const BoundsOptions opts_) const
Gets the bounds that would be the result of a transform.
virtual void setAttribute(const ArtAttribute attr_, const bool enable_)
Sets an art attribute for the target art (e.g. hidden, locked, etc.)
virtual void setKnockout(const BlendKnockout ko_)
Sets the current knockout state of an art object.
virtual double x() const
Gets the top-left x-value of the art.
virtual uint32_t childCount() const
Gets the count of the children for the target art.
virtual std::auto_ptr< Art > duplicate(const PaintOrder order_, const Art *const prep_=NULL) const
Duplicates the target piece of art on the artboard.
virtual void select()
Sets the art object and all its children (in the case of a container) to be selected.
virtual bool isIsolated() const
Gets whether the art, or one of its parents, is currently isolated.
virtual void setBlendMode(const BlendMode mode_)
Sets the current blending mode of an art object, which applies to the object as a whole...
virtual void move(const ArtboardPoint &newOrigin_, const BoundsPinPointType pinPt_, const bool deep_=false)
Moves the art to a given point, placing its pin point (pinPt_ arg) at a particular pre- defined point...
virtual ArtboardRect strokeBounds() const
Gets the bounds rect for the target art, including the stroke.
virtual void offset(const double x_, const double y_, const bool deep_=false)
Offsets (moves) the art by given x-axis and y-axis values.
virtual BlendKnockout knockout() const
Retrieves the current knockout state of an art object.
virtual BlendKnockout inheritedKnockout() const
Retrieves the inherited knockout state (on or off) of an art object.
virtual void expand(const ExpandOptions opts_, const uint32_t steps_)
Expands the target art object.
virtual bool centerPointVisible() const
Gets whether the center point is visible for the target art.
virtual std::auto_ptr< Art > parent() const
Gets the parent art object for the target art.
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
virtual double opacity() const
Retrieves the current opacity value applied to an art object.
virtual RasterArt *const raster() const
Gets a RasterArt object for this Art object.
virtual TextArt *const text() const
Gets a TextArt object for this Art object.
virtual bool attribute(const ArtAttribute attr_) const
Gets whether a specific art attribute is true.
virtual BlendMode blendMode() const
Retrieves the current blending mode of an art object, which applies to the object as a whole...
virtual ~Art()
Art object destructor.
virtual double y() const
Gets the top-left y-value of the art.
virtual std::auto_ptr< UID > uid() const
Gets the UID for the target art.
virtual bool isLayerGroup() const
Gets whether the target art object is a group that corresponds to a layer or sublayer.
virtual bool canIsolate() const
Gets whether the art, or one of its parents, can be isolated.
virtual ArtboardVector allArtboards() const
Gets all the artboards that "touch" the target art.