gigawidgets 0.3.55
A wxWidgets-style UI library for the Arduino Giga Display Shield.
 
Loading...
Searching...
No Matches
ui::TransparentBitmap Struct Reference

A basic image with no compression, and with 1 bit of transparency per pixel. More...

#include <transparent_bitmap.hpp>

Inheritance diagram for ui::TransparentBitmap:
ui::Bitmap ui::Renderable

Public Member Functions

 TransparentBitmap (const Size &size, color_t *const data, uint8_t *const mask)
 Construct a transparent bitmap image from static data.
 
void renderAt (const Coords &coords, const shader_t &shader=0) const override
 Display the bitmap directly onto the screen.
 
color_t averageColor () const override
 Get the average color of the bitmap.
 
- Public Member Functions inherited from ui::Bitmap
 Bitmap (const Size &size, color_t *const data)
 Construct a bitmap image from static data.
 
Size getSize () const override
 Get the size of the bitmap.
 

Public Attributes

uint8_t *const mask
 The transparency mask.
 
- Public Attributes inherited from ui::Bitmap
Size size
 The size of the image in pixels.
 
color_t *const data
 The list of pixels in the image.
 

Detailed Description

A basic image with no compression, and with 1 bit of transparency per pixel.

Constructor & Destructor Documentation

◆ TransparentBitmap()

ui::TransparentBitmap::TransparentBitmap ( const Size size,
color_t *const  data,
uint8_t *const  mask 
)

Construct a transparent bitmap image from static data.

Parameters
sizeThe size of the image.
dataThe list of pixels in the image.
maskThe transparency mask for the image.

Member Function Documentation

◆ averageColor()

color_t ui::TransparentBitmap::averageColor ( ) const
overridevirtual

Get the average color of the bitmap.

Returns
A calculated average of the color from all pixels in the bitmap, excluding transparent pixels.
Note
This performs a fast, naive average (mean) of the raw pixel data, without accounting for human perception.

Reimplemented from ui::Bitmap.

◆ renderAt()

void ui::TransparentBitmap::renderAt ( const Coords coords,
const shader_t shader = 0 
) const
overridevirtual

Display the bitmap directly onto the screen.

Parameters
coordsThe coordinages to render the first pixel [0,0] of the bitmap.
shaderAn optional pixel shader to apply to each pixel of the bitmap.
Note
Shaders will only be applied to non-transparent pixels.

Reimplemented from ui::Bitmap.

Member Data Documentation

◆ mask

uint8_t* const ui::TransparentBitmap::mask

The transparency mask.

Each bit represents its respective pixel's transparency, with 1 being fully opaque and 0 being fully transparent.


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