Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Public Attributes | List of all members
vtDIB Class Reference

#include <vtDIB.h>

Inheritance diagram for vtDIB:
vtBitmapBase AttribMap

Public Member Functions

 vtDIB ()
 
 vtDIB (void *pDIB)
 
bool Create (int width, int height, int bitdepth, bool create_palette=false)
 
bool Create24From8bit (const vtDIB &from)
 
bool Read (const char *fname, bool progress_callback(int)=NULL)
 
bool ReadBMP (const char *fname, bool progress_callback(int)=NULL)
 
bool ReadJPEG (const char *fname, bool progress_callback(int)=NULL)
 
bool ReadPNG (const char *fname, bool progress_callback(int)=NULL)
 
bool WriteBMP (const char *fname)
 
bool WriteJPEG (const char *fname, int quality, bool progress_callback(int)=NULL)
 
bool WritePNG (const char *fname)
 
bool WriteTIF (const char *fname, const DRECT *area=NULL, const vtProjection *proj=NULL, bool progress_callback(int)=NULL)
 
uint GetPixel24 (int x, int y) const
 
void GetPixel24 (int x, int y, RGBi &rgb) const
 
void GetPixel24From8bit (int x, int y, RGBi &rgb) const
 
void SetPixel24 (int x, int y, dword color)
 
void SetPixel24 (int x, int y, const RGBi &rgb)
 
void GetPixel32 (int x, int y, RGBAi &rgba) const
 
void SetPixel32 (int x, int y, const RGBAi &rgba)
 
uchar GetPixel8 (int x, int y) const
 
void SetPixel8 (int x, int y, uchar color)
 
bool GetPixel1 (int x, int y) const
 
void SetPixel1 (int x, int y, bool color)
 
void SetColor (const RGBi &rgb)
 
void Invert ()
 
void Blit (vtDIB &target, int x, int y)
 
uint GetWidth () const
 
uint GetHeight () const
 
uint GetDepth () const
 
void * GetHandle () const
 
BITMAPINFOHEADERGetDIBHeader () const
 
void * GetDIBData () const
 
void LeaveInternalDIB (bool bLeaveIt)
 
- Public Member Functions inherited from vtBitmapBase
void ScalePixel8 (int x, int y, float fScale)
 
void ScalePixel24 (int x, int y, float fScale)
 
void ScalePixel32 (int x, int y, float fScale)
 
void BlitTo (vtBitmapBase &target, int x, int y)
 

Public Attributes

bool m_bLoadedSuccessfully
 

Detailed Description

A DIB is a Device-Independent Bitmap. It is a way of representing a bitmap in memory which has its origins in early MS Windows usage, but is entirely applicable to normal bitmap operations.

Constructor & Destructor Documentation

vtDIB::vtDIB ( )

Create a new empty DIB wrapper.

Member Function Documentation

void vtDIB::Blit ( vtDIB target,
int  x,
int  y 
)

Copy from this bitmap to another. Currently, this is implemented with a slow, completely unoptimized approach of one pixel at a time.

bool vtDIB::Create ( int  xsize,
int  ysize,
int  bitdepth,
bool  create_palette = false 
)

Create a new DIB in memory.

bool vtDIB::GetPixel1 ( int  x,
int  y 
) const

Get a single bit from a 1-bit bitmap.

uint vtDIB::GetPixel24 ( int  x,
int  y 
) const

Get a 24-bit RGB value from a 24-bit bitmap.

Returns
R,G,B as the three lowest bytes in an uint.
void vtDIB::GetPixel24 ( int  x,
int  y,
RGBi rgb 
) const
virtual

Get a 24-bit RGB value from a 24-bit bitmap, place it in the rgb parameter.

Implements vtBitmapBase.

uchar vtDIB::GetPixel8 ( int  x,
int  y 
) const
virtual

Get a single byte from an 8-bit bitmap.

Implements vtBitmapBase.

void vtDIB::Invert ( )

Invert the bitmap colors.

void vtDIB::LeaveInternalDIB ( bool  bLeaveIt)

Pass true to indicate that the DIB should not free its internal memory when the object is deleted.

bool vtDIB::Read ( const char *  fname,
bool   progress_callbackint = NULL 
)

Read a image file into the DIB. This method will check to see if the file is a BMP or JPEG and call the appropriate reader.

bool vtDIB::ReadBMP ( const char *  fname,
bool   progress_callbackint = NULL 
)

Read a MSWindows-style .bmp file into the DIB.

bool vtDIB::ReadJPEG ( const char *  fname,
bool   progress_callbackint = NULL 
)

Read a JPEG file. A DIB of the necessary size and depth is allocated.

bool vtDIB::ReadPNG ( const char *  fname,
bool   progress_callbackint = NULL 
)

Read a PNG file. A DIB of the necessary size and depth is allocated.

Returns
True if successful.
void vtDIB::SetColor ( const RGBi rgb)

Sets the entire bitmap to a single color.

void vtDIB::SetPixel1 ( int  x,
int  y,
bool  value 
)

Set a single bit in a 1-bit bitmap.

void vtDIB::SetPixel24 ( int  x,
int  y,
dword  color 
)

Set a 24-bit RGB value in a 24-bit bitmap.

void vtDIB::SetPixel8 ( int  x,
int  y,
uchar  value 
)
virtual

Set a single byte in an 8-bit bitmap.

Implements vtBitmapBase.

bool vtDIB::WriteBMP ( const char *  fname)

Write a MSWindows-style .bmp file from the DIB.

bool vtDIB::WriteJPEG ( const char *  fname,
int  quality,
bool   progress_callbackint = NULL 
)

Write a JPEG file.

Parameters
fnameThe output filename.
qualityJPEG quality in the range of 0..100.
progress_callbackIf supplied, this will be called back with progress indication in the range of 1 to 100.
Returns
True if successful.
bool vtDIB::WritePNG ( const char *  fname)

Write a PNG file.

Returns
True if successful.
bool vtDIB::WriteTIF ( const char *  fname,
const DRECT area = NULL,
const vtProjection proj = NULL,
bool   progress_callbackint = NULL 
)

Write a TIFF file. If extents and projection are support, a GeoTIFF file will be written.

Parameters
fnameThe output filename.
areaThe extents if the image. Can be NULL if the image is not georeferenced.
projThe CRS if the image. Can be NULL if the image is not georeferenced.
progress_callbackIf supplied, this will be called back with progress indication in the range of 1 to 100.
Returns
True if successful.

The documentation for this class was generated from the following files: