Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
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::auto_ptr< StopStopAP
 

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

void * _impl () const
 Internal use only. More...
 

Protected Attributes

void * _data
 Private implementation data.
 

Friends

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

Detailed Description

Handles general gradient-related functionality.

Constructor & Destructor Documentation

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).
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
virtual hdi::core::Gradient::~Gradient ( )
virtual

Gradient object destructor.

Author
GW
Date
12/2013

Member Function Documentation

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

Internal use only.

Author
GW
Date
11/2013
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.
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.
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
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.
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
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.
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
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
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
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
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
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
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
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
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
virtual std::auto_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_
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
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