Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
Bitmap Class Reference

Rudimentary header-only 2D bitmap class. More...

#include <bitmap.h>

+ Collaboration diagram for Bitmap:

Public Member Functions

 Bitmap ()
 Create an empty bitmap.
 
 Bitmap (u32 width, u32 height)
 Create a new zero-filled bitmap.
 
u32 width () const
 
u32 height () const
 
void resize (u32 width, u32 height, bool initial_value=false)
 
void reset (bool value)
 
bool get (u32 x, u32 y) const
 
void set (u32 x, u32 y)
 
void unset (u32 x, u32 y)
 
bool toggle (u32 x, u32 y)
 
bool all () const
 Returns true if all bits in the bitmap are set.
 

Private Member Functions

template<bool set, bool toggle, bool clear>
bool modify_ (u32 x, u32 y)
 

Static Private Member Functions

static u32 bytepos (u32 index)
 
static u8 bitpos (u32 index)
 

Private Attributes

u32 linesize
 
u32 lines
 
std::vector< u8 > data
 

Detailed Description

Rudimentary header-only 2D bitmap class.

Warning
not thread-safe

Constructor & Destructor Documentation

◆ Bitmap() [1/2]

Bitmap::Bitmap ( )
inline

Create an empty bitmap.

◆ Bitmap() [2/2]

Bitmap::Bitmap ( u32 width,
u32 height )
inline

Create a new zero-filled bitmap.

References height(), resize(), and width().

+ Here is the call graph for this function:

Member Function Documentation

◆ all()

bool Bitmap::all ( ) const
inline

Returns true if all bits in the bitmap are set.

References bitpos(), data, lines, and linesize.

Referenced by imageCleanTransparentWithInlining().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bitpos()

static u8 Bitmap::bitpos ( u32 index)
inlinestaticprivate

Referenced by all(), get(), and modify_().

+ Here is the caller graph for this function:

◆ bytepos()

static u32 Bitmap::bytepos ( u32 index)
inlinestaticprivate

Referenced by get(), modify_(), and resize().

+ Here is the caller graph for this function:

◆ get()

bool Bitmap::get ( u32 x,
u32 y ) const
inline

References bitpos(), bytepos(), data, linesize, x, and y.

Referenced by imageCleanTransparentWithInlining().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ height()

u32 Bitmap::height ( ) const
inline

References lines.

Referenced by Bitmap(), and resize().

+ Here is the caller graph for this function:

◆ modify_()

template<bool set, bool toggle, bool clear>
bool Bitmap::modify_ ( u32 x,
u32 y )
inlineprivate

References bitpos(), bytepos(), data, linesize, set(), toggle(), x, and y.

Referenced by set(), toggle(), and unset().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

void Bitmap::reset ( bool value)
inline

References data.

◆ resize()

void Bitmap::resize ( u32 width,
u32 height,
bool initial_value = false )
inline

References bytepos(), data, height(), lines, linesize, and width().

Referenced by Bitmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set()

void Bitmap::set ( u32 x,
u32 y )
inline

References modify_(), x, and y.

Referenced by imageCleanTransparentWithInlining(), and modify_().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggle()

bool Bitmap::toggle ( u32 x,
u32 y )
inline

References modify_(), x, and y.

Referenced by modify_().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unset()

void Bitmap::unset ( u32 x,
u32 y )
inline

References modify_(), x, and y.

+ Here is the call graph for this function:

◆ width()

u32 Bitmap::width ( ) const
inline

References linesize.

Referenced by Bitmap(), and resize().

+ Here is the caller graph for this function:

Member Data Documentation

◆ data

std::vector<u8> Bitmap::data
private

Referenced by all(), get(), modify_(), reset(), and resize().

◆ lines

u32 Bitmap::lines
private

Referenced by all(), height(), and resize().

◆ linesize

u32 Bitmap::linesize
private

Referenced by all(), get(), modify_(), resize(), and width().


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