CODImageComponent Class

class CODImageComponent: public CODPointComponent

This class encapsulates a device-independent bitmap (DIB) as a component. Image components can be loaded from application resources, files, device-dependent bitmaps (DDBs), or other DIBs. Image components support transparency through the OD_PROP_TRANSPARENT and OD_PROP_TRANSPARENT_COLOR properties. Setting the OD_PROP_TRANSPARENT to TRUE enables transparency for the image component. The OD_PROP_TRANSPARENT_COLOR property determines which color in the image is made transparent.

The following properties are added to the component by this class:

OD_PROP_TRANSPARENT, OD_PROP_TRANSPARENT_COLOR

Defined in: OdImageComp.h

See Also

Component Property Identifiers

Class Members

VIEWS_API CODImageComponent()

Constructor.

VIEWS_API CODImageComponent(const CODImageComponent& src)

Copy constructor.

VIEWS_API virtual ~CODImageComponent()

Destructor.

VIEWS_API BOOL Create(UINT nID, CDC* pDC, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Creates the image component from a bitmap resource.

VIEWS_API BOOL Create(UINT nID, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Creates the image component from a bitmap resource.

VIEWS_API BOOL Create(CString strImagePath, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Creates the image component from a image file.

VIEWS_API BOOL Create(CBitmap& bmp, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Creates the image component from a bitmap object.

VIEWS_API BOOL Load(UINT nID, CDC* pDC, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Loads the image component from a bitmap resource.

VIEWS_API BOOL Load(UINT nID, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Loads the image component from a bitmap resource.

VIEWS_API BOOL Load(CString strImagePath, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Loads the image component from a image file.

VIEWS_API BOOL Load(CBitmap& bmp, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Loads the image component from a bitmap object.

VIEWS_API BOOL Load(sfl::SECDib& dib, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))

Loads the image component from a DIB object.

VIEWS_API CODImageComponent& operator=(const CODImageComponent& src)

Assignment operator: sets the component's attributes equal to that of the r-value component.

VIEWS_API virtual CODComponent* Dup() const

Creates a copy of this component.

VIEWS_API static CODImageCache m_imageCache

Static image cache.

CODImageEntryPtr m_pImage

Smart pointer to an image entry in cache.

CODSprite* m_pSprite

Pointer to sprite object for supporting transparency.

BOOL m_bIsIcon

Flag that indicates if image was loaded from an icon.

VIEWS_API virtual void AssignDefaultProperties(CODPropertySet* pDefaults = NULL)

Assign default properties.

VIEWS_API void ForcePurge()

Forces purging the image component from cache.

VIEWS_API BOOL GetTransparent() const

Gets the value of the image's transparency flag.

VIEWS_API void SetTransparent(BOOL bTransparent)

Sets the value of the image's transparency flag.

VIEWS_API COLORREF GetTransparentColor() const

Gets the value of the image's transparency color.

VIEWS_API void SetTransparentColor(COLORREF clrTransparent)

Sets the value of the image's transparency color.

VIEWS_API sfl::SECImage* GetImage()

Gets a pointer to the image object.

VIEWS_API void CalculateBox()

Calculates the rectangle taken up by the image.

VIEWS_API virtual void OnDraw(CDC* pDC)

Draws the image

VIEWS_API virtual OD_MOVEVERTEX_RC CalculateMovedVertices(int nIndex, int nOffsetX, int nOffsetY)

Calculates the new position of a vertex given an offset.

VIEWS_API virtual void Serialize(CArchive& ar)

Serializes the image component.

SFL_PROPERTY_MAP(CODImageComponent)

Returns the property map.