Class: TColorPaint

Declaration: GrafAttribute.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TPaint

Inherited By:

None.

Purpose:

TColorPaint is a concrete class derived from TPaint. Use TColorPaint when you want a solid color (rather than a pattern) for filling or framing a graphic. (Solid means a single color, not necessarily an opaque color.) The paint can be used as a fill or frame paint, by making it an argument to TGrafBundle::AdoptFillPaint or TGrafBundle::AdoptFramePaint. TColorPaint is a wrapper for TColor; you specify the color by providing a TColor as a constructor argument. You can retrieve the color as any color by invoking the overloaded member function GetColor. TColorPaint also has a number of convenience member functions of the form GetColor, where Color is a color such as Black, Red, Cyan, and so on. Each of these member functions returns a reference to a constant TColorPaint of the specified color. The original TColorPaint keeps track of all these secondary TColorPaints that it has instantiated, creating new ones only if no paint of that color yet exists. In this way, you can easily create a palette of paints of standard colors and gray levels. Use the constructor to create paints of colors not handled by the Get functions.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TColorPaint::TColorPaint

  1. TColorPaint ()
  2. TColorPaint (const TColorPaint & aColorPaint)
  3. TColorPaint (const TColor & aColor)
  4. TColorPaint (TColor * adoptedColor)

Interface Category:

API.

Purpose:

  1. Default constructor. The color is defined as NIL.
  2. Copy constructor. The color is set to the color of aColorPaint.
  3. Constructor to create a TColorPaint with aColor as the color.
  4. Constructor to create a TColorPaint by adopting the color adoptedColor. No changes to adoptedColor are made. This is provided as a convenience to construct TColorPaint objects with nonconstant TColor pointer arguments.

Calling Context:

  1. Called by the stream-in operators and as the default constructor.
  2. Called to copy an object.
  3. Called to set the color to be the same as the TColor & aColor.
  4. Called to set the color to be the same as the TColor * adoptedColor.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::~TColorPaint

virtual ~ TColorPaint ()

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: TColorPaint::GetColor

  1. virtual void GetColor (TColor & color) const
  2. const TColor * GetColor () const

Interface Category:

API.

Purpose:

  1. Returns, in its TColor parameter, the color of this object. If the color is undefined, a color specified as TRGBColor(0.,0.,0.) is returned.
  2. Returns the color of this object as a TColor.

Calling Context:

  1. Called to get the color as a TColor object.
  2. Called to get a const copy of the color as a return value.

Parameters:

Return Value:

  1. None.
  2. Returns a constant pointer to a TColor object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetPaintStyle

virtual EPaintStyle GetPaintStyle () const

Interface Category:

API.

Purpose:

Gets the basic paint style of this object. Objects of this class always return kColorPaint.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns an EPaintStyle value set to kColorPaint.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetBlack

static const TColorPaint & GetBlack ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is black. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to the static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose color is black.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetDarkGray7

static const TColorPaint & GetDarkGray7 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 1/15 (approximately 7 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 1/15 (approximately 7 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetDarkGray13

static const TColorPaint & GetDarkGray13 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 2/15 (approximately 13 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 2/15 (approximately 13 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetDarkGray20

static const TColorPaint & GetDarkGray20 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 1/5 (20 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 1/5 (20 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetDarkGray27

static const TColorPaint & GetDarkGray27 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 4/15 (approximately 27 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 4/15 (approximately 27 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetDarkGray33

static const TColorPaint & GetDarkGray33 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 1/3 (approximately 33 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 1/3 (approximately 33 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetDarkGray40

static const TColorPaint & GetDarkGray40 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 6/15 (approximately 40 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 6/15 (approximately 40 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetDarkGray47

static const TColorPaint & GetDarkGray47 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 7/15 (approximately 47 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 7/15 (approximately 47 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetLightGray53

static const TColorPaint & GetLightGray53 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 8/15 (approximately 53 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 8/15 (approximately 53 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetLightGray60

static const TColorPaint & GetLightGray60 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 3/5 (60 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

A reference to a static const TColorPaint whose gray level is 3/5 (60 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetLightGray67

static const TColorPaint & GetLightGray67 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 2/3 (approximately 67 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 2/3 (approximately 67 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetLightGray73

static const TColorPaint & GetLightGray73 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 11/15 (approximately 73 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 11/15 (approximately 73 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetLightGray80

static const TColorPaint & GetLightGray80 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 4/5 (80 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 4/5 (80 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetLightGray87

static const TColorPaint & GetLightGray87 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 13/15 (approximately 87 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 13/15 (approximately 87 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetLightGray93

static const TColorPaint & GetLightGray93 ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint with a grayscale color whose gray level is 14/15 (approximately 93 percent) white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose gray level is 4/15 (approximately 93 percent) white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetWhite

static const TColorPaint & GetWhite ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is white. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

A reference to a static const TColorPaint whose color is white.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetRed

static const TColorPaint & GetRed ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is red. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose color is red.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetGreen

static const TColorPaint & GetGreen ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is green. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose color is green.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetBlue

static const TColorPaint & GetBlue ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is blue. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose color is blue.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetCyan

static const TColorPaint & GetCyan ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is cyan. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose color is cyan.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetYellow

static const TColorPaint & GetYellow ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is yellow. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose color is yellow.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::GetMagenta

static const TColorPaint & GetMagenta ()

Interface Category:

API.

Purpose:

Returns a reference to a constant TColorPaint whose color is magenta. If the static TColorPaint with this color does not exist yet, it is created. Otherwise, a reference to this static object is returned.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a reference to a static const TColorPaint whose color is magenta.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TColorPaint::operator=

TColorPaint & operator =(const TColorPaint & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

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

Parameters:

Return Value:

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