Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBBitmapFragmentMap is used to pack multiple bitmaps into a single TBBitmap. More...
#include <tb_bitmap_fragment.h>
Public Member Functions | |
bool | Init (int bitmap_w, int bitmap_h) |
Initialize the map with the given size. More... | |
TBBitmapFragment * | CreateNewFragment (int frag_w, int frag_h, int data_stride, uint32_t *frag_data, bool add_border) |
Create a new fragment with the given size and data in this map. More... | |
void | FreeFragmentSpace (TBBitmapFragment *frag) |
Free up the space used by the given fragment, so that other fragments can take its place. More... | |
TBBitmap * | GetBitmap (TB_VALIDATE_TYPE validate_type=TB_VALIDATE_ALWAYS) |
Return the bitmap for this map. More... | |
Friends | |
class | TBBitmapFragmentManager |
TBBitmapFragmentMap is used to pack multiple bitmaps into a single TBBitmap.
When initialized (in a size suitable for a TBBitmap) it also creates a software buffer that will make up the TBBitmap when all fragments have been added.
TBBitmapFragment * tb::TBBitmapFragmentMap::CreateNewFragment | ( | int | frag_w, |
int | frag_h, | ||
int | data_stride, | ||
uint32_t * | frag_data, | ||
bool | add_border | ||
) |
Create a new fragment with the given size and data in this map.
Returns nullptr if there is not enough room in this map or on any other fail.
void tb::TBBitmapFragmentMap::FreeFragmentSpace | ( | TBBitmapFragment * | frag | ) |
Free up the space used by the given fragment, so that other fragments can take its place.
TBBitmap * tb::TBBitmapFragmentMap::GetBitmap | ( | TB_VALIDATE_TYPE | validate_type = TB_VALIDATE_ALWAYS | ) |
Return the bitmap for this map.
By default, the bitmap is validated if needed before returning (See TB_VALIDATE_TYPE)
bool tb::TBBitmapFragmentMap::Init | ( | int | bitmap_w, |
int | bitmap_h | ||
) |
Initialize the map with the given size.
The size should be a power of two since it will be used to create a TBBitmap (texture memory).