le3d - LightEngine 3D
A straightforward C++ 3D software engine for real-time graphics
Public Member Functions | Public Attributes | List of all members
LeBitmap Class Reference

Contain and manage a RGB or RGBA 32bit bitmap image. More...

#include <bitmap.h>

Public Member Functions

 LeBitmap ()
 
 ~LeBitmap ()
 
void clear (LeColor color)
 Clear the image with the specified color. More...
 
void rect (int32_t x, int32_t y, int32_t w, int32_t h, LeColor color)
 Fill a rectangle with the specified color. More...
 
void blit (int32_t xDst, int32_t yDst, const LeBitmap *src, int32_t xSrc, int32_t ySrc, int32_t w, int32_t h)
 Copy an image portion to the image. More...
 
void alphaBlit (int32_t xDst, int32_t yDst, const LeBitmap *src, int32_t xSrc, int32_t ySrc, int32_t w, int32_t h)
 Copy an image portion to the image (premultiplied alpha format) More...
 
void alphaScaleBlit (int32_t xDst, int32_t yDst, int32_t wDst, int32_t hDst, const LeBitmap *src, int32_t xSrc, int32_t ySrc, int32_t wSrc, int32_t hSrc)
 Copy and scale an image portion to the image (premultiplied alpha format) More...
 
void text (int x, int y, const char *text, int length, const LeBmpFont *font)
 Write a short text with the specified bitmap character set. More...
 
void allocate (int tx, int ty)
 Allocate bitmap memory. More...
 
void deallocate ()
 Deallocate bitmap memory. More...
 
void preMultiply ()
 Alpha pre-multiply an RGBA bitmap. More...
 
void makeMipmaps ()
 Generate mipmaps from the bitmap. More...
 

Public Attributes

LeHandle context
 
LeHandle bitmap
 
int tx
 
int ty
 
int txP2
 
int tyP2
 
int flags
 
void * data
 
bool dataAllocated
 
LeBitmapmipmaps [LE_BMP_MIPMAPS]
 
int mmLevels
 

Detailed Description

Contain and manage a RGB or RGBA 32bit bitmap image.

Constructor & Destructor Documentation

LeBitmap::LeBitmap ( )
LeBitmap::~LeBitmap ( )

Member Function Documentation

void LeBitmap::allocate ( int  tx,
int  ty 
)

Allocate bitmap memory.

Parameters
[in]tximage width (pixels)
[in]tyimage height (pixels)
void LeBitmap::alphaBlit ( int32_t  xDst,
int32_t  yDst,
const LeBitmap src,
int32_t  xSrc,
int32_t  ySrc,
int32_t  w,
int32_t  h 
)

Copy an image portion to the image (premultiplied alpha format)

Parameters
[in]xDsthorizontal destination position (pixels)
[in]yDstvertical destination position (pixels)
[in]srcsource bitmap image
[in]xSrchorizontal source position (pixels)
[in]ySrcvertical source position (pixels)
[in]wportion width (pixels)
[in]hportion height (pixels)
void LeBitmap::alphaScaleBlit ( int32_t  xDst,
int32_t  yDst,
int32_t  wDst,
int32_t  hDst,
const LeBitmap src,
int32_t  xSrc,
int32_t  ySrc,
int32_t  wSrc,
int32_t  hSrc 
)

Copy and scale an image portion to the image (premultiplied alpha format)

Parameters
[in]xDsthorizontal destination position (pixels)
[in]yDstvertical destination position (pixels)
[in]wDstdestination width (pixels)
[in]hDstdestination height (pixels)
[in]srcsource bitmap image
[in]xSrchorizontal source position (pixels)
[in]ySrcvertical source position (pixels)
[in]wSrcsource width (pixels)
[in]hSrcsource height (pixels)
void LeBitmap::blit ( int32_t  xDst,
int32_t  yDst,
const LeBitmap src,
int32_t  xSrc,
int32_t  ySrc,
int32_t  w,
int32_t  h 
)

Copy an image portion to the image.

Parameters
[in]xDsthorizontal destination position (pixels)
[in]yDstvertical destination position (pixels)
[in]srcsource bitmap image
[in]xSrchorizontal source position (pixels)
[in]ySrcvertical source position (pixels)
[in]wportion width (pixels)
[in]hportion height (pixels)
void LeBitmap::clear ( LeColor  color)

Clear the image with the specified color.

Parameters
[in]colorRGBA 32bit color
void LeBitmap::deallocate ( )

Deallocate bitmap memory.

void LeBitmap::makeMipmaps ( )

Generate mipmaps from the bitmap.

void LeBitmap::preMultiply ( )

Alpha pre-multiply an RGBA bitmap.

void LeBitmap::rect ( int32_t  x,
int32_t  y,
int32_t  w,
int32_t  h,
LeColor  color 
)

Fill a rectangle with the specified color.

Parameters
[in]xhorizontal position of the rectangle (pixels)
[in]yvertical position of the rectangle (pixels)
[in]wwidth of the rectangle (pixels)
[in]hheight of the rectangle (pixels)
[in]colorRGBA 32bit color
void LeBitmap::text ( int  x,
int  y,
const char *  text,
int  length,
const LeBmpFont font 
)

Write a short text with the specified bitmap character set.

Parameters
[in]xhorizontal text position (pixels)
[in]yvertical text position (pixels)
[in]textascii string
[in]lengthstring length
[in]fontmonospace bitmap character set

Member Data Documentation

LeHandle LeBitmap::bitmap

Handle available for bitmap

LeHandle LeBitmap::context

Handle available for graphic contexts

void* LeBitmap::data

Pointer to raw data

bool LeBitmap::dataAllocated

Has data been allocated?

int LeBitmap::flags

Image format and attributes

LeBitmap* LeBitmap::mipmaps[LE_BMP_MIPMAPS]

Table of mipmaps (bitmap pointers)

int LeBitmap::mmLevels

No of mipmaps

int LeBitmap::tx

Horizontal size of image in pixels

int LeBitmap::txP2

Horizontal size (power of 2)

int LeBitmap::ty

Vertical size of image in pixels

int LeBitmap::tyP2

Vertical size (power of 2)


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