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
Constructor.
CODImageComponent(const CODImageComponent& src)
Copy constructor.
virtual ~CODImageComponent()
Destructor.
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.
BOOL Create(UINT nID, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))
Creates the image component from a bitmap resource.
BOOL Create(CString strImagePath, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))
Creates the image component from a image file.
BOOL Create(CBitmap& bmp, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))
Creates the image component from a bitmap object.
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.
BOOL Load(UINT nID, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))
Loads the image component from a bitmap resource.
BOOL Load(CString strImagePath, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))
Loads the image component from a image file.
BOOL Load(CBitmap& bmp, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))
Loads the image component from a bitmap object.
BOOL Load(sfl::SECDib& dib, const BOOL bTransparent = FALSE, const COLORREF transColor = RGB(0,0,0))
Loads the image component from a DIB object.
CODImageComponent& operator=(const CODImageComponent& src)
Assignment operator: sets the component's attributes equal to that of the r-value component.
virtual CODComponent* Dup() const
Creates a copy of this component.
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.
virtual void AssignDefaultProperties(CODPropertySet* pDefaults = NULL)
Assign default properties.
void ForcePurge()
Forces purging the image component from cache.
BOOL GetTransparent() const
Gets the value of the image's transparency flag.
void SetTransparent(BOOL bTransparent)
Sets the value of the image's transparency flag.
COLORREF GetTransparentColor() const
Gets the value of the image's transparency color.
void SetTransparentColor(COLORREF clrTransparent)
Sets the value of the image's transparency color.
sfl::SECImage* GetImage()
Gets a pointer to the image object.
void CalculateBox()
Calculates the rectangle taken up by the image.
virtual void OnDraw(CDC* pDC)
Draws the image
virtual OD_MOVEVERTEX_RC CalculateMovedVertices(int nIndex, int nOffsetX, int nOffsetY)
Calculates the new position of a vertex given an offset.
virtual void Serialize(CArchive& ar)
Serializes the image component.
SFL_PROPERTY_MAP(CODImageComponent)
Returns the property map.