SECImage Class

class SECImage: public CObject

SECImage is the abstract base class to the image classes. SECImage provides a common interface to access and manipulate image data which are maintained as unique file formats in the derived image classes. Using a common base class for the image format offers an advantage in being able to provide functionality for all image formats including image loading and saving, conversion between derived base classes, and image manipulation.

See the IMAGETST sample in the \\OT\\SAMPLES\\STANDARD\\IMAGES\\IMAGETST directory for a demonstration of this class.

Defined in: SECIMAGE.h

See Also

SECDib SECGif SECJpeg SECPcx SECTarga SECTiff

Class Members

Creation/Initialization

FOUNDATION_API SECImage()

Constructs a SECImage object.

FOUNDATION_API virtual BOOL CreatePalette()

Creates the image palette.

Attributes

FOUNDATION_API DWORD dwGetWidth() const

Returns the width of the current image.

FOUNDATION_API DWORD dwGetHeight() const

Returns the height of the current image.

Operations

FOUNDATION_API BOOL CopyImage(SECImage *pSrc)

Creates a duplicate of the current image.

FOUNDATION_API BOOL ConvertImage(SECImage *pSrc)

Converts from one derived image class to another.

FOUNDATION_API CBitmap* MakeBitmap(CDC *pDC, const TCHAR *lpszFileName)

Creates a CBitmap from the current image data.

FOUNDATION_API virtual BOOL LoadImage(CFile* pFile)

Creates a CBitmap from the current image data.

FOUNDATION_API virtual BOOL LoadImage(CFile* pFile)

Loads image data from an image file.

FOUNDATION_API virtual BOOL LoadImage(LPCTSTR lpszFileName)

Loads image data from an image file.

FOUNDATION_API virtual BOOL SaveImage(CFile* pFile)

Saves the current image to a file in the format of the derived image class.

FOUNDATION_API virtual BOOL SaveImage(LPCTSTR lpszFileName)

Saves the current image to a file in the format of the derived image class.

FOUNDATION_API BOOL FlipHorz()

Flips the image vertically.

FOUNDATION_API BOOL FlipVert()

Flips the image horizontally.

FOUNDATION_API BOOL Rotate90(BOOL bClockwise=TRUE)

Rotates the image 90 degrees and swaps the width and height parameters.

FOUNDATION_API void ContrastImage(short nSharpen)

Modifies the contrast of an image.

FOUNDATION_API BOOL Crop(long nLeft, long nTop, long nWidth, long nHeight)

Crops an image to the specified dimensions.

FOUNDATION_API DWORD NumBytes() const

Calculates number of bytes based on bits per pixel.

FOUNDATION_API WORD NumColors() const

Calculates number of colors in bitmap based on bit count.

FOUNDATION_API int StretchDIBits(CDC *pDC, int XDest, int YDest, int cxDest, int cyDest, int XSrc, int YSrc, int cxSrc, int cySrc, const void FAR* lpvBits, LPBITMAPINFO lpbmi, UINT fuColorUse, DWORD fdwRop)

Encapsulates the ::StretchDIBits() call.

FOUNDATION_API BOOL CreateFromBitmap(CDC *pDC, CBitmap *pSrcBitmap)

Fills in an SECImage instance with DIB info.

FOUNDATION_API static SECImage* ParseImage(LPCTSTR lpszPathName)

Static utility function that loads an image file into its appropriate SECImage class and returns the SECImage object.

FOUNDATION_API static SECImage* ParseImage(CFile* pFile)

Static utility function that loads an image file into its appropriate SECImage class and returns the SECImage object.

Overridable

FOUNDATION_API virtual BOOL PreLoadImage()

Called before an image is loaded.

FOUNDATION_API virtual BOOL PostLoadImage()

Called after an image is loaded.

FOUNDATION_API virtual BOOL PreSaveImage()

Called before an image is saved.

FOUNDATION_API virtual BOOL PostSaveImage()

Called after an image is saved.

FOUNDATION_API virtual BOOL DoSaveImage(CFile* pFile)

Saves the image to a file.

FOUNDATION_API virtual BOOL DoLoadImage(CFile* pFile)

Loads an image from a file.

Public data members

int m_nSrcBitsPerPixel

Number fo bits per pixel in the image.

int m_nSysBitsPerPixel

Number of bits per pixel in the current display.

int m_nBitPlanes

Number of bit planes.

BOOL m_bIsPadded

Indicates that the right margin has been padded to the nearest DWORD.

DWORD m_dwPadWidth

The width of the image after padding.

DWORD m_dwWidth

The width of the image in pixels.

DWORD m_dwHeight

The height of the image in pixels.

WORD m_wColors

The number of colors in the image.

WORD m_wSysColors

The number of colors in the current display.

CPalette* m_pPalette

A pointer to the palette for the image.

CFile* m_pFile

The file object used to load and save the image.

LPBYTE m_lpSrcBits

The image data (a flat buffer)

LPBITMAPINFO m_lpBMI

A pointer to the BITMAPINFO for this image.

LPRGBQUAD m_lpRGB

A pointer to an array of RGBQUAD data types that define the colors in the bitmap.

BOOL m_bUseHalftone

Indicates to use half tones.

int m_nBitHolder

Used for conversion of 4 or 1 bit per pixel images to 8 bpp.

DWORD m_dwBitCount

Used for conversion of 4 or 1 bit per pixel images to 8 bpp and greater.

DWORD m_dwError

Error message.

BOOL m_bSwapOnWrite

Flag to swap monochrome bytes when writing out. Default is TRUE;

Protected data members

DWORD m_dwCacheMax

Maximum number of bytes in file cache.

DWORD m_dwCacheSize

Size of current file cache in bytes.

DWORD m_dwCachePos

Current file cache position.

LPBYTE m_lpCache

The actual file cache array