Image Viewer for
Windows® CE 3.0
Code Review
By:
David Klajn
Ronny Tuttnauer
Supervisors:
Alexander Arlievsky
Lev Rechnik
Technion - Israel Institute of Technology
Faculty of Electrical Engineering
Software Systems Lab
ImageViewer Hierarchical Index
ImageViewer Class Hierarchy
This inheritance list is sorted roughly, but not completely, alphabetically:
_PgmHeader
_TgaHeader
_tiff_helper
C2PassScale< FilterClass, DataClass >...... 8
CAboutDlg
CAppOptions...... 13
CBmp...... 17
CAnyBmp...... 9
CWinBmp...... 153
CDIBSection...... 34
CWinBmpEx
CContrastDlg...... 26
CCopyMoveDlg...... 27
CCropFilterDlg...... 28
CDataPaintLib32...... 29
CDataPaintLib32::_Accumulator
CDataRGB_UBYTE
CDataRGB_UBYTE::_Accumulator
CDataRGBA_UBYTE
CDataRGBA_UBYTE::_Accumulator
CDataSink...... 30
CFileSink...... 68
CDataSource...... 32
CFileSource...... 69
CMemSource...... 114
CResourceSource...... 136
CDIBSectionLite...... 37
CDibSequence...... 62
CDIBStatic...... 64
CDitherDialog...... 65
CDocManagerEx...... 67
CFilter...... 70
CFilterContrast...... 72
CFilterCrop...... 74
CFilterGetAlpha...... 76
CFilterGrayscale...... 77
CFilterIntensity...... 78
CFilterLightness...... 79
CFilterQuantize...... 80
CFilterResize...... 83
CFilterResizeBilinear...... 84
CFilterResizeBox...... 85
CFilterResizeGaussian...... 86
CFilterResizeHamming...... 87
CFilterRotate...... 88
CFilterThreshold...... 89
CVideoInvertFilter...... 152
CFilterDialog...... 75
CFilterQuantize::tagHISTONODE
CFilterQuantize::tagQUBOX...... 82
CGenericFilter...... 91
CBilinearFilter...... 15
CBlackmanFilter...... 16
CBoxFilter...... 25
CGaussianFilter...... 90
CHammingFilter...... 93
CHandTracker...... 94
CImageViewerApp...... 95
CIntensityDlg...... 106
CLightnessDlg...... 111
CMainFrame...... 112
ContributionType...... 115
COptionsPage1...... 116
COptionsPage2...... 117
COptionsPage3...... 118
CPalViewDlg...... 119
CPicDecoder...... 123
CAnyPicDecoder...... 11
CBmpDecoder...... 21
CGIFDecoder...... 92
CJPEGDecoder...... 107
CPCXDecoder...... 120
CPGMDecoder...... 121
CPictDecoder...... 128
CPNGDecoder...... 131
CTGADecoder...... 140
CTIFFDecoder...... 146
CPicEncoder...... 126
CBmpEncoder...... 24
CJPEGEncoder...... 109
CPNGEncoder...... 133
CTIFFEncoder...... 148
CTIFFEncoderEx...... 149
CPixel32...... 130
CPreviewFileDlg...... 134
CRenameFileDlg...... 135
CRotateDlg...... 137
CTextException...... 138
CThresholdDlg...... 145
CTimestampDlg...... 151
CZoomView...... 157
CImageViewerView...... 101
datasink_dest_mgr
DIBINFO...... 161
IProgressNotification...... 162
CImageViewerDoc...... 97
LineContribType...... 163
MacPattern
MacpixMap
MacPoint
MacRect
MacRGBColour
MemSrcTIFFInfo
OpDef...... 164
PALETTEINFO
tagPCXHEADER...... 165
tagWINBITMAPFILEHEADER
tagWINBITMAPINFO
tagWINBITMAPINFOHEADER
tagWINRGBQUAD
1
ImageViewer Compound Index
ImageViewer Compound List
Here are the classes, structs, unions and interfaces with brief descriptions:
C2PassScale< FilterClass, DataClass > (Used to scale an image using a 2 pass method)...... 8
CAnyBmp (Manipulates uncompressed device- and platform-independent bitmaps)...... 9
CAnyPicDecoder (Class which decodes pictures with any known format. It)...... 11
CAppOptions (Holds user defined options for operating the application)...... 13
CBilinearFilter (Defines a bilinear filter)...... 15
CBlackmanFilter (Defines a Blackmann filter)...... 16
CBmp (Device- and OS-independent bitmap class. Manipulates uncompressed bitmaps of all color depths) 17
CBmpDecoder (Windows bitmap file decoder. Decodes bitmap files (compressed and uncompressed) of all bit depths. Returns an 8 or 32 bpp bitmap) 21
CBmpEncoder (BMP file encoder)...... 24
CBoxFilter (Defines a box filter)...... 25
CContrastDlg (This dialog interfaces between the user's input and the CFilterContrast class).26
CCopyMoveDlg (This class is used to rename or copy the current image)...... 27
CCropFilterDlg (Uses CFilterCrop in order to extract a part of the image)...... 28
CDataPaintLib32 (Helper Class for the Resample-Filter templates)...... 29
CDataSink (This is a base class for a destination of picture data)...... 30
CDataSource (This is a base class for a source of picture data. It defines methods to open, close, and read from data sources. Does byte-order-conversions in the ReadByte, ReadWord, and ReadLong routines) 32
CDIBSection (This is a windows DIBSection wrapped in a CBmp-derived class)...... 34
CDIBSectionLite (CDIBSectionLite is DIBSection wrapper class for win32 and WinCE platforms) 37
CDibSequence (This class implements the slide show mechanism of ImageViewer)...... 62
CDIBStatic (This class is used to display a static DIB (in a preview dialog etc.))...... 64
CDitherDialog (This dialog interfaces between the user's input and the CFilterQuantize class)65
CDocManagerEx (This class replaces the default CDocManager class provided by MFC. It is used to show an image preview pane inside the file open dialog) 67
CFileSink (This is a class which takes a file as a destination of picture data)...... 68
CFileSource (This is a class which takes a file as a source of picture data)...... 69
CFilter (Base class for filters that operate on bitmaps. Derived classes need to override either the ApplyInPlace or the Apply function) 70
CFilterContrast (Enhances or reduces the image contrast using a linear mapping between input and output) 72
CFilterCrop (Filter that cuts part of the image off)...... 74
CFilterDialog (This dialog interfaces between the user's input and the CFilterResizeBilinear/ CFilterResizeBox/CFilterResizeGaussian/CFilterResizeHamming) 75
CFilterGetAlpha (Returns an 8 bpp grayscale bitmap containing only the alpha channel of the source bitmap) 76
CFilterGrayscale (Creates a grayscale version of the bitmap)...... 77
CFilterIntensity (Changes the intensity of a bitmap image)...... 78
CFilterLightness (Filter that changes the lightness of a bitmap image)...... 79
CFilterQuantize (Returns an 8 bpp bitmap containing a best-fit representation of the source 32 bpp bitmap) 80
CFilterQuantize::tagQUBOX (Local structs defining the quantization buffer)...... 82
CFilterResize (Base class for filters that resize the image)...... 83
CFilterResizeBilinear (Resizes a bitmap using bilinear interpolation)...... 84
CFilterResizeBox (Resizes a bitmap and applies a box filter to it)...... 85
CFilterResizeGaussian (Resizes a bitmap and applies a gaussian blur to it)...... 86
CFilterResizeHamming (Resizes a bitmap and applies a hamming filter to it)...... 87
CFilterRotate (Rotates a bitmap by angle radians)...... 88
CFilterThreshold (Returns an 8 bpp grayscale bitmap)...... 89
CGaussianFilter (Defines a Gaussian filter)...... 90
CGenericFilter (Base class for alll types of filters)...... 91
CGIFDecoder (This class implements the GIF decoder for the application)...... 92
CHammingFilter (Defines a Hamming filter)...... 93
CHandTracker (This class implemets the rubber band hand mechanism for panning images).94
CImageViewerApp (This is the project's main application class)...... 95
CImageViewerDoc (This is the application document object)...... 97
CImageViewerView (This is the application frame view object)...... 101
CIntensityDlg (This dialog interfaces between the user's input and the intensity filter).....106
CJPEGDecoder (JPEG file decoder. Uses the independent JPEG group's library to do the actual conversion) 107
CJPEGEncoder (JPEG file encoder. Uses the independent JPEG group's library to do the actual conversion) 109
CLightnessDlg (This dialog interfaces between the user's input and the lightness filter)....111
CMainFrame (Functionality of a Windows single document interface (SDI))...... 112
CMemSource (This is a class which takes a memory pointer as a source of picture data)...114
ContributionType (Contirbution information for a single pixel)...... 115
COptionsPage1 (This class implements the first page of ImageViewer options tabbed panes. This page represents the Viewer properties) 116
COptionsPage2 (This class implements the second page of ImageViewer options tabbed panes. This page represents the Slide Show properties) 117
COptionsPage3 (This class implements the third page of ImageViewer options tabbed panes. This page represents the filing (as in "file") properties) 118
CPalViewDlg (This class implements a dialog that displays the current image palette. It contains a 16x16 color matrix, in which each element represents a single palette color) 119
CPCXDecoder (PCX file decoder. Decodes 8, 15, 16, 24 and 32 bpp PCX files (compressed and uncompressed) and returns an 8 or 32 bpp CBitmap. Preserves the alpha channel) 120
CPGMDecoder (Portable Graymap file decoder. Delivers an 8 bpp grayscale image)...... 121
CPicDecoder (CPicDecoder is an abstract base class. It defines common routines for all decoders) 123
CPicEncoder (CPicEncoder is an abstract base class. It defines common routines for all encoders. Encoders for specific file formats can be derived from this class. Objects of this class interact with a CDataSink to encode bitmaps) 126
CPictDecoder (This class decodes macintosh PICT files with 1,2,4,8,16 and 32 bits per pixel as well as PICT/JPEG) 128
CPixel32 (32 bit pixel class. A pixel in this class contains 8 bits each of)...... 130
CPNGDecoder (PNG file decoder. Uses LibPng to do the actual decoding)...... 131
CPNGEncoder (PNG file encoder. Uses LIBPNG to do the actual conversion)...... 133
CPreviewFileDlg (This dialog replaces the good old MFC's CFileDialog. It adds a preview pane for a chosen image in list) 134
CRenameFileDlg (This class implements the file renaming dialog)...... 135
CResourceSource (This is a class which takes a windows resource as a source of picture data) 136
CRotateDlg (This dialog interfaces between the user's input and the rotate filter)...... 137
CTextException (An object of this class is thrown by other classes when an error occurs)...138
CTGADecoder (Targa file decoder. Decodes 8, 15, 16, 24 and 32 bpp targa files (compressed and uncompressed) and returns an 8 or 32 bpp CBitmap. Preserves the alpha channel) 140
CThresholdDlg (This dialog interfaces between the user's input and the threshold filter)...145
CTIFFDecoder (TIFF file decoder. Uses LIBTIFF to do the actual conversion. Supports 1, 8 and 24 bits per pixel as output formats) 146
CTIFFEncoder (TIFF file encoder. Uses LIBTIFF to do the actual conversion)...... 148
CTIFFEncoderEx (CTIFFEncoder is provided in order to have greater compress/data control) 149
CTimestampDlg (This dialog implements the Change Timestamp feature of a given image filename) 151
CVideoInvertFilter (This filter inverts a given CBmp. Only works for 32 bpp bitmaps at the moment) 152
CWinBmp (This is the windows version of CBmp)...... 153
CZoomView (This is the application zoom frame view object. It can handle various zooming procedures such as: zooming in, zooming out, box zooming etc) 157
DIBINFO (Holds DIB information)...... 161
IProgressNotification (Used to implement a progress indicator when opening image files)...162
LineContribType (Contribution information for an entire line (row or column))...... 163
OpDef (Table of the first 200 or so PICT opcodes with size & description. Mostly stolen from pict2pbm. I hope they don't mind) 164
tagPCXHEADER (PCX Image File)...... 165
1
ImageViewer Class Documentation
C2PassScale Class Template Reference
Used to scale an image using a 2 pass method.
#include <2PassScale.h>
Public Types
- typedef DataClass::_DataType _DataType
- typedef DataClass::_RowType _RowType
Public Methods
- C2PassScale (double Radius, ProgressAnbAbortCallBack callback=NULL)
- virtual ~C2PassScale ()
- _RowType * Scale (_RowType *pOrigImage, UINT uOrigWidth, UINT uOrigHeight, _RowType *pDstImage, UINT uNewWidth, UINT uNewHeight)
Private Methods
- LineContribType * AllocContributions (UINT uLineLength, UINT uWindowSize)
- void FreeContributions (LineContribType *p)
- LineContribType * CalcContributions (UINT uLineSize, UINT uSrcSize, double dScale)
- void ScaleRow (_RowType *pSrc, UINT uSrcWidth, _RowType *pRes, UINT uResWidth, UINT uRow, LineContribType *Contrib)
- void HorizScale (_RowType *pSrc, UINT uSrcWidth, UINT uSrcHeight, _RowType *pDst, UINT uResWidth, UINT uResHeight)
- void ScaleCol (_RowType *pSrc, UINT uSrcWidth, _RowType *pRes, UINT uResWidth, UINT uResHeight, UINT uCol, LineContribType *Contrib)
- void VertScale (_RowType *pSrc, UINT uSrcWidth, UINT uSrcHeight, _RowType *pDst, UINT uResWidth, UINT uResHeight)
Private Attributes
- ProgressAnbAbortCallBack m_Callback
- BOOL m_bCanceled
- double m_Radius
template<class FilterClass, class DataClass> class C2PassScale< FilterClass, DataClass >
The documentation for this class was generated from the following file:
- 2PassScale.h
1
CAnyBmp Class Reference
Manipulates uncompressed device- and platform-independent bitmaps.
#include <AnyBmp.h>
Inheritance diagram for CAnyBmp:
Public Methods
- CAnyBmp ()
Creates an empty bitmap.
- virtual ~CAnyBmp ()
Destroys the bitmap.
- CAnyBmp (const CBmp &Orig)
Copy constructor.
- CAnyBmp (const CAnyBmp &Orig)
Copy constructor.
- CAnyBmp & operator= (CBmp const &Orig)
Assignment operator.
- long GetMemUsed ()
Returns the amount of memory used by the object.
- long GetBytesPerLine ()
Returns number of bytes used per line.
Static Public Methods
- long GetMemNeeded (LONG width, LONG height, WORD BitsPerPixel)
Returns memory needed by a bitmap with the specified attributes.
- long GetBitsMemNeeded (LONG width, LONG height, WORD BitsPerPixel)
Returns memory needed by bitmap bits.
Protected Methods
- virtual void internalCreate (LONG Width, LONG Height, WORD BitsPerPixel, BOOL bAlphaChannel)
Create a new bitmap with uninitialized bits. (Assume no memory is allocated yet.).
- virtual void freeMembers ()
Delete memory allocated by member variables.
- virtual void initLineArray ()
Initialize internal table of line addresses.
Protected Attributes
- BYTE * m_pBits
The documentation for this class was generated from the following files:
- AnyBmp.h
- AnyBmp.cpp
1
CAnyPicDecoder Class Reference
Class which decodes pictures with any known format. It.
#include <AnyPicDecoder.h>
Inheritance diagram for CAnyPicDecoder:
Public Methods
- CAnyPicDecoder ()
Creates a decoder.
- ~CAnyPicDecoder ()
Destroys the decoder.
- void MakeBmp (CDataSource *pDataSrc, CBmp *pBmp, int BPPWanted)
Decodes a picture in a block of memory.
Private Methods
- int getFileType (BYTE *pData, int DataLen)
Check for file-format-specific data & return the file type if something fits.
- long epsLongVal (unsigned char *p)
Private Attributes
- CBmpDecoder * m_pBmpDec
- CPictDecoder * m_pPictDec
- CTGADecoder * m_pTGADec
- CTIFFDecoder * m_pTIFFDec
- CJPEGDecoder * m_pJPEGDec
- CPNGDecoder * m_pPNGDec
- CPCXDecoder * m_pPCXDec
- CPGMDecoder * m_pPGMDec
- CGIFDecoder * m_pGIFDec
Detailed Description
Class which decodes pictures with any known format. It auto-detects the format to use and delegates the work to one of the other decoder classes.
The interface to CAnyPicDecoder is the same as CPicDecoder.
Definition at line 67 of file AnyPicDecoder.h.
The documentation for this class was generated from the following files:
- AnyPicDecoder.h
- AnyPicDecoder.cpp
1
CAppOptions Class Reference
Holds user defined options for operating the application.
#include <AppOptions.h>
Public Methods
- CAppOptions ()
- virtual ~CAppOptions ()
Public Attributes
- BOOL m_bViewAllImages
View all images in current folder when user chooses a file.
- BOOL m_bExitAfterDelete
Exit after a delete/move procedure.
- BOOL m_bViewFullFilePath
View full file path in status bar.
- BOOL m_bViewMenu
View menu.
- BOOL m_bViewStatusBar
View status bar.
- BOOL m_bViewToolBar
View tool bar.
- UINT m_nDelay
Slide show delay between images.
- int m_iSlideShowSequence
- BOOL m_bSlideShowWrap
Go to first image when reaching end of slide show1.
- CString m_strSeparator
A char to be used as a separator when using auto-rename.
- int m_iMoveCopyConfirm
- BOOL m_bNoConfirm
Delete a file without confirmation.
- BOOL m_bNoRecycleBin
Don't use the recycle bin when deleting.
- BOOL m_bSkipIdentical
When copying/moving duplicate file, skip identical.
Member Data Documentation
int CAppOptions::m_iMoveCopyConfirm
When copying/moving duplicate files:
- Replace (0)
- Ask (1)
Definition at line 52 of file AppOptions.h.
int CAppOptions::m_iSlideShowSequence
Slide show advancing method:
- Forward (0)
- Reverse (1)
- Random (2)
Definition at line 41 of file AppOptions.h.
The documentation for this class was generated from the following files:
- AppOptions.h
- AppOptions.cpp
1
CBilinearFilter Class Reference
Defines a bilinear filter.
#include <2PSFilters.h>
Inheritance diagram for CBilinearFilter:
Public Methods
- CBilinearFilter (double dWidth=1.0)
- virtual ~CBilinearFilter ()
- virtual double Filter (double dVal)
Pure virtual function - implements the filter operation.
The documentation for this class was generated from the following file:
- 2PSFilters.h
1
CBlackmanFilter Class Reference
Defines a Blackmann filter.
#include <2PSFilters.h>
Inheritance diagram for CBlackmanFilter:
Public Methods
- CBlackmanFilter (double dWidth=0.5)
- virtual ~CBlackmanFilter ()
- virtual double Filter (double dVal)
Pure virtual function - implements the filter operation.
The documentation for this class was generated from the following file:
- 2PSFilters.h
1
CBmp Class Reference
Device- and OS-independent bitmap class. Manipulates uncompressed bitmaps of all color depths.
#include <Bmp.h>
Inheritance diagram for CBmp:
Public Methods
- CBmp ()
Empty constructor. Constructors in derived classes create a small empty bitmap to ensure that the object is always in a sane state.
- virtual ~CBmp ()
Empty destructor.
- CBmp & operator= (CBmp const &Orig)
Assignment operator. Note that assignment between different derived classes is possible and results in a format conversion.
- bool const operator== (CBmp const &Other)
Test for equality. This functions actually tests every pixel, so it's not fast. It's meant mainly for use in asserts and such.
- virtual void Create (LONG Width, LONG Height, WORD BitsPerPixel, BOOL bAlphaChannel)
Creates a new empty bitmap. Memory for the bits is allocated but not initialized. Previous contents of the bitmap object are discarded. If bAlphaChannel is true, the bitmap is assumed to contain a valid alpha channel.
- void CreateCopy (const CBmp &rSrcBmp, int BPPWanted=0)
Creates a copy of rSrcBmp, converting color depth if nessesary. Supports 1, 8 and 32 BPP. Alpha channel information is preserved.
- void CreateGrayscaleCopy (CBmp &rSrcBmp)
Creates a copy of rSrcBmp, converting color information to grayscale in the process. The resulting bitmap is an 8-bit bitmap.
- void CreateRotatedCopy (CBmp &rSrcBmp, double angle, CPixel32 color)
- CPoint CreateRotatedCopyPoint (CBmp &rSrcBmp, double angle, CPixel32 color, CPoint Point, CPoint Pos)
Rotates bitmap around Point. Pos is the current upper-left corner of the bitmap. Returns the new position of the upper-left corner.
- void CreateFromAlphaChannel (CBmp &rSrcBmp)
Creates a bitmap containing only the alpha channel of rSrcBmp.
- void CreateResizedBilinear (CBmp &rSrcBmp, int NewXSize, int NewYSize)
- void CreateResizedBox (CBmp &rSrcBmp, int NewXSize, int NewYSize, double NewRadius)
- void CreateResizedGaussian (CBmp &rSrcBmp, int NewXSize, int NewYSize, double NewRadius)
- void CreateResizedHamming (CBmp &rSrcBmp, int NewXSize, int NewYSize, double NewRadius)
- void CreateCropped (CBmp &rSrcBmp, int XMin, int XMax, int YMin, int YMax)
- void SetQuantizationMode (int DitherType, int DitherPaletteType)
Sets quality of conversion to 8 bpp. Valid parameters are defined in FilterQuantize.h.
- void SetGrayPalette ()
Fills the color table with a grayscale palette. This function is only useable for bitmaps containing a color table. Index 0 contains black (0) and the last index contains white (255). The alpha channel is set to opaque (255) for every palette entry.
- void SetPalette (CPixel32 *pPal)
Sets the color table to pPal. The contents or pPal are copied.
- void SetPaletteEntry (BYTE Entry, BYTE r, BYTE g, BYTE b, BYTE a)
Sets one entry in the color table. The function may only be called if there is a color table stored with the bitmap. The color table entry is set to the red, green, blue, and alpha values specified.
- void SetAlphaChannel (CBmp *pAlphaBmp)
Replaces the alpha channel of the bitmap with a new one. This only works for bitmaps with 32 bpp. pAlphaBmp must point to an 8 bpp bitmap with the same dimensions as the object. The alpha channel information is physically copied into the bitmap.
- void ResizeBilinear (int NewXSize, int NewYSize)
- void ResizeBox (int NewXSize, int NewYSize, double NewRadius)
- void ResizeGaussian (int NewXSize, int NewYSize, double NewRadius)
- void ResizeHamming (int NewXSize, int NewYSize, double NewRadius)
- void Crop (int XMin, int XMax, int YMin, int YMax)
- void Threshold (int threshold_min, int threshold_max, int channel)
- void MakeGrayscale ()
- void Rotate (double angle, CPixel32 color)
- void Invert ()
- void SetPixel (int x, int y, CPixel32 pixel)
Slow but simple function to set a single pixel. 32 bpp only.
- CPixel32GetPixel (int x, int y)
Slow but simple function to get a single pixel. 32 bpp only.
- BYTE FindNearestColor (CPixel32 cr)
Find the nearest color to cr in the palette used by this bitmap Only works for 8 bpp bitmaps.
- int GetWidth () const
- int GetHeight () const
- virtual long GetMemUsed ()=0
- int GetNumColors ()
- int GetBitsPerPixel () const
- BOOL HasAlpha () const
- void SetHasAlpha (BOOL b)
- virtual long GetBytesPerLine ()=0
Returns number of bytes used per line.
- CPixel32 * GetPalette () const
Returns the address of the color table of the bitmap or NULL if no color table exists. The color table is stored as an array of consecutive CPixel32 objects.