CFx SDK Documentation  2020SP3
Public Member Functions | Static Public Attributes | List of all members
OdCmColor Class Reference

#include <CmColor.h>

Inheritance diagram for OdCmColor:
OdCmColorBase

Public Member Functions

 OdCmColor ()
 
 OdCmColor (const OdCmColor &color)
 
 OdCmColor (const OdCmColorBase &color)
 
 OdCmColor (OdCmEntityColor::ColorMethod color)
 
OdCmColoroperator= (const OdCmColor &color)
 
OdCmColoroperator= (const OdCmColorBase &color)
 
 ~OdCmColor ()
 
bool operator== (const OdCmColor &color) const
 
bool operator== (const OdCmColorBase &color) const
 
bool operator!= (const OdCmColor &color) const
 
bool operator!= (const OdCmColorBase &color) const
 
OdString getDescription () const
 
OdString getExplanation () const
 
virtual OdCmEntityColor::ColorMethod colorMethod () const
 
virtual void setColorMethod (OdCmEntityColor::ColorMethod colorMethod)
 
virtual bool isByColor () const
 
virtual bool isByLayer () const
 
virtual bool isByBlock () const
 
virtual bool isByACI () const
 
virtual bool isForeground () const
 
virtual bool isByDgnIndex () const
 
bool isNone () const
 
virtual OdUInt32 color () const
 
virtual void setColor (OdUInt32 color)
 
virtual void setRGB (OdUInt8 red, OdUInt8 green, OdUInt8 blue)
 
virtual void setRed (OdUInt8 red)
 
virtual void setGreen (OdUInt8 green)
 
virtual void setBlue (OdUInt8 blue)
 
virtual OdUInt8 red () const
 
virtual OdUInt8 green () const
 
virtual OdUInt8 blue () const
 
virtual OdUInt16 colorIndex () const
 
virtual void setColorIndex (OdUInt16 colorIndex)
 
virtual bool setNames (const OdString &colorName, const OdString &bookName=OdString::kEmpty)
 
virtual OdString colorName () const
 
virtual OdString bookName () const
 
virtual OdString colorNameForDisplay () const
 
OdCmEntityColor entityColor () const
 
OdString getDictionaryKey () const
 
bool setNamesFromDictionaryKey (const OdString &dictionaryKey)
 
void dwgIn (OdDbDwgFiler *pFiler)
 
void dwgOut (OdDbDwgFiler *pFiler) const
 
void dxfIn (OdDbDxfFiler *pFiler, int groupCodeOffset=0)
 
void dxfOut (OdDbDxfFiler *pFiler, int groupCodeOffset=0) const
 
void audit (OdDbAuditInfo *pAuditInfo)
 
void dwgInAsTrueColor (OdDbDwgFiler *pFiler)
 
void dwgOutAsTrueColor (OdDbDwgFiler *pFiler) const
 
- Public Member Functions inherited from OdCmColorBase
 ODRX_HEAP_OPERATORS ()
 
virtual ~OdCmColorBase ()
 

Static Public Attributes

static TOOLKIT_EXPORT_STATIC const OdUInt16 MaxColorIndex
 

Detailed Description

<group OdCm_Classes>

This class implements Color object that represents the unnamed and named colors specified by the byLayer, byBlock, byColor, byACI, byPen, Foreground, byDgnIndex, or None color methods.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_overview.html, Overview of Classes that Implement Color and Transparency>

The OdCmEntityColor class, the OdCmColorBase class

Definition at line 58 of file CmColor.h.

Constructor & Destructor Documentation

◆ OdCmColor() [1/4]

OdCmColor::OdCmColor ( )

◆ OdCmColor() [2/4]

OdCmColor::OdCmColor ( const OdCmColor color)

◆ OdCmColor() [3/4]

OdCmColor::OdCmColor ( const OdCmColorBase color)

◆ OdCmColor() [4/4]

OdCmColor::OdCmColor ( OdCmEntityColor::ColorMethod  color)

◆ ~OdCmColor()

OdCmColor::~OdCmColor ( )

Member Function Documentation

◆ audit()

void OdCmColor::audit ( OdDbAuditInfo pAuditInfo)

Perform an audit operation on this object.

Parameters
pAuditInfo[in] Pointer to an AuditInfo object.
Remarks
When overriding this function for a custom class, first call OdCmColorBase::audit(pAuditInfo) to validate the audit operation.

◆ blue()

virtual OdUInt8 OdCmColor::blue ( ) const
virtual

Returns the blue color component of the database color object as a value in range 0 to 255.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_RGB.html, Color Functionality as an RGB-value>

Implements OdCmColorBase.

◆ bookName()

virtual OdString OdCmColor::bookName ( ) const
virtual

Returns the Book name of the database color object.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_book.html, Color Functionality as a Book Name>

Implements OdCmColorBase.

◆ color()

virtual OdUInt32 OdCmColor::color ( ) const
virtual

Returns the packed 32-bits integer value that stores the color method and color components of the database color object.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

<link cm_color_integer.html, Color Functionality as an Integer-value>

Implements OdCmColorBase.

◆ colorIndex()

virtual OdUInt16 OdCmColor::colorIndex ( ) const
virtual

Returns the color index (ACI) of the database color object.

Remarks
The color index can be a one of the following:

Value Description kACIbyBlock 0 Sets the color method to byBlock. kACIRed 1 Red. kACIYellow 2 Yellow. kACIGreen 3 Green. kACICyan 4 Cyan. kACIBlue 5 Blue. kACIMagenta 6 Magenta. kACIforeground 7 Sets the color method to Foreground. .. 8-255 Defined by display device. kACIbyLayer 256 Sets the color method to byLayer. kACInone 257 Sets the color method to None.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

<link cm_color_index.html, Color Functionality as an ACI-value>

Implements OdCmColorBase.

◆ colorMethod()

virtual OdCmEntityColor::ColorMethod OdCmColor::colorMethod ( ) const
virtual

Returns the color method of the database color object as a value of the ColorMethod enumeration.

Remarks
The color method can be a one of the following:

Value Description kByLayer 0xC0 Color is specified by the layer object to which the object is resided. kByBlock 0xC1 Color is specified by the block object in which the object is contained. kByColor 0xC2 Color is specified by an RGB-value. kByACI 0xC3 Color is specified by an index (ACI) of a some color palette. kByPen 0xC4 Color is specified by an index into a pen color table. kForeground 0xC5 Color is foreground. kByDgnIndex 0xC7 Color is specified by an index into a dgn color table. kNone 0xC8 color is absent (object is clarity).

Remarks
Using of this method by third-party applications is neither supported nor recommended.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ colorName()

virtual OdString OdCmColor::colorName ( ) const
virtual

Returns the Color name of the database color object.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_book.html, Color Functionality as a Book Name>

Implements OdCmColorBase.

◆ colorNameForDisplay()

virtual OdString OdCmColor::colorNameForDisplay ( ) const
virtual

Returns the display color name of the database color object.

Remarks
For named colors, this is the same as colorName(). For unnamed colors, it is an 'appropriate' name.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_book.html, Color Functionality as a Book Name>

Implements OdCmColorBase.

◆ dwgIn()

void OdCmColor::dwgIn ( OdDbDwgFiler pFiler)

Reads the .dwg file format data of this object from the specified file.

Parameters
pFiler[in] Pointer to the filer from which the data are to be read.

◆ dwgInAsTrueColor()

void OdCmColor::dwgInAsTrueColor ( OdDbDwgFiler pFiler)

DOM

◆ dwgOut()

void OdCmColor::dwgOut ( OdDbDwgFiler pFiler) const

Writes the .dwg file format data of this object to the specified filer.

Parameters
pFiler[in] Pointer to the filer to which the data are to be written.

◆ dwgOutAsTrueColor()

void OdCmColor::dwgOutAsTrueColor ( OdDbDwgFiler pFiler) const

DOM

◆ dxfIn()

void OdCmColor::dxfIn ( OdDbDxfFiler pFiler,
int  groupCodeOffset = 0 
)

Reads the DXF format data of this object from the specified filer.

Parameters
pFiler[in] Pointer to the filer from which the data are to be read.
groupCodeOffset[in] Group code offset.

◆ dxfOut()

void OdCmColor::dxfOut ( OdDbDxfFiler pFiler,
int  groupCodeOffset = 0 
) const

Writes the DXF format data of this object to the specified filer.

Parameters
pFiler[in] Pointer to the filer to which the data are to be written.
groupCodeOffset[in] Group code offset.

◆ entityColor()

OdCmEntityColor OdCmColor::entityColor ( ) const

Returns the OdCmEntityColor settings of the database color object.

◆ getDescription()

OdString OdCmColor::getDescription ( ) const

Returns the description string of the database color object.

See also
<link cm_color_book.html, Color Functionality as a Book Name>

◆ getDictionaryKey()

OdString OdCmColor::getDictionaryKey ( ) const

Returns a dictionary key based on the color name and book name of the database color object.

Remarks
OdCmColor objects with color namescan be stored in the form of an OdDbColor in a dictionary. getDictionaryKey() returns the key for that dictionary.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_book.html, Color Functionality as a Book Name>

◆ getExplanation()

OdString OdCmColor::getExplanation ( ) const

Returns the explanation string of the database color object.

See also
<link cm_color_book.html, Color Functionality as a Book Name>

◆ green()

virtual OdUInt8 OdCmColor::green ( ) const
virtual

Returns the green color component of the database color object as a value in range 0 to 255.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_RGB.html, Color Functionality as an RGB-value>

Implements OdCmColorBase.

◆ isByACI()

virtual bool OdCmColor::isByACI ( ) const
virtual

Checks whether the color method is byACI for the database color object and returns true if and only if the color method is set to kByACI, otherwise it returns false.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
Remarks
This method returns true for ACI values of 0 (ByBlock), 7 (ByForeground), 256 (ByLayer), and 257 (None).
See also
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ isByBlock()

virtual bool OdCmColor::isByBlock ( ) const
virtual

Checks whether the color method is byBlock for the database color object and returns true if and only if the color method is set to kByBlock or was set to kACIbyBlock, otherwise it returns false.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ isByColor()

virtual bool OdCmColor::isByColor ( ) const
virtual

Checks whether the color method is byColor for the database color object and returns true if and only if the color method is set to kByColor, otherwise it returns false.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ isByDgnIndex()

virtual bool OdCmColor::isByDgnIndex ( ) const
virtual

Checks whether the color method is byDgnIndex for the database color object and returns true if and only if the color method is set to kByDgnIndex, otherwise it returns false.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ isByLayer()

virtual bool OdCmColor::isByLayer ( ) const
virtual

Checks whether the color method is byLayer for the database color object and returns true if and only if the color method is set to kByLayer or was set to kACIbyLayer, otherwise it returns false.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ isForeground()

virtual bool OdCmColor::isForeground ( ) const
virtual

Checks whether the color method is Foreground for the database color object and returns true if and only if the color method is set to kForeground or was set to kACIforeground, otherwise it returns false.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ isNone()

bool OdCmColor::isNone ( ) const

Checks whether the color method is None (invisible) for the database color object and returns true if and only if the color method is set to kNone or was set to kACInone, otherwise it returns false.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

◆ operator!=() [1/2]

bool OdCmColor::operator!= ( const OdCmColor color) const

Compares two database color objects using their integer values together with their color names and returns true when their values are not equal, or false when their values are equal.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_integer.html, Color Functionality as an Integer-value>

◆ operator!=() [2/2]

bool OdCmColor::operator!= ( const OdCmColorBase color) const

◆ operator=() [1/2]

OdCmColor& OdCmColor::operator= ( const OdCmColor color)

◆ operator=() [2/2]

OdCmColor& OdCmColor::operator= ( const OdCmColorBase color)

◆ operator==() [1/2]

bool OdCmColor::operator== ( const OdCmColor color) const

Compares two database color objects using their integer values together with their color names and returns true when their values are equal, or false when their values are not equal.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_integer.html, Color Functionality as an Integer-value>

◆ operator==() [2/2]

bool OdCmColor::operator== ( const OdCmColorBase color) const

◆ red()

virtual OdUInt8 OdCmColor::red ( ) const
virtual

Returns the red color component of the database color object as a value in range 0 to 255.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_RGB.html, Color Functionality as an RGB-value>

Implements OdCmColorBase.

◆ setBlue()

virtual void OdCmColor::setBlue ( OdUInt8  blue)
virtual

Sets the blue color component for the database color object.

Parameters
blue[in] Blue component as an integer value in range 0 to 255.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_RGB.html, Color Functionality as an RGB-value>

Implements OdCmColorBase.

◆ setColor()

virtual void OdCmColor::setColor ( OdUInt32  color)
virtual

Sets the color method and color components for the database color object as an integer value.

Parameters
color[in] A packed 32-bits integer value that specifies the color method and color components.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

<link cm_color_integer.html, Color Functionality as an Integer-value>

Implements OdCmColorBase.

◆ setColorIndex()

virtual void OdCmColor::setColorIndex ( OdUInt16  colorIndex)
virtual

Sets the color index (ACI) of a some color palette and sets the color method to byACI for the database color object.

Parameters
colorIndex[in] An integer value that is the index of the color in a some palette.
Remarks
The color index can be a one of the following:

Value Description kACIbyBlock 0 Sets the color method to byBlock. kACIRed 1 Red. kACIYellow 2 Yellow. kACIGreen 3 Green. kACICyan 4 Cyan. kACIBlue 5 Blue. kACIMagenta 6 Magenta. kACIforeground 7 Sets the color method to Foreground. .. 8-255 Defined by display device. kACIbyLayer 256 Sets the color method to byLayer. kACInone 257 Sets the color method to None.

See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

<link cm_color_index.html, Color Functionality as an ACI-value>

Implements OdCmColorBase.

◆ setColorMethod()

virtual void OdCmColor::setColorMethod ( OdCmEntityColor::ColorMethod  colorMethod)
virtual

Sets the color method the database color object using a value of the ColorMethod enumeration.

Parameters
colorMethod[in] color method as the ColorMethod enumeration.
Remarks
The color method can be a one of the following:

Value Description kByLayer 0xC0 Color is specified by the layer object to which the object is resided. kByBlock 0xC1 Color is specified by the block object in which the object is contained. kByColor 0xC2 Color is specified by an RGB-value. kByACI 0xC3 Color is specified by an index (ACI) of a some color palette. kByPen 0xC4 Color is specified by an index into a pen color table. kForeground 0xC5 Color is foreground. kByDgnIndex 0xC7 Color is specified by an index into a dgn color table. kNone 0xC8 color is absent (object is clarity).

Remarks
Using of this method by third-party applications is neither supported nor recommended.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

Implements OdCmColorBase.

◆ setGreen()

virtual void OdCmColor::setGreen ( OdUInt8  green)
virtual

Sets the green color component for the database color object.

Parameters
green[in] Green component as an integer value in range 0 to 255.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_RGB.html, Color Functionality as an RGB-value>

Implements OdCmColorBase.

◆ setNames()

virtual bool OdCmColor::setNames ( const OdString colorName,
const OdString bookName = OdString::kEmpty 
)
virtual

Converts to the named color and sets the color name and book name for the database color object.

Parameters
colorName[in] Color name as a string value.
bookName[in] Book name as a string value.
Returns
Returns true if and only if successful. If the book name is an empty string that the method sets the UNNAMED name. If the color name is an empty string that the method ignores the specified values. If the book name and the color name are an empty string together that the method converts to the unnamed color.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_book.html, Color Functionality as a Book Name>

<link cm_color_integer.html, Color Functionality as an Integer-value>

Implements OdCmColorBase.

◆ setNamesFromDictionaryKey()

bool OdCmColor::setNamesFromDictionaryKey ( const OdString dictionaryKey)

Sets the book name and color name for the dictionary keyword.

Returns
Returns true if and only if successful. The dictionary key is the string that is the combination of the book name and color name joined by the dollar '$' symbol
Parameters
dictionaryKey[in] Dictionary keyword.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_book.html, Color Functionality as a Book Name>

◆ setRed()

virtual void OdCmColor::setRed ( OdUInt8  red)
virtual

Sets the red color component for the database color object.

Parameters
red[in] Red component as an integer value in range 0 to 255.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_RGB.html, Color Functionality as an RGB-value>

Implements OdCmColorBase.

◆ setRGB()

virtual void OdCmColor::setRGB ( OdUInt8  red,
OdUInt8  green,
OdUInt8  blue 
)
virtual

Sets the red, green, blue color components and the color method to byColor for the database color object.

Parameters
red[in] Red component as an integer value in range 0 to 255.
green[in] Green component as an integer value in range 0 to 255.
blue[in] Blue component as an integer value in range 0 to 255.
See also
<link cm_color_sample_base.html, Example of Working with the Database Color>
<link cm_color_method.html, Methods of the Color Definition>

<link cm_color_RGB.html, Color Functionality as an RGB-value>

Implements OdCmColorBase.

Member Data Documentation

◆ MaxColorIndex

TOOLKIT_EXPORT_STATIC const OdUInt16 OdCmColor::MaxColorIndex
static

Definition at line 269 of file CmColor.h.


The documentation for this class was generated from the following file: