This is a more alternative image library, which itself does not provide for the Image object encapsulation, only in the form of similar plug-ins to provide you with image processing algorithm encapsulation and progress display, while the Image object encapsulation needs to be provided by the user. This image library platform is irrelevant, theoretically it can be applied to any existing C + + image class. (The specific principle see oneself flops: crazybit Development Notes (i): Design of the data structure and algorithm separation).
How to use
In order to use this image library, you must make some simple changes to the image class at hand (in view of the efficiency factor, I did not provide a virtual interface for everyone to inherit, but by allowing the user to modify the code to achieve it.) ):
1, from the existing image class (such as Cximage, Cdib ... ) Derive fcobjimage (I think your class is also called the probability of this name is lower than the probability of water on Mars).
2. You must implement the following functions in the Fcobjimage class (most of which are very simple to take property operations):
Prototype |
Function description |
Fcobjimage () |
Default constructor |
Fcobjimage (const Fcobjimage & IMG) |
Copy Constructors |
Fcobjimage & operator= (const fcobjimage & IMGSRC) |
Assignment operations |
BOOL isvalidimage () const |
Whether this image object is valid |
UINT16 colorbits () const |
Number of color digits of the image (1,4,8,16,24,32) |
DWORD GetPitch () const |
Number of bytes per line of image |
BYTE * getbits (int iline = 0) const |
Get the Iline line pointer, upper left corner (0,0), Top-down |
BYTE * getbits (int x, int y) const |
Gets the pointer to the (X,Y) point, the upper-left corner (0,0), Top-down, from left to right |
BOOL Isinside (int x, int y) const |
Coordinates (X,Y) inside the image |
int Width () const |
Wide |
int Height () const |
High |
BOOL Create (int iwidth, int iheight, WORD wcolorbit) |
Create an empty image |
static void Foocopypalette (Fcobjimage & dibdest, const Fcobjimage & DIBSRC) |
<=8bit Image Copy Palette |