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
SECDibSECGif SECJpegSECPcxSECTargaSECTiff
Class Members
Creation/Initialization
SECImage()
Constructs a SECImage object.
virtual BOOL CreatePalette()
Creates the image palette.
Attributes
DWORD dwGetWidth() const
Returns the width of the current image.
DWORD dwGetHeight() const
Returns the height of the current image.
Operations
BOOL CopyImage(SECImage *pSrc)
Creates a duplicate of the current image.
BOOL ConvertImage(SECImage *pSrc)
Converts from one derived image class to another.
CBitmap* MakeBitmap(CDC *pDC, const TCHAR *lpszFileName)
Creates a CBitmap from the current image data.
virtual BOOL LoadImage(CFile* pFile)
Creates a CBitmap from the current image data.
virtual BOOL LoadImage(CFile* pFile)
Loads image data from an image file.
virtual BOOL LoadImage(LPCTSTR lpszFileName)
Loads image data from an image file.
virtual BOOL SaveImage(CFile* pFile)
Saves the current image to a file in the format of the derived image class.
virtual BOOL SaveImage(LPCTSTR lpszFileName)
Saves the current image to a file in the format of the derived image class.
BOOL FlipHorz()
Flips the image vertically.
BOOL FlipVert()
Flips the image horizontally.
BOOL Rotate90(BOOL bClockwise=TRUE)
Rotates the image 90 degrees and swaps the width and height parameters.
void ContrastImage(short nSharpen)
Modifies the contrast of an image.
BOOL Crop(long nLeft, long nTop, long nWidth, long nHeight)
Crops an image to the specified dimensions.
DWORD NumBytes() const
Calculates number of bytes based on bits per pixel.
WORD NumColors() const
Calculates number of colors in bitmap based on bit count.
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.
BOOL CreateFromBitmap(CDC *pDC, CBitmap *pSrcBitmap)
Fills in an SECImage instance with DIB info.
static SECImage* ParseImage(LPCTSTR lpszPathName)
Static utility function that loads an image file into its appropriate SECImage class and returns the SECImage object.
static SECImage* ParseImage(CFile* pFile)
Static utility function that loads an image file into its appropriate SECImage class and returns the SECImage object.
Overridable
virtual BOOL PreLoadImage()
Called before an image is loaded.
virtual BOOL PostLoadImage()
Called after an image is loaded.
virtual BOOL PreSaveImage()
Called before an image is saved.
virtual BOOL PostSaveImage()
Called after an image is saved.
virtual BOOL DoSaveImage(CFile* pFile)
Saves the image to a file.
virtual BOOL DoLoadImage(CFile* pFile)
Loads an image from a file.
Public data members
Number fo bits per pixel in the image.
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