Class: TGrafAttribute

Declaration: GrafAttribute.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

THiddenSurfaceRemovalControl TPrintingGrafAttribute TTessellationControl TDitherHint TSurfaceIsolines

Purpose:

TGrafAttribute is an abstract base class for polymorphically representing attributes used in rendering 2-D or 3-D graphics. The ready-made standard attributes, such as fill paint (for 2-D) or shaders (for 3-D), are represented by classes that are not derived from TGrafAttribute (such as TPaint or TShader). By contrast, TGrafAttribute derived classes generally implement less frequently used attributes, such as TDitherHint or TTessellationControl. You can also derive new classes from TGrafAttribute to extend the provided set of attributes. (However, these extended attributes are only useful if you also create a rendering device derived class that knows how to employ them.) TGrafAttributes are collected into bundles--instances of TGrafBundle (for 2-D graphics) or TGrafBundle3D (for 3-D graphics). A bundle includes all the attributes for drawing a graphic--both the standard set of attribute data (which are not descended from TGrafAttribute), as well as the extensible set of TGrafAttributes. An attribute can be given a name, which is retrievable with TGrafAttribute::GetName. The name is useful when you want to determine the class of each attribute retrieved by a TGrafBundleIterator. The name defaults to the name of the attribute's class (which always descends from TGrafAttribute). To override the default, the class itself must set the name--there is no member function for setting it. AdjustBounds describes how an attribute adjusts the loose-fit bounds of a rendered geometry. Among the standard attributes, for example, most paints do not adjust the bounds, and most pens do adjust the bounds. TGrafAttribute derived classes that can affect the bounds must implement AdjustBounds to compute and return the new bounding rectangle. CanAdjustBounds returns false if the attribute never adjusts the bounds, in which case AdjustBounds need not be implemented.

Instantiation:

Abstract class; do not allocate.

Deriving Classes:

Provided classes include TDitherHint, TSurfaceIsolines, TTessellationControl, and THiddenSurfaceRemovalControl. You can derive from TGrafAttribute and add the new attribute to a TGrafBundle or TGrafBundle3D. The deriving classes must override the member function GetName() returning a unique name for itself.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TGrafAttribute::~TGrafAttribute

virtual ~ TGrafAttribute ()

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: TGrafAttribute::GetName

virtual TToken GetName () const

Interface Category:

API.

Purpose:

Returns the token name of the class.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the token name by value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

All derived classes must override.

Member Function: TGrafAttribute::AdjustBounds

virtual TGRect AdjustBounds (TGRect sourceBounds) const

Interface Category:

API.

Purpose:

Adjusts the 2-D loosefit bounds for the attributes (for example, caps that adjust the bounds by the size of the caps).

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the newly computed bounds.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGrafAttribute::CanAdjustBounds

virtual bool CanAdjustBounds () const

Interface Category:

API.

Purpose:

Returns whether this attribute affects the bounds of the geometry.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the attribute can adjust the bounds.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGrafAttribute::operator>>=

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

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data. You can also call this function directly.

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: TGrafAttribute::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

The stream-in operator.

Calling Context:

Called to stream in data. You can also call this function directly.

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: TGrafAttribute::TGrafAttribute

  1. TGrafAttribute ()
  2. TGrafAttribute (const TGrafAttribute &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators . You can also call this function directly.
  2. Called to copy an object. You can also call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TGrafAttribute::operator=

TGrafAttribute & operator =(const TGrafAttribute & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object. You can also call this function directly.

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.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.