Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

Image Class Reference
[Images]

Generic image class. More...

#include <gmlimage.h>

Inheritance diagram for Image:

SmartObject GDIImage IntelImage SimpleImage List of all members.

Public Types

enum  FORMAT { F_L, F_RGB, F_RGBA, F_BGR }
enum  REPRES {
  R_BYTE, R_WORD, R_DWORD, R_FLOAT,
  R_DOUBLE
}
enum  ORIENT { O_TOPLEFT, O_BOTTOMLEFT }
 line order in the image More...


Public Member Functions

 Image ()
virtual ~Image ()
 Empty destructor.

 Image (Image &in_Image)
Imageoperator= (Image const &Orig)
bool const  operator== (Image const &Other)
virtual void Create (int Width, int Height, FORMAT format, REPRES repres, ORIENT orient=O_BOTTOMLEFT)
void CreateCopy (const Image &rSrImage)
 Creates a copy of rSrImage, converting color depth if nessesary.

bool CreateFromDIB (struct tagBITMAPINFO *in_pDIB, BYTE *in_pcData=NULL)
 Creates from a bitmap header.

void CreateFilteredCopy (const Image &rSrImage, const ImageFilter &rFilter)
void CreateComposition (const std::vector< Image * > &src, const ImageComposer &comp)
bool Created () const
void Clear ()
void ApplyFilter (const ImageFilter &filter)
 Applies a filter to the bitmap.

void Decompose (const ImageDecomposer &decomposer, std::vector< Image * > &out_res)
 Applies a decompositor to the bitmap.

bool ChangeOrientation (ORIENT new_orient)
 Change orientation of the image to new one.

bool ChangeFormat (FORMAT new_format)
 Change image format.

bool ChangeRepres (REPRES new_repres)
 Change image pixel representetion.

int GetWidth () const
int GetHeight () const
FORMAT GetFormat () const
REPRES GetRepres () const
ORIENT GetOrient () const
virtual long GetMemUsed ()=0
int GetElemSize () const
virtual long GetBytesPerLine () const =0
 Returns number of bytes used per line.

BYTE ** GetLineArray () const
 Returns pointer to an array containing the starting addresses of the bitmap lines.

virtual void Lock (bool bReadable, bool bWriteable)
virtual void Unlock ()
 Unlocks the Bitmap surface.

bool IsLocked () const
bool AlmostEqual (const Image &Bmp, int epsilon) const
void PaintImage (CDC *in_pDC, CPoint dst_org, CSize dst_size, DWORD dwRop=SRCCOPY)
virtual gml::DrawSurfaceGetDrawSurface ()=0

Static Public Member Functions

int Format2Channels (FORMAT f)
int Repres2Size (REPRES r)
int ElemSize (FORMAT f, REPRES r)

Protected Member Functions

virtual bool InternalCreate (int Width, int Height, FORMAT format, REPRES repres, ORIENT orient=O_BOTTOMLEFT)=0
virtual void FreeMembers ()=0
 Delete memory allocated by member variables.

virtual void InitLineArray ()=0
 Initialize internal table of line addresses.

void InternalCopy (const Image &rSrImage)
void InitLocals (int width, int height, FORMAT format, REPRES repres, ORIENT orient=O_BOTTOMLEFT)
 Can be called from internalCreate() to initialize object state.

virtual void InternalChangeOrientation (ORIENT new_orient)=0

Protected Attributes

int m_width
int m_height
bool m_created
FORMAT m_format
REPRES m_repres
ORIENT m_orient
 current orientation order

BYTE ** m_line_array
 Table of the starting addresses of the lines.

int m_lock_count
 Number of times the bitmap was locked.


Detailed Description

Generic image class.

Some functionality should be defined in children


Member Enumeration Documentation

enum ORIENT
 

line order in the image

Enumeration values:
O_TOPLEFT  lines are going left-right, top-bottom
O_BOTTOMLEFT  lines are left-right, bottom-top


Constructor & Destructor Documentation

Image  ) 
 

Empty constructor. Constructors in derived classes create a small empty bitmap to ensure that the object is always in a sane state.


Member Function Documentation

bool const operator== Image const &  Other  ) 
 

Test for equality. This function actually tests every pixel, so it's not fast. It's meant mainly for use in asserts and such.

virtual void Create int  Width,
int  Height,
FORMAT  format,
REPRES  repres,
ORIENT  orient = O_BOTTOMLEFT
[virtual]
 

Creates a new empty bitmap. Memory for the bits is allocated but not initialized. Previous contents of the bitmap object are discarded

bool CreateFromDIB struct tagBITMAPINFO *  in_pDIB,
BYTE *  in_pcData = NULL
 

Creates from a bitmap header.

Parameters:
in_pDIB Указатель на BITMAPINFO (хранилище свойств DIB'а)
in_pcData Указатель на пиксельные bitmap данные. Если установлен в NULL - считается, что данные располагаются сразу за BITMAPINFO

void CreateFilteredCopy const Image rSrImage,
const ImageFilter rFilter
 

Creates a copy of rSrImage, applying rFilter on the way. Depending on the filter called, this is often much faster than CreateCopy() followed by ApplyFilter().

bool ChangeOrientation ORIENT  new_orient  ) 
 

Change orientation of the image to new one.

Note:
if it already set, nothing will changed

bool ChangeFormat FORMAT  new_format  ) 
 

Change image format.

Note:
if it already set, nothing will changed, currently implemented only for RGB <-> BGR change

bool ChangeRepres REPRES  new_repres  ) 
 

Change image pixel representetion.

Note:
if it already set, nothing will changed

virtual void Lock bool  bReadable,
bool  bWriteable
[virtual]
 

Locks bitmap. GetLineArray() and other direct-access methods should only be called if the bitmap is locked. Lock and Unlock keep a lock count.

virtual bool InternalCreate int  Width,
int  Height,
FORMAT  format,
REPRES  repres,
ORIENT  orient = O_BOTTOMLEFT
[protected, pure virtual]
 

Create a new bitmap with uninitialized bits. (Assume no memory is allocated yet.)

Implemented in GDIImage, IntelImage, and SimpleImage.

void InternalCopy const Image rSrImage  )  [protected]
 

Creates a new Image as copy of rSrImage. Assumes there is no memory allocated yet.

virtual void InternalChangeOrientation ORIENT  new_orient  )  [protected, pure virtual]
 

Change image orientation to given state

Warning:
you should set m_orient variable after actual operation

Implemented in GDIImage, IntelImage, and SimpleImage.


Member Data Documentation

int m_lock_count [protected]
 

Number of times the bitmap was locked.

Default is m_LockCount always >= 1, so access to bits is always possible.


The documentation for this class was generated from the following file:
Generated on Tue Jan 13 21:12:05 2004 for Graphics and Media Lab CSL by doxygen 1.3.4