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

A renderable for PNG encoded image data. More...

#include <png.hpp>

Inheritance diagram for ui::Png:
ui::ImageFile ui::Renderable

Public Member Functions

void renderAt (const Coords &coords, const shader_t &shader=0) const override
 Display the renderable directly onto the screen.
 
Size getSize () const override
 Get the size of the renderable.
 
bool isInterlaced () const
 Check if this PNG image is interlaced.
 
 ImageFile (uint8_t *const bytes, size_t length)
 Constructor.
 
- Public Member Functions inherited from ui::ImageFile
 ImageFile (uint8_t *const bytes, size_t length)
 Constructor.
 

Public Attributes

uint8_t transparencyThreshold = 128
 The minimum alpha value to consider fully opaque.
 
- Public Attributes inherited from ui::ImageFile
uint8_t *const bytes
 The buffer that the image data is stored in.
 
size_t length
 The size of the data buffer.
 

Additional Inherited Members

- Static Public Member Functions inherited from ui::ImageFile
static ImageType getType (uint8_t *const bytes, size_t length)
 Determine the image type based on the file data.
 
static bool hasSequence (uint8_t *const bytes, size_t length, const std::initializer_list< uint8_t > &&sequence, size_t index)
 Check if a buffer contains a specific sequence of bytes at the given index.
 
- Protected Member Functions inherited from ui::ImageFile
unsigned int getInt (size_t index, uint8_t count) const
 Read a big-endian integer from raw bytes.
 
unsigned int getIntLE (size_t index, uint8_t count) const
 Read a little-endian integer from raw bytes.
 

Detailed Description

A renderable for PNG encoded image data.

Warning
Interlaced PNGs are not supported, and will not render correctly.

Member Function Documentation

◆ getSize()

Size ui::Png::getSize ( ) const
overridevirtual

Get the size of the renderable.

Returns
The size of the renderable in pixels.

Implements ui::Renderable.

◆ ImageFile()

ui::ImageFile::ImageFile ( uint8_t *const  bytes,
size_t  length 
)

Constructor.

Parameters
bytesA buffer containing the image data.
lengthThe size of the buffer.

◆ isInterlaced()

bool ui::Png::isInterlaced ( ) const

Check if this PNG image is interlaced.

Returns
True if this is interlaced, false otherwise.

◆ renderAt()

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

Display the renderable directly onto the screen.

Parameters
coordsThe coordinates to render the first pixel [0,0] of the renderable.
shaderAn optional pixel shader to apply to each pixel of the renderable.

Implements ui::Renderable.

Member Data Documentation

◆ transparencyThreshold

uint8_t ui::Png::transparencyThreshold = 128

The minimum alpha value to consider fully opaque.

Gigawidgets only supports a single bit of transparency, so any alpha value below this threshold is considered fully transparent, and any above this threshold is fully opaque.


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