Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreLayer.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_LAYER__
8#define __HDI_CORE_LAYER__
9
10#include "hdicoreTypes.h"
11#include "hdicoreColor.h"
12#include "hdicoreRect.h"
13
14namespace hdi
15{
16 #if defined(HDI_CORE_AIP_MODE)
17 namespace aip
18 {
19 class Layer;
20 }
21 #elif defined(HDI_CORE_PSP_MODE)
22 namespace psp
23 {
24 class Layer;
25 }
26 #endif
27
28 namespace core
29 {
30 #if defined(HDI_CORE_AIP_MODE)
31 class Art;
32 class Artboard;
33 #endif
34
38 class Layer
39 {
40 public:
41 #if defined(HDI_CORE_AIP_MODE)
62 {
63 public:
71 Iterator(const Iterator& iter_);
72
79
90
99 bool operator==(const Iterator& rhs_) const;
100
109 bool operator!=(const Iterator& rhs_) const;
110
119
128
137
146
155 bool atEnd() const;
156
165 std::unique_ptr<Layer> layer() const;
166
167
168 private:
169 // Only Layer can construct a new Iterator object
170 friend class Layer;
171
175 void* __data;
176
182 Iterator();
183
192 explicit Iterator(const Layer& layer_);
193 };
194
195 typedef std::unique_ptr<Iterator> IteratorUP;
196 typedef std::shared_ptr<Iterator> IteratorSP;
197 typedef std::weak_ptr<Iterator> IteratorWP;
198
199 typedef Color ColorType;
200 #endif
201 // HDI_CORE_AIP_MODE
202
203 #if defined(HDI_CORE_PSP_MODE)
204 enum ColorType
205 {
206 ColorTypeUnknown = 0,
207 ColorTypeNone = 10,
208 ColorTypeRed = 20,
209 ColorTypeOrange = 30,
210 ColorTypeYellow = 40,
211 ColorTypeGreen = 50,
212 ColorTypeBlue = 60,
213 ColorTypeViolet = 70,
214 ColorTypeGray = 80
215 };
216
217 enum LockingState
218 {
219 LockingStateNone = 0,
220 LockingStateArtboardAutonest = 1 << 0,
221 LockingStateComposite = 1 << 1,
222 LockingStatePosition = 1 << 2,
223 LockingStateTransparency = 1 << 3,
224 LockingStateAll = 0xffffffff
225 };
226 #endif
227 // HDI_CORE_PSP_MODE
228
240
248 Layer(const Layer& layer_);
249
250 #if defined(HDI_CORE_AIP_MODE)
258 Layer(const AILayerHandle aiLayer_);
259
270 Layer(const PaintOrder order_, const Layer* const prep_ = NULL);
271 #elif defined(HDI_CORE_PSP_MODE)
279 Layer(const int32_t psLayer_);
280 #endif
281
287 virtual ~Layer();
288
297 virtual Layer& operator=(const Layer& rhs_);
298
299 #if defined(HDI_CORE_AIP_MODE)
311 virtual AILayerHandle aiLayerHandle() const;
312 #elif defined(HDI_CORE_PSP_MODE)
324 virtual int32_t psLayerID() const;
325 #endif
326
334 virtual bool isEmpty() const;
335
346 virtual bool dispose();
347
348 #if defined(HDI_CORE_AIP_MODE)
358 virtual bool editable() const;
359
369 virtual void setEditable(const bool editable_);
370
380 virtual bool locked() const;
381
391 virtual void setLocked(const bool locked_);
392
400 virtual bool hasArt() const;
401
409 virtual bool hasSelectedArt() const;
410
418 virtual void deselectArt() const;
419
428 virtual std::unique_ptr<Art> group() const;
429
437 virtual std::unique_ptr<Layer> parent() const;
438
446 virtual std::unique_ptr<Layer> firstChild() const;
447
455 virtual std::unique_ptr<Layer> sibling() const;
456
464 virtual std::unique_ptr<Layer> priorSibling() const;
465
474 virtual std::unique_ptr<Layer> nextPreorderLayer() const;
475
483 virtual bool preview() const;
484
492 virtual void setPreview(const bool preview_);
493
501 virtual bool printed() const;
502
510 virtual void setPrinted(const bool printed_);
511
519 virtual bool dimsPlacedImages() const;
520
528 virtual void setDimsPlacedImages(const bool dim_);
529
543 virtual bool convertToGroup();
544
571 #endif
572 // HDI_CORE_AIP_MODE
573
574 #if defined(HDI_CORE_PSP_MODE)
582 virtual LockingState locked() const;
583
591 virtual void setLocked(const LockingState locked_);
592
600 virtual bool background() const;
601
609 virtual bool fxVisible() const;
610
618 virtual void setFXVisible(const bool visible_);
619
627 virtual double opacity() const;
628
636 virtual void setOpacity(const double o_);
637
645 virtual bool preserveTransparency() const;
646
654 virtual void setPreserveTransparency(const bool pres_);
655
663 virtual BlendMode blendMode() const;
664
672 virtual void setBlendMode(const BlendMode bm_);
673
681 virtual Rect bounds() const;
682
690 virtual Rect boundsNoEffects() const;
691
699 virtual Rect boundsNoMask() const;
700 #endif
701 // HDI_CORE_PSP_MODE
702
710 virtual std::string name() const;
711
719 virtual void setName(const std::string& name_);
720
726 virtual void show();
727
733 virtual void hide();
734
742 virtual bool visible() const;
743
753 virtual void setVisible(const bool visible_);
754
762 virtual bool active() const;
763
771 virtual ColorType color() const;
772
780 virtual void setColor(const ColorType color_);
781
790 virtual bool operator==(const Layer& rhs_) const;
791
800 virtual bool operator!=(const Layer& rhs_) const;
801
809 virtual bool valid() const;
810
811
812 private:
813 #if defined(HDI_CORE_AIP_MODE)
814 friend class CurrentDocument;
815
816 friend aip::Layer* __accessImpl(const Layer&);
817 friend Layer __accessCtor(aip::Layer*&);
818
824 Layer(aip::Layer*&);
825 #elif defined(HDI_CORE_PSP_MODE)
826 friend class Document;
827
828 friend psp::Layer* __accessImpl(const Layer&);
829 friend Layer __accessCtor(psp::Layer*&);
830
836 Layer(psp::Layer*&);
837 #endif
838
842 void* __data;
843
849 void* __impl() const;
850 };
851
852 typedef std::unique_ptr<Layer> LayerUP;
853 typedef std::shared_ptr<Layer> LayerSP;
854 typedef std::weak_ptr<Layer> LayerWP;
855
856 #if defined(HDI_CORE_AIP_MODE)
857 extern aip::Layer* __accessImpl(const Layer&);
858 extern Layer __accessCtor(aip::Layer*&);
859 #elif defined(HDI_CORE_PSP_MODE)
860 extern psp::Layer* __accessImpl(const Layer&);
861 extern Layer __accessCtor(psp::Layer*&);
862 #endif
863 }
864}
865
866#if defined(HDI_CORE_PSP_MODE)
867 hdi::core::Layer::LockingState operator|(
868 const hdi::core::Layer::LockingState lhs_,
869 const hdi::core::Layer::LockingState rhs_
870 );
871
872 hdi::core::Layer::LockingState& operator|=(
873 hdi::core::Layer::LockingState& lhs__,
874 const hdi::core::Layer::LockingState rhs_
875 );
876#endif
877// HDI_CORE_PSP_MODE
878
879#endif
880// __HDI_CORE_LAYER__
Describes an RGB color, with opacity, typically for UI purposes.
Definition: hdicoreColor.h:32
Current (focused) document class to allow for metadata access, updating, dictionary access,...
Definition: hdicoreCurrentDocument.h:47
Allows one to interact with a document and its metadata (differs from CurrentDocument class)
Definition: hdicoreDocument.h:43
Allows for iteration through the siblings of a layer, a la std::vector iteration.
Definition: hdicoreLayer.h:62
std::unique_ptr< Layer > layer() const
Gets the current layer pointed to by the iterator.
Iterator & operator++()
Prefix increment operator for forward iteration.
Iterator operator++(int)
Postfix increment operator for forward iteration.
Iterator(const Iterator &iter_)
Constructs an Iterator object from an existing Iterator object (copy constructor)
~Iterator()
Destructs an Iterator object.
bool operator==(const Iterator &rhs_) const
Tests whether a given Iterator object is the same as another.
Iterator & operator=(const Iterator &rhs_)
Assigns one Iterator object to another.
Iterator & operator--()
Prefix decrement operator for reverse iteration.
bool operator!=(const Iterator &rhs_) const
Tests whether a given Iterator object is not the same as another.
bool atEnd() const
Determines whether iteration should stop; works well as the conditional in a for() loop.
Iterator operator--(int)
Postfix decrement operator for reverse iteration.
Allows for layer metadata access, visibility manipulation, locking, etc.
Definition: hdicoreLayer.h:39
virtual bool operator!=(const Layer &rhs_) const
Tests whether a given Layer object is not the same as another.
virtual ColorType color() const
Gets the color of the layer in the layer list.
Layer()
Constructs an empty Layer object.
virtual bool valid() const
Tests the validity of the target layer by checking its topmost "invisible" group.
virtual void setDimsPlacedImages(const bool dim_)
Sets whether images in the target layer are automatically dimmed.
virtual ~Layer()
Layer destructor.
virtual bool visible() const
Gets whether the target layer is visible.
virtual void setPrinted(const bool printed_)
Sets whether the target layer is considered printable when printing the document.
virtual void setColor(const ColorType color_)
Sets the color of the layer in the layer list.
virtual bool operator==(const Layer &rhs_) const
Tests whether a given Layer object is the same as another.
virtual bool dimsPlacedImages() const
Gets whether images in the target layer are automatically dimmed.
virtual std::unique_ptr< Layer > priorSibling() const
Gets the previous sibling layer object for the target layer.
virtual bool locked() const
Gets whether the target layer is locked.
virtual std::string name() const
Gets the name for the target layer.
virtual std::unique_ptr< Layer > firstChild() const
Gets the first child layer object for the target layer.
virtual void hide()
Hides the layer.
virtual void setName(const std::string &name_)
Sets the name for the target layer.
virtual bool hasSelectedArt() const
Gets whether any of the target layer's art is selected.
virtual void show()
Shows the layer.
virtual bool dispose()
Removes the layer from the document.
virtual bool convertToGroup()
Converts the target layer to an artwork group.
virtual std::unique_ptr< Layer > parent() const
Gets the parent layer object for the target layer.
Iterator begin() const
Gets an iterator for the layer in the target's parent layer, starting with the target.
virtual bool printed() const
Gets whether the target layer is considered printable when printing the document.
virtual bool isEmpty() const
Gets whether the target Layer object is empty (constructed with the default ctor)
Layer(const PaintOrder order_, const Layer *const prep_=NULL)
Inserts a new layer at a given position in the layer list in the current document.
virtual std::unique_ptr< Art > group() const
Gets the first (invisible) art group inside the layer.
Layer(const Layer &layer_)
Constructs a Layer object from an existing Layer object (copy constructor)
virtual Layer & operator=(const Layer &rhs_)
Assigns one Layer object to another.
virtual std::unique_ptr< Layer > nextPreorderLayer() const
Gets the next layer in preorder traversal, which returns descendents first.
virtual bool preview() const
Gets the target layer's preview or outline mode setting.
virtual bool editable() const
Gets whether the target layer is editable.
virtual AILayerHandle aiLayerHandle() const
Gets the layer handle around which the target object is wrapped.
virtual void setEditable(const bool editable_)
Sets whether the target layer is editable.
virtual void setLocked(const bool locked_)
Sets whether the target layer is locked.
virtual void setVisible(const bool visible_)
Sets whether the target layer is visible.
virtual void deselectArt() const
Deselects all of the target layer's art.
Layer(const AILayerHandle aiLayer_)
Constructs a new Layer object from an AILayerHandle.
virtual std::unique_ptr< Layer > sibling() const
Gets the next sibling layer object for the target layer.
virtual void setPreview(const bool preview_)
Sets the target layer to preview or outline mode.
virtual bool active() const
Gets whether the target Layer object is the active (current) layer.
virtual bool hasArt() const
Gets whether the target layer has any art.
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:34
Header file for describing plugin UI colors.
Header file for describing rectangles.
Header file for a wide variety of necessary typedefs, enums, and forwards declarations.
PaintOrder
Indicates the position of art or layers when during creation or reordering.
Definition: hdicoreTypes.h:316
BlendMode
Describes the blending mode of art (used for compositing art objects)
Definition: hdicoreTypes.h:750