You are on page 1of 1

CHAPTER 4: Graphics Graphic attributes 130

Solution

1. Acquire IGraphicStyleDescriptor by querying the interface on the page item.

2. Call the IGraphicStyleDescriptor::CreateDescriptorCopy method to get a list of attributes associated


with the graphic style and overrides. This list is of type IGraphicStyleAttributeBossList.

3. (Optional) Call IGraphicStyleAttributeBossList::GetAttributeCount to get the number of attributes on


the page item.

4. Call IGraphicStyleAttributeBossList::CreateAttributeNCopy to iterate through each attribute. To get


specific values of attributes, you must further query for the data interface (for example,
IGraphicAttrBoolean, IGraphicAttrRealNumber, IGraphicAttrInt16, IGraphicAttrInt32, and
IPersistUIDData).

Related APIs

 IGraphicsAttributeUtils

 IGraphicStyleAttributeBossList

 IGraphicStyleDescriptor

Clearing graphic attributes from a page item


You can clear specific graphic attributes from a page item's override list. For example, when a new
rendering attribute is changed, you need to remove the graphic attribute first, so the unused attribute
boss is released.

Solution

1. Call IGraphicStateUtils::CreateGfxClearOverrideCommand with the specific graphic attribute boss and


a list of page items. This creates an underlying kGfxClearAttrOverrideCmdBoss command.

2. Process the command.

Related APIs

 IGraphicStateUtils

 IGraphicStyleAttributeBossList

 kGfxClearAttrOverrideCmdBoss

Changing graphic attributes of the graphics state


You can change or set the graphic attributes of the graphics state.

NOTE: Changing graphic state is complex and should be avoided if possible.

You might also like