[ROOT] --> System

class Dib24

Device independent 24 bit bitmap.

This class provides a simplified interface to a Windows 24-bit Device Independent Bitmap (DIB). Since the bitmap is kept in memory it can be manipulated directly, without having to pass thru GDI for the most common functions, such as getPixel() or setPixel(). Even if only a very limited interface is provided, it is still possible to obtain a handle to the bitmap, via the getHandle() function, and use standard GDI calls to perform unsupported functions.

Author:
Alessandro Scotti

Source:
dib24.h:38

Constructors Index

Dib24
[public] Creates a bitmap of the specified size.
Dib24
[public] Copy constructor.
~Dib24
[public] Destructor.


Methods Index

clear
[public] Clears the bitmap, filling it with black.
copy
[public] Copies the bitmap into a device context.
getHandle
[public] Returns the handle of the bitmap device context.
getPixel
[public] Returns the color of the specified pixel.
getPixelFast
[public] Returns the color of the specified pixel.
setPixel
[public] Sets the color of the specified pixel.
setPixelFast
[public] Sets the color of the specified pixel.
stretch
[public] Stretch-copies the bitmap into a device context.


Constructors

Dib24

public Dib24 ( int width ,
               int height ) ;

Creates a bitmap of the specified size.

Parameters:
width width of bitmap in pixels
height height of bitmap in pixels

Dib24

public Dib24 ( const Dib24 & ) ;

Copy constructor.

Dib24

public virtual ~ Dib24 ( ) ;

Destructor.


Methods

clear

public void clear ( ) ;

Clears the bitmap, filling it with black.

stretch

public void stretch ( HDC hdc ,
                      int x ,
                      int y ,
                      int width ,
                      int height ) ;

Stretch-copies the bitmap into a device context.

See Also:
copy

Parameters:
hdc handle of device context where bitmap will be copied
x x coordinate of upper left corner of destination rectangle
y y coordinate of upper left corner of destination rectangle
width width of destination rectangle
height height of destination rectangle

copy

public void copy ( HDC hdc ,
                   int x ,
                   int y ) ;

Copies the bitmap into a device context.

The destination rectangle has the same size as the bitmap. If a different size is required the stretch() functions should be used instead.

See Also:
stretch

Parameters:
hdc handle of device context where bitmap will be copied
x x coordinate of upper left corner of destination rectangle
y y coordinate of upper left corner of destination rectangle

getPixelFast

public DWORD getPixelFast ( int x ,
                            int y ) const ;

Returns the color of the specified pixel.

Note: this is a faster but unsafe version of getPixel(). If there is a chance that x or y are out of range then getPixel() should be used.

See Also:
getPixel

Parameters:
x x coordinate of pixel
y y coordinate of pixel

Return:
color of specified pixel

setPixelFast

public void setPixelFast ( int x ,
                           int y ,
                           DWORD value ) ;

Sets the color of the specified pixel.

Note: this is a faster but unsafe version of setPixel(). If there is a chance that x or y are out of range then setPixel() should be used.

See Also:
setPixel

Parameters:
x x coordinate of pixel
y y coordinate of pixel
color color to set for specified pixel

getPixel

public DWORD getPixel ( int x ,
                        int y ) const ;

Returns the color of the specified pixel.

See Also:
getPixelFast

Parameters:
x x coordinate of pixel
y y coordinate of pixel

Return:
color of specified pixel or zero (black) if pixel coordinates are invalid

setPixel

public void setPixel ( int x ,
                       int y ,
                       DWORD value ) ;

Sets the color of the specified pixel.

See Also:
setPixelFast

Parameters:
x x coordinate of pixel
y y coordinate of pixel
color color to set for specified pixel

getHandle

public HDC getHandle ( ) ;

Returns the handle of the bitmap device context.

This handle may be used in all the GDI calls that require a device context.

Return:
handle of bitmap device context

This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.

Click here to return to the top of the page.