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

The common interface for images read from raw data. More...

#include <image_file.hpp>

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

Public Member Functions

 ImageFile (uint8_t *const bytes, size_t length)
 Constructor.
 
- Public Member Functions inherited from ui::Renderable
virtual void renderAt (const Coords &coords, const shader_t &shader=0) const =0
 Display the renderable directly onto the screen.
 
virtual Size getSize () const =0
 Get the size of the renderable.
 

Static Public Member Functions

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.
 

Public Attributes

uint8_t *const bytes
 The buffer that the image data is stored in.
 
size_t length
 The size of the data buffer.
 

Protected Member Functions

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

The common interface for images read from raw data.

Note
This is different from the various bitmap renderables as, unlike the bespoke bitmap formats, these image types may be loaded directly from files.

Constructor & Destructor Documentation

◆ ImageFile()

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

Constructor.

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

Member Function Documentation

◆ getInt()

unsigned int ui::ImageFile::getInt ( size_t  index,
uint8_t  count 
) const
protected

Read a big-endian integer from raw bytes.

Parameters
indexThe starting index.
countThe number of bytes to read.
Returns
The resulting integer.

◆ getIntLE()

unsigned int ui::ImageFile::getIntLE ( size_t  index,
uint8_t  count 
) const
protected

Read a little-endian integer from raw bytes.

Parameters
indexThe starting index.
countThe number of bytes to read.
Returns
The resulting integer.

◆ getType()

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

Determine the image type based on the file data.

Parameters
bytesA buffer containing the image data.
lengthThe size of the buffer.
Returns
The type of image that was determined, or IMAGE_UNKNOWN (aka 0) if unable to be determined.

◆ hasSequence()

static bool ui::ImageFile::hasSequence ( uint8_t *const  bytes,
size_t  length,
const std::initializer_list< uint8_t > &&  sequence,
size_t  index 
)
static

Check if a buffer contains a specific sequence of bytes at the given index.

Parameters
bytesA buffer containing the image data.
lengthThe size of the buffer.
sequenceA sequence of bytes.
indexThe index to look at.

Member Data Documentation

◆ bytes

uint8_t* const ui::ImageFile::bytes

The buffer that the image data is stored in.

Note
This buffer is NOT owned by the ImageFile instance, and will not be cleaned up by it. Any cleanup/deletion must be done be the caller or owning entity.

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