2.15.1
Functions
Bitmap

Bitmap management. More...

Description

Bitmap management.

Functions

TLN_Bitmap TLN_CreateBitmap (int width, int height, int bpp)
 Creates a memory bitmap. More...
 
TLN_Bitmap TLN_LoadBitmap (const char *filename)
 Load image file (8-bit BMP or PNG) More...
 
TLN_Bitmap TLN_CloneBitmap (TLN_Bitmap src)
 Creates a copy of a bitmap. More...
 
uint8_t * TLN_GetBitmapPtr (TLN_Bitmap bitmap, int x, int y)
 Gets memory access for direct pixel manipulation. More...
 
int TLN_GetBitmapWidth (TLN_Bitmap bitmap)
 Returns the width in pixels. More...
 
int TLN_GetBitmapHeight (TLN_Bitmap bitmap)
 Returns the height in pixels. More...
 
int TLN_GetBitmapDepth (TLN_Bitmap bitmap)
 Returns the bits per pixel. More...
 
int TLN_GetBitmapPitch (TLN_Bitmap bitmap)
 Returns the number of bytes per scaline (also known a stride) More...
 
TLN_Palette TLN_GetBitmapPalette (TLN_Bitmap bitmap)
 Gets the associated palete of a bitmap. More...
 
bool TLN_SetBitmapPalette (TLN_Bitmap bitmap, TLN_Palette palette)
 Assigns a new palette to the bitmap. More...
 
bool TLN_DeleteBitmap (TLN_Bitmap bitmap)
 Deletes bitmap and frees resources. More...
 

Function Documentation

◆ TLN_CreateBitmap()

TLN_Bitmap TLN_CreateBitmap ( int  width,
int  height,
int  bpp 
)

Creates a memory bitmap.

Parameters
widthWidth in pixels
heightHeight in pixels
bppBits per pixel
Returns
Reference to the created bitmap, or NULL if error
See also
TLN_SetBGBitmap()

◆ TLN_LoadBitmap()

TLN_Bitmap TLN_LoadBitmap ( const char *  filename)

Load image file (8-bit BMP or PNG)

Parameters
filenameFile name with the image
Returns
Handler to the loaded image or NULL if error
See also
TLN_DeleteBitmap()

◆ TLN_CloneBitmap()

TLN_Bitmap TLN_CloneBitmap ( TLN_Bitmap  src)

Creates a copy of a bitmap.

Parameters
srcReference to the original bitmap
Returns
Reference to the created bitmap, or NULL if error
See also
TLN_SetBGBitmap()

◆ TLN_GetBitmapPtr()

uint8_t* TLN_GetBitmapPtr ( TLN_Bitmap  bitmap,
int  x,
int  y 
)

Gets memory access for direct pixel manipulation.

Parameters
bitmapReference to bitmap
xStarting x position [0, width - 1]
yStarting y position [0, height - 1]
Returns
Pointer to pixel data starting at x,y
Remarks
Care must be taken in manipulating memory directly as it can crash the application

◆ TLN_GetBitmapWidth()

int TLN_GetBitmapWidth ( TLN_Bitmap  bitmap)

Returns the width in pixels.

Parameters
bitmapReference to the bitmap

◆ TLN_GetBitmapHeight()

int TLN_GetBitmapHeight ( TLN_Bitmap  bitmap)

Returns the height in pixels.

Parameters
bitmapReference to the bitmap

◆ TLN_GetBitmapDepth()

int TLN_GetBitmapDepth ( TLN_Bitmap  bitmap)

Returns the bits per pixel.

Parameters
bitmapReference to the bitmap

◆ TLN_GetBitmapPitch()

int TLN_GetBitmapPitch ( TLN_Bitmap  bitmap)

Returns the number of bytes per scaline (also known a stride)

Parameters
bitmapReference to the bitmap

◆ TLN_GetBitmapPalette()

TLN_Palette TLN_GetBitmapPalette ( TLN_Bitmap  bitmap)

Gets the associated palete of a bitmap.

Parameters
bitmapReference to bitmap
Returns
Reference to the bitmap palette
See also
TLN_SetBitmapPalette()

◆ TLN_SetBitmapPalette()

bool TLN_SetBitmapPalette ( TLN_Bitmap  bitmap,
TLN_Palette  palette 
)

Assigns a new palette to the bitmap.

Parameters
bitmapReference to the bitmap
paletteReference to the palette to assign
See also
TLN_GetBitmapPalette()

◆ TLN_DeleteBitmap()

bool TLN_DeleteBitmap ( TLN_Bitmap  bitmap)

Deletes bitmap and frees resources.

Parameters
bitmapReference to bitmap to delete
See also
TLN_CreateBitmap89, TLN_CloneBitmap()