Class: TAttributeState

Declaration: AttributeState.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TLinkedBundleState TLocalAttributeState TRootAttributeState TGrafBundle

Purpose:

A graphic state consists of all the graphical state variables needed to draw a geometry, such as paint, transfer mode, pen geometry, matrix, and clip area. The matrix and clip area information are supplied by the TMatrixState and TClipState classes, respectively. But the other 2-D graphical state variables are referred to as attributes, and are packaged together in a descendant of TAttributeState. (3-D graphics have other attributes, packaged in a descendant of TAttribute3DState.) Attributes determine a graphic's appearance when it is drawn. TAttributeState, which is an abstract base class, provides access to the set of graphic attributes by means of Get member functions (such as GetFillPaint and GetFramePaint). Each standard attribute (paint, pen, and so on) is implemented as a separate class. You can create other attributes by deriving from TGrafAttribute; these custom attributes can be retrieved by name, with TAttributeState::GetGrafAttribute. Derived classes typically implement storage, concatenation behavior, and caching of appropriate values. The main derived class is TGrafBundle, which adds functions to adopt and orphan all the standard attributes, as well as to iterate over the set of nonstandard attributes. TAttributeState provides pure virtual functions to get and set a time stamp. Time stamps are a quick and efficient way to determine whether two TAttributeState objects are equal. If the time stamps of the two objects are equal, then the objects are equal. However, if the time stamps are not equal, the objects might or might not be equal. A TAttributeState derived class must maintain the value of its time stamp. If any part of the object's visible value changes, then it should update its time stamp by calling UpdateTimeStamp. A special case: if the object is in the default state, its time stamp is zero.

Instantiation:

Abstract class; do not allocate.

Deriving Classes:

Provided classes: TGrafBundle, TLinkableAttributeState, and TLinkedBundleState. Derived classes may maintain the time stamp. The LinkedBundle classes must maintain a timestamp for quick comparison.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TAttributeState::~TAttributeState

virtual ~ TAttributeState ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFillPaint

virtual const TPaint * GetFillPaint () const

Interface Category:

API.

Purpose:

Returns the paint used for the surface fill operations. This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TPaint object that specifies the color or pattern to be used by the kFill drawing operation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFramePaint

virtual const TPaint * GetFramePaint () const

Interface Category:

API.

Purpose:

Returns the paint used for the frame drawing operations. This is a pure virtual function that must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TPaint object that specifies the color or pattern to be used by the kFrame drawing operation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFillTransferMode

virtual const TTransferMode * GetFillTransferMode () const

Interface Category:

API.

Purpose:

Returns the transfer mode (such as TSrcCopyTransferMode) to be used during a fill drawing operation. This is a pure virtual function that must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TTransferMode object that represents the transfer mode to be used during a kFill drawing operation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFrameTransferMode

virtual const TTransferMode * GetFrameTransferMode () const

Interface Category:

API.

Purpose:

Returns the transfer mode (such as TSrcCopyTransferMode) to be used during a frame drawing operation. This is a pure virtual function that must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TTransferMode object that represents the transfer mode to be used during a kFrame drawing operation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFrameJoint

virtual const TJoint * GetFrameJoint () const

Interface Category:

API.

Purpose:

Returns the joint (such as TBevelJoint) to be used to smooth out the discontinuities which occur at the intersection of two line segments. This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TJoint object that represents the joint to be used at the intersection of two line segments.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFrameEndCap

virtual const TCap * GetFrameEndCap () const

Interface Category:

API.

Purpose:

Returns the cap (such as TFlushCap) to be used at the end of a line or geometry path. This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TCap object that represents the cap to be used at the end of a line or geometry path.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFrameStartCap

virtual const TCap * GetFrameStartCap () const

Interface Category:

API.

Purpose:

Returns the cap (such as TFlushCap) to be used at the start of a line or geometry path. This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TCap object that represents the cap to be used at the start of a line or geometry path.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetFramePen

virtual const TPen * GetFramePen () const

Interface Category:

API.

Purpose:

Returns the pen (such as THairlinePen) to be used to draw the frame model of the graphic. This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TPen object that represents the pen to be used by the kFrame drawing operation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetDrawingOperation

virtual EDrawOperation GetDrawingOperation () const

Interface Category:

API.

Purpose:

Returns the drawing operation specified by the attribute state. The return value is one of the EDrawOperation types (kFill, kFrame, or kFillAndFrame). This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

An EDrawOperation enumerated type that represents the drawing operation specified by this attribute state.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetImageSampling

virtual const TImageSamplingControl * GetImageSampling () const

Interface Category:

API.

Purpose:

Returns the image sampling to be done when the graphic is either interpolated (enlarged) or decimated (shrunk). How an image is sampled prior to interpolation or decimation is specified in a TImageSampleControl object. This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TImageSamplingControl object that determines how an image will be sampled prior to interpolation or decimation.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetImageTransferMode

virtual const TTransferMode * GetImageTransferMode () const

Interface Category:

API.

Purpose:

Returns the image transfer mode (such as TSrcCopyTransferMode) that determines how the colors of the image are modified when placed at the destination.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to a TTransferMode object that represents how the image colors are transferred to the destination.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetGrafAttribute

virtual const TGrafAttribute * GetGrafAttribute ( const TToken & key) const

Interface Category:

API.

Purpose:

Returns the TGrafAttribute object that is associated with the key. TGrafAttribute objects are custom attributes that you install into the bundle. This is a pure virtual function which must be overridden by derived classes.

Calling Context:

Do not call this function directly. It is designed to be overridden by the derived classes.

Parameters:

Return Value:

A constant pointer to the TGrafAttribute object associated with the name that is passed in as a key.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Iterating over extensible (custom) attributes is not supported yet.

Member Function: TAttributeState::GetTimeStamp

virtual TPseudoTimeStamp GetTimeStamp () const

Interface Category:

API.

Purpose:

Returns the time stamp stored by this object. This is a virtual function that is designed to be overridden by a derived class. It is the responsibility of derived classes to maintain the time stamp value. The time stamp value provides an efficient method to see whether two TAttributeState objects are equal.

Calling Context:

You can call this function directly, but it is designed to be overridden.

Parameters:

Return Value:

Returns a TPseudoTimeStamp object that is unique with respect to all other TAttributeState objects.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

In the base class, GetTimeStamp simply returns the contained time stamp.

Member Function: TAttributeState::TAttributeState

  1. TAttributeState ()
  2. TAttributeState (const TAttributeState &)

Interface Category:

API.

Purpose:

  1. Default constructor. This is a protected constructor which must be overridden by derived classes.
  2. Copy constructor. This is a protected constructor which must be overridden by derived classes.

Calling Context:

  1. Called by the stream-in operators. Do not call this function directly.
  2. Called to copy an object. Do not call this function directly except from a derived class' copy constructor.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::operator=

TAttributeState & operator =(const TAttributeState &)

Interface Category:

API.

Purpose:

Assignment operator. This is a protected member function which is designed to be overridden by derived classes.

Calling Context:

Do not call this function directly except from within a derived class' operator =function.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data. This is a protected member function designed to be called from a derived class' operator >>=function.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data. This is a protected member function designed to be called from a derived class' operator <<= function.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::SetTimeStamp

void SetTimeStamp (TPseudoTimeStamp)

Interface Category:

API.

Purpose:

Sets the internal time stamp stored in this object to the time stamp passed in as a TPseudoTimeStamp. This is a protected member function that is designed for internal use only.

Calling Context:

Only call this function from functions within a derived class.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::UpdateTimeStamp

void UpdateTimeStamp ()

Interface Category:

API.

Purpose:

Updates the time stamp value to a new value that is unique with respect to all other TAttributeState objects. This is a protected member function that is designed for internal use only.

Calling Context:

Only call this function from functions within a derived class.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::ResetTimeStamp

void ResetTimeStamp ()

Interface Category:

API.

Purpose:

Sets the time stamp to zero. This is a protected member function that is designed for internal use only.

Calling Context:

Only call this function from functions within a derived class.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::IsSameClass

bool IsSameClass (const MCollectible &) const

Interface Category:

API.

Purpose:

Compares the given MCollectible object with the current object to determine if they are of the same class.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the two objects are of the same class.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TAttributeState::GetPrimaryDitherHint

virtual const TDitherHint * GetPrimaryDitherHint () const

Interface Category:

API.

Purpose:

Returns a pointer to the current dither hint for this attribute bundle.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the pointer to this attribute bundle's primary dither hint.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.