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 | Protected Member Functions | Protected Attributes | Friends | List of all members
hdi::core::Gradient Class Reference

Handles general gradient-related functionality. More...

#include <hdicoreGradient.h>

Classes

class  Stop
 Describes the attributes of a gradient stop. More...
 

Public Types

enum  Type { UnknownGradientType = 0 , LinearGradientType = 10 , RadialGradientType = 20 }
 Indicates the type of "gradient" an object is representing.
 
typedef std::unique_ptr< StopStopUP
 
typedef std::shared_ptr< StopStopSP
 
typedef std::weak_ptr< StopStopWP
 

Public Member Functions

 Gradient ()
 Constructs an empty Gradient object.
 
 Gradient (const Gradient &grad_)
 Constructs a new Gradient object from an existing Gradient object (copy constructor)
 
virtual ~Gradient ()
 Gradient object destructor.
 
virtual Gradientoperator= (const Gradient &rhs_)
 Assigns one Gradient object to another.
 
virtual bool dispose ()
 Removes the gradient from its document.
 
virtual AIGradientHandle aiGradientHandle () const
 Gets the gradient handle around which the target object is wrapped.
 
virtual bool isEmpty () const
 Gets whether the target Gradient object is empty (constructed with the default ctor)
 
virtual bool valid () const
 Tests the validity of the target gradient by searching for it in the document.
 
virtual Type gradientType () const
 Gets the type of gradient the target object is representing.
 
virtual void setGradientType (const Type type_)
 Sets the type of gradient the target object is representing.
 
virtual bool operator== (const Gradient &rhs_) const
 Tests whether a given Gradient object is the same as another.
 
virtual bool operator!= (const Gradient &rhs_) const
 Tests whether a given Gradient object is not the same as another.
 
virtual std::string name () const
 Gets the name of the gradient.
 
virtual void setName (const std::string &name_)
 Sets the name of the gradient.
 
virtual int16_t stopCount () const
 Gets the number of stops (color transition or ramp points) in the target gradient.
 
virtual std::unique_ptr< StopstopAtIndex (const int16_t index_)
 Gets a gradient stop at the given index.
 
virtual bool setStopAtIndex (const int16_t index_, const Stop &stop_)
 Sets a gradient stop at the given index.
 
virtual bool insertStopAtIndex (const int16_t index_, Stop &stop__)
 Inserts a gradient stop at the given index.
 
virtual bool removeStopAtIndex (const int16_t index_, Stop &stop__)
 Removes a gradient stop at the given index.
 
virtual bool colorAtPosition (const double tVal_, ArtColor &color__)
 Gets the color at a given "t-value" (position) on a gradient ramp.
 

Static Public Member Functions

static Gradient create ()
 Creates a new Gradient object (and Illustrator gradient)
 

Protected Member Functions

void * _impl () const
 Internal use only.
 

Protected Attributes

void * _data
 Private implementation data.
 

Friends

aip::Gradient * __accessImpl (const Gradient &)
 
Gradient __accessCtor (aip::Gradient *&)
 

Detailed Description

Handles general gradient-related functionality.

Constructor & Destructor Documentation

◆ Gradient() [1/2]

hdi::core::Gradient::Gradient ( )

Constructs an empty Gradient object.

Author
GW
Date
12/2013
Note
To test if a Gradient object is empty, call isEmpty() on it
Empty Gradient objects do not relate to any gradient in an Illustrator document; they are designed to be "receivers" of some other Gradient object via the overloaded assignment operator. Empty Gradient objects are useless until such time (though it is safe to call any of their methods).

◆ Gradient() [2/2]

hdi::core::Gradient::Gradient ( const Gradient grad_)

Constructs a new Gradient object from an existing Gradient object (copy constructor)

Author
GW
Date
12/2013
Parameters
grad_Existing Gradient object

◆ ~Gradient()

virtual hdi::core::Gradient::~Gradient ( )
virtual

Gradient object destructor.

Author
GW
Date
12/2013

Member Function Documentation

◆ _impl()

void * hdi::core::Gradient::_impl ( ) const
protected

Internal use only.

Author
GW
Date
11/2013

◆ aiGradientHandle()

virtual AIGradientHandle hdi::core::Gradient::aiGradientHandle ( ) const
virtual

Gets the gradient handle around which the target object is wrapped.

Author
GW
Date
12/2013
Returns
AIGradientHandle for this object
Note
Generally, you shouldn't need to call this method. Only use it if you know what you're doing. If a specific piece of functionality provided by Illustrator is not handled by this class (or related classes), then it should probably be added to the hdi_core library.

◆ colorAtPosition()

virtual bool hdi::core::Gradient::colorAtPosition ( const double  tVal_,
ArtColor color__ 
)
virtual

Gets the color at a given "t-value" (position) on a gradient ramp.

Author
GW
Date
12/2013
Parameters
tVal_The point on the ramp, a percentage value in the range [0,1]
color__Return-by-reference for the color at the given position
Returns
true for success, false otherwise
Note
If the position is a stop, the color of that stop is returned. Otherwise, an interpolated color between stops is returned.

◆ create()

static Gradient hdi::core::Gradient::create ( )
static

Creates a new Gradient object (and Illustrator gradient)

Author
GW
Date
12/2013
Returns
A new Gradient object

◆ dispose()

virtual bool hdi::core::Gradient::dispose ( )
virtual

Removes the gradient from its document.

Author
GW
Date
12/2013
Returns
true for successful disposal, false otherwise
Note
After calling dispose(), this object is basically useless! The actual gradient is gone, so obviously none of these methods will work after that.

◆ gradientType()

virtual Type hdi::core::Gradient::gradientType ( ) const
virtual

Gets the type of gradient the target object is representing.

Author
GW
Date
12/2013
Returns
A Type enum value indicating the type of the underlying gradient

◆ insertStopAtIndex()

virtual bool hdi::core::Gradient::insertStopAtIndex ( const int16_t  index_,
Stop stop__ 
)
virtual

Inserts a gradient stop at the given index.

Author
GW
Date
12/2013
Parameters
index_The position at which to add this stop, in the range [0,stopCount]
stop__Return-by-reference for the newly inserted gradient stop
Returns
true for success, false otherwise
Note
The new stop will have the given index, and the indices of all subsequent stops are incremented.

◆ isEmpty()

virtual bool hdi::core::Gradient::isEmpty ( ) const
virtual

Gets whether the target Gradient object is empty (constructed with the default ctor)

Author
GW
Date
12/2013
Returns
true if the target Gradient object is empty, false otherwise

◆ name()

virtual std::string hdi::core::Gradient::name ( ) const
virtual

Gets the name of the gradient.

Author
GW
Date
11/2013
Returns
The gradient's name, as UTF-8

◆ operator!=()

virtual bool hdi::core::Gradient::operator!= ( const Gradient rhs_) const
virtual

Tests whether a given Gradient object is not the same as another.

Author
GW
Date
12/2013
Parameters
rhs_Gradient to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different gradients, false otherwise

◆ operator=()

virtual Gradient & hdi::core::Gradient::operator= ( const Gradient rhs_)
virtual

Assigns one Gradient object to another.

Author
GW
Date
12/2013
Parameters
rhs_Existing Gradient object to copy values from
Returns
The target Gradient object, but with its values updated to match that of the rhs_ argument

◆ operator==()

virtual bool hdi::core::Gradient::operator== ( const Gradient rhs_) const
virtual

Tests whether a given Gradient object is the same as another.

Author
GW
Date
12/2013
Parameters
rhs_Gradient to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same gradient, false otherwise

◆ removeStopAtIndex()

virtual bool hdi::core::Gradient::removeStopAtIndex ( const int16_t  index_,
Stop stop__ 
)
virtual

Removes a gradient stop at the given index.

Author
GW
Date
12/2013
Parameters
index_The position of the stop to remove, in the range [0,stopCount-1]
stop__Return-by-reference for the gradient stop that was removed
Returns
true for success, false otherwise

◆ setGradientType()

virtual void hdi::core::Gradient::setGradientType ( const Type  type_)
virtual

Sets the type of gradient the target object is representing.

Author
GW
Date
12/2013
Parameters
type_Enum value indicating the new type of the underlying gradient

◆ setName()

virtual void hdi::core::Gradient::setName ( const std::string &  name_)
virtual

Sets the name of the gradient.

Author
GW
Date
11/2013
Parameters
name_New name for the gradient, as UTF-8

◆ setStopAtIndex()

virtual bool hdi::core::Gradient::setStopAtIndex ( const int16_t  index_,
const Stop stop_ 
)
virtual

Sets a gradient stop at the given index.

Author
GW
Date
12/2013
Parameters
index_Index of the stop to modify, in the range [0,stopCount-1]
stop_New gradient stop settings
Returns
true for success, false otherwise

◆ stopAtIndex()

virtual std::unique_ptr< Stop > hdi::core::Gradient::stopAtIndex ( const int16_t  index_)
virtual

Gets a gradient stop at the given index.

Author
GW
Date
12/2013
Parameters
index_Index of the desired stop, in the range [0,stopCount-1]
Returns
The gradient stop at index_

◆ stopCount()

virtual int16_t hdi::core::Gradient::stopCount ( ) const
virtual

Gets the number of stops (color transition or ramp points) in the target gradient.

Author
GW
Date
12/2013
Returns
Number of stops; there are always at least two

◆ valid()

virtual bool hdi::core::Gradient::valid ( ) const
virtual

Tests the validity of the target gradient by searching for it in the document.

Author
GW
Date
12/2013
Returns
true for a valid gradient, false otherwise