Class: THairlinePen

Declaration: GrafPens.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TPen

Inherited By:

None.

Purpose:

Derived from TPen, THairlinePen is a lightweight pen that renders very quickly. Because it is designed for fast rendering, it holds no data such as pen width--it always draws a thin line within 1/72 inch from the edge of the geometry. Any cap style or joint style attributes defined for a bundle that uses a hairline pen are ignored during rendering. Avoid using a hairline pen for user-interface elements, because when the user-interface element is enlarged, a space is left between it and the hairline. Instead, use one of the other pen styles, where the line is constructed from one World coordinate unit instead.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: THairlinePen::THairlinePen

  1. THairlinePen ()
  2. THairlinePen (const THairlinePen &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and as the default constructor.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: THairlinePen::~THairlinePen

virtual ~ THairlinePen ()

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: THairlinePen::GetPenData

virtual EPenType GetPenData (EPenBalance & penBalance, GCoordinate & penWidth) const

Interface Category:

API.

Purpose:

Provides the caller with the most commonly needed information about this pen.

Calling Context:

Called when you need the balance, width, and type information about a pen quickly.

Parameters:

Return Value:

Returns an EPenType of kHairlinePen.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Even though the width of a hairline pen is set to 0.0, it is assumed to be the width of one world coordinate unit. For some graphics devices with different resolutions, the actual width might vary.

Member Function: THairlinePen::GetPenType

virtual EPenType GetPenType () const

Interface Category:

API.

Purpose:

Returns the type of pen defined by the TPen. THairlinePen::GetPenType is provided so you can polymorphically query a TPen.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Always returns the EPenType kHairlinePen.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: THairlinePen::GetPenBalance

virtual EPenBalance GetPenBalance () const

Interface Category:

API.

Purpose:

Returns the type of pen balance defined by this TPen. THairlinePen::GetPenBalance is provided so you can polymorphically query a TPen.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Always returns an EPenBalance kCenterFrame.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: THairlinePen::GetPenWidth

virtual GCoordinate GetPenWidth () const

Interface Category:

API.

Purpose:

Returns the width of the pen. THairlinePen::GetPenWidth is provided so you can polymorphically query a TPen.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Always returns 0.0 world coordinate units.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Even though the width of a hairline pen is set to 0.0, it is assumed to be the width of one world coordinate unit. For some graphics devices with different resolution, the actual width might vary.

Member Function: THairlinePen::operator=

THairlinePen & operator =(const THairlinePen & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function by using the operator in an assignment statement.

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

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

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

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

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

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: THairlinePen::AdjustBounds

virtual TGRect AdjustBounds (const TGRect & bounds) const

Interface Category:

API.

Purpose:

Adjusts the size of a bounding rectangle to account for the width of the hairline pen. The incoming rectangle is made smaller by one half of a world coordinate on each side to account for a pen size of one world coordinate, thus leaving the original bounds of the graphic the same after it has been drawn.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the modified rectangle as a TGRect.

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.