Hot Door CORE  0.7.1
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 CustomArt;
30  class Layer;
31  class MaskArt;
32  class MeshArt;
33  class PathArt;
34  class Pattern;
35  class PlacedArt;
36  class RasterArt;
37  class Symbol;
38  class TextArt;
39  class UID;
40 
48  class Art
49  {
50  public:
51  typedef std::vector< Artboard* > ArtboardVector;
52  typedef std::vector< Art* > ArtVector;
53  typedef std::vector<MatchArtSpec> MatchArtSpecVector;
54 
59  {
60  // Includes hidden and unpainted objects if they are not guides. Ignores direction handles.
61  VisibleBounds = 1 << 0,
62 
63  // When off, NoStrokeBounds, NoExtendedBounds, and ExcludeUnpaintedObjectBounds can be combined to
64  // ignore certain aspects of the visual bounds.
65  ControlBounds = 1 << 1,
66 
67  // Strokes, effects, and other appearance attributes that may make an object extend past the bezier
68  // outlines are ignored.
69  NoStrokeBounds = 1 << 2,
70 
71  // Implies NoStrokeBounds, but additionally excludes text characters for text on a path or area
72  // text, measuring only the path.
73  NoExtendedBounds = 1 << 3,
74 
75  // Use the setting of the "Use Preview Bounds" user preference to control whether the strokes and
76  // other appearance attributes are included. Cannot be used with NoStrokeBounds (NoStrokeBounds will
77  // take precedence).
78  StrokeDependsOnPref = 1 << 4,
79 
80  // Exclude hidden objects. Can be set with ControlBounds or VisibleBounds.
81  ExcludeHiddenObjectBounds = 1 << 5,
82 
83  // Excludes objects with no fill and no stroke.
84  ExcludeUnpaintedObjectBounds = 1 << 6,
85 
86  // Excludes guides. Can be set with ControlBounds or VisibleBounds.
87  ExcludeGuideBounds = 1 << 7
88  };
89 
94  {
95  ExpandPluginArt = 1 << 0,
96  ExpandText = 1 << 1,
97  ExpandStroke = 1 << 2,
98  ExpandPattern = 1 << 3,
99  ExpandGradientToMesh = 1 << 4,
100  ExpandGradientToPaths = 1 << 5,
101  ExpandSymbolInstances = 1 << 6,
102  ExpandOneAtATime = 1 << 7,
103  ExpandShowProgressBar = 1 << 8,
104  ExpandLockedObjects = 1 << 9
105  };
106 
111  {
112  // No transform
113  TransformOptionNone = 0,
114 
115  // Apply transform to art objects (almost always used)
116  TransformOptionObjects = 1 << 0,
117 
118  // Apply transform to gradient fills
119  TransformOptionFillGradients = 1 << 1,
120 
121  // Apply transform to pattern fills
122  TransformOptionFillPatterns = 1 << 2,
123 
124  // Apply transform to gradient strokes
125  TransformOptionStrokeGradients = 1 << 3,
126 
127  // Apply transform to pattern strokes
128  TransformOptionStrokePatterns = 1 << 4,
129 
130  // Apply transform to any opacity masks (if they are set as linked)
131  TransformOptionLinkedMasks = 1 << 5,
132 
133  // Apply the transformation recursively
134  TransformOptionChildren = 1 << 6,
135 
136  // Apply the transformation only to selected segments of path art
137  TransformOptionSelectedSegsOnly = 1 << 7
138  };
139 
161  class Iterator
162  {
163  public:
171  Iterator(const Iterator& iter_);
172 
178  ~Iterator();
179 
189  Iterator& operator=(const Iterator& rhs_);
190 
199  bool operator==(const Iterator& rhs_) const;
200 
209  bool operator!=(const Iterator& rhs_) const;
210 
218  Iterator& operator++();
219 
227  Iterator operator++(int);
228 
236  Iterator& operator--();
237 
245  Iterator operator--(int);
246 
255  bool atEnd() const;
256 
265  std::auto_ptr<Art> art() const;
266 
267 
268  private:
269  // Only Art can construct a new Iterator object
270  friend class Art;
271 
275  void* __data;
276 
282  Iterator();
283 
292  explicit Iterator(const Art& art_);
293  };
294 
295  typedef std::auto_ptr<Iterator> IteratorAP;
296 
307  Art();
308 
316  Art(const Art& art_);
317 
325  Art(const AIArtHandle aiArt_);
326 
327  #if HDI_CORE_COMPILE_AI22_PLUS
328 
335  Art(const AISafeArtHandle aiArt_);
336 
344  Art(const std::string& uuid_);
345  #endif
346 
358  Art(const ArtType type_, const PaintOrder order_, const Art* const prep_ = NULL);
359 
373  Art(
374  const ArtboardPoint& anchor_,
375  const TextOrientation dir_,
376  const PaintOrder order_,
377  const Art* const prep_ = NULL
378  );
379 
385  virtual ~Art();
386 
395  virtual Art& operator=(const Art& rhs_);
396 
407  virtual bool dispose();
408 
416  virtual bool disposeChildren();
417 
429  virtual std::auto_ptr<Art> duplicate(const PaintOrder order_, const Art* const prep_ = NULL) const;
430 
442  virtual AIArtHandle aiArtHandle() const;
443 
444  #if HDI_CORE_COMPILE_AI22_PLUS
445 
456  virtual AISafeArtHandle aiSafeArtHandle() const;
457 
465  virtual std::string uuid() const;
466  #endif
467 
475  virtual bool isEmpty() const;
476 
484  virtual bool valid() const;
485 
494  virtual bool operator==(const Art& rhs_) const;
495 
504  virtual bool operator!=(const Art& rhs_) const;
505 
513  virtual ArtType artType() const;
514 
523  virtual std::auto_ptr<UID> uid() const;
524 
535  virtual CustomArt* const customArt() const;
536 
547  virtual MaskArt* const mask() const;
548 
562  virtual MeshArt* const mesh() const;
563 
578  virtual PathArt* const path() const;
579 
593  virtual PlacedArt* const placed() const;
594 
608  virtual RasterArt* const raster() const;
609 
624  virtual TextArt* const text() const;
625 
626  #if HDI_CORE_COMPILE_AI21_PLUS
627 
632  virtual void markDirty();
633  #endif
634 
635  #if HDI_CORE_COMPILE_AI22_PLUS
636 
641  virtual void markClean();
642  #endif
643 
655  virtual void select();
656 
667  virtual void deselect();
668 
679  virtual bool selected() const;
680 
692  virtual bool fullySelected() const;
693 
705  virtual void setSelected(const bool select_);
706 
716  virtual bool editable() const;
717 
727  virtual void setEditable(const bool editable_);
728 
738  virtual bool locked() const;
739 
749  virtual void setLocked(const bool lock_);
750 
758  virtual bool hidden() const;
759 
767  virtual void setHidden(const bool hidden_);
768 
776  virtual bool anyAncestorSelected() const;
777 
785  virtual bool anyAncestorLocked() const;
786 
794  virtual bool anyAncestorHidden() const;
795 
803  virtual ArtAttribute allAttributes() const;
804 
812  virtual void setAllAttributes(const ArtAttribute attrs_);
813 
822  virtual bool attribute(const ArtAttribute attr_) const;
823 
833  virtual void setAttribute(const ArtAttribute attr_, const bool enable_);
834 
842  virtual std::auto_ptr<ai::Dictionary> dictionary() const;
843 
852  virtual ArtboardRect strokeBounds() const;
853 
863  virtual ArtboardRect noStrokeBounds() const;
864 
873  virtual ArtboardRect bounds(const BoundsOptions opts_) const;
874 
881  virtual void updateBounds();
882 
893  virtual ArtboardRect transformBounds(const TransformMatrix& transform_, const BoundsOptions opts_) const;
894 
904  virtual bool updateLinks(const bool force_ = false);
905 
913  virtual double x() const;
914 
922  virtual double y() const;
923 
931  virtual double width() const;
932 
940  virtual double height() const;
941 
949  virtual double perimeter() const;
950 
958  virtual double area() const;
959 
967  virtual bool centerPointVisible() const;
968 
976  virtual void setCenterPointVisible(const bool visible_);
977 
992  virtual std::auto_ptr<Artboard> artboard() const;
993 
1004  virtual ArtboardVector allArtboards() const;
1005 
1013  virtual std::auto_ptr<Layer> layer() const;
1014 
1025  virtual uint32_t childCount() const;
1026 
1034  virtual std::auto_ptr<Art> parent() const;
1035 
1043  virtual std::auto_ptr<Art> firstChild() const;
1044 
1052  virtual std::auto_ptr<Art> lastChild() const;
1053 
1061  virtual std::auto_ptr<Art> sibling() const;
1062 
1070  virtual std::auto_ptr<Art> priorSibling() const;
1071 
1079  virtual std::auto_ptr<Symbol> symbol() const;
1080 
1089  virtual bool setSymbol(const Symbol& sym_);
1090 
1105  virtual ArtVector matchingChildren(const MatchArtSpecVector& specs_) const;
1106 
1114  virtual bool hasFill() const;
1115 
1123  virtual bool hasStroke() const;
1124 
1132  virtual bool isLayerGroup() const;
1133 
1141  virtual bool isClipGroup() const;
1142 
1152  virtual void setIsClipGroup(const bool clip_);
1153 
1161  virtual std::auto_ptr<ArtStyle> style() const;
1162 
1170  virtual void setStyle(const ArtStyle& style_);
1171 
1179  virtual bool isStyled() const;
1180 
1189  virtual BlendMode blendMode() const;
1190 
1198  virtual void setBlendMode(const BlendMode mode_);
1199 
1208  virtual double opacity() const;
1209 
1217  virtual void setOpacity(const double o_);
1218 
1229  virtual BlendKnockout knockout() const;
1230 
1238  virtual BlendKnockout inheritedKnockout() const;
1239 
1247  virtual void setKnockout(const BlendKnockout ko_);
1248 
1259  virtual void reorder(const PaintOrder order_, const Art* const prep_ = NULL);
1260 
1275  virtual void expand(const ExpandOptions opts_, const uint32_t steps_);
1276 
1285  virtual void rotate(const Angle& angle_, const bool deep_ = false);
1286 
1296  virtual void rotate(const Angle& angle_, const BoundsPinPointType pinPt_, const bool deep_ = false);
1297 
1307  virtual void rotate(const Angle& angle_, const ArtboardPoint& origin_, const bool deep_ = false);
1308 
1317  virtual void scale(const double scaler_, const bool deep_ = false);
1318 
1328  virtual void scale(const double scaler_, const BoundsPinPointType pinPt_, const bool deep_ = false);
1329 
1339  virtual void scale(const double scaler_, const ArtboardPoint& origin_, const bool deep_ = false);
1340 
1350  virtual void scale(const double xScaler_, const double yScaler_, const bool deep_ = false);
1351 
1362  virtual void scale(
1363  const double xScaler_,
1364  const double yScaler_,
1365  const BoundsPinPointType pinPt_,
1366  const bool deep_ = false
1367  );
1368 
1379  virtual void scale(
1380  const double xScaler_,
1381  const double yScaler_,
1382  const ArtboardPoint& origin_,
1383  const bool deep_ = false
1384  );
1385 
1395  virtual void offset(const double x_, const double y_, const bool deep_ = false);
1396 
1407  virtual void move(
1408  const ArtboardPoint& newOrigin_,
1409  const BoundsPinPointType pinPt_,
1410  const bool deep_ = false
1411  );
1412 
1422  virtual void move(
1423  const ArtboardPoint& newOrigin_,
1424  const ArtboardPoint& origin_,
1425  const bool deep_ = false
1426  );
1427 
1436  virtual void transform(const TransformMatrix& matrix_, const bool deep_ = false);
1437 
1446  virtual void transformWithOptions(const TransformMatrix& matrix_, const TransformOptions options_);
1447 
1456  virtual void transformStrokes(const double scaler_, const bool children_);
1457 
1470  virtual bool canIsolate() const;
1471 
1482  virtual bool isIsolated() const;
1483 
1496  virtual bool isolate(const bool hideOtherArt_);
1497 
1523  Iterator begin() const;
1524 
1525 
1526  private:
1527  friend plugin::Art* __accessImpl(const Art&);
1528  friend Art __accessCtor(plugin::Art*&);
1529 
1533  void* __data;
1534 
1540  void* __impl() const;
1541 
1547  Art(plugin::Art*&);
1548  };
1549 
1550  typedef std::auto_ptr<Art> ArtAP;
1551 
1552  extern plugin::Art* __accessImpl(const Art&);
1553  extern Art __accessCtor(plugin::Art*&);
1554  }
1555 }
1556 
1558  const hdi::core::Art::BoundsOptions lhs_,
1560 );
1561 
1562 hdi::core::Art::BoundsOptions& operator|=(
1565 );
1566 
1568  const hdi::core::Art::ExpandOptions lhs_,
1570 );
1571 
1572 hdi::core::Art::ExpandOptions& operator|=(
1575 );
1576 
1580 );
1581 
1585 );
1586 
1587 #endif
1588 // __HDI_CORE_ART__
BlendKnockout
Describes the blending knockout of art.
Definition: hdicoreTypes.h:287
BoundsOptions
Allows for querying various attributes of some art&#39;s bounds.
Definition: hdicoreArt.h:58
Handles general art-related functionality.
Definition: hdicoreArt.h:48
ArtAttribute
Indicates a queryable attribute of an art object.
Definition: hdicoreTypes.h:138
Allows for raster art manipulation, metadata access, etc.
Definition: hdicoreRasterArt.h:22
Allows for mask manipulation, metadata access, etc.
Definition: hdicoreMaskArt.h:21
ArtType
Indicates a type of art (when querying an art object for its type)
Definition: hdicoreTypes.h:99
Allows for mesh manipulation, metadata access, etc.
Definition: hdicoreMeshArt.h:21
Describes a rectangular area on the Illustrator artboard.
Definition: hdicoreArtboardRect.h:25
Allows for iteration through the siblings of a piece of source art, a la std::vector iteration...
Definition: hdicoreArt.h:161
TransformOptions
Controls how art should be transformed by the transform() method.
Definition: hdicoreArt.h:110
Allows for path manipulation, metadata access, trimming, extending, etc.
Definition: hdicorePathArt.h:28
Header file for geometric rectangle manipulation on the Illustrator artboard.
BoundsPinPointType
These allow for simpler art transformation/bounds metadata access.
Definition: hdicoreTypes.h:300
PaintOrder
Indicates the position of art or layers when during creation or reordering.
Definition: hdicoreTypes.h:250
Allows for 2-dimensional transformations in a single application via matrix math. ...
Definition: hdicoreTransformMatrix.h:26
Handles general symbol-related functionality.
Definition: hdicoreSymbol.h:24
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
Allows for custom art "group", user-editable art, and user-viewable "result" art manipulation.
Definition: hdicoreCustomArt.h:21
BlendMode
Describes the blending mode of art (used for compositing art objects)
Definition: hdicoreTypes.h:263
Describes an art style.
Definition: hdicoreArtStyle.h:27
Allows for text frame manipulation, selection, metadata access, etc.
Definition: hdicoreTextArt.h:26
Definition: hdicoreaiArray.h:12
Allows for placed art manipulation, metadata access, etc.
Definition: hdicorePlacedArt.h:22
ExpandOptions
Controls how art should be expanded by the expand() method.
Definition: hdicoreArt.h:93
bool text(const std::string &text_, const Point &pt_, const bool hasCJK_=false)
Draws text with the current font and left justification.
TextOrientation
Indicates the orientation of some text.
Definition: hdicoreTypes.h:382
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