94 setError(
"Failed to convert bitmap to frame");
181 return info ?
static_cast<fl::u16
>(info->
width) : 0;
190 return info ?
static_cast<fl::u16
>(info->
height) : 0;
203 return info ?
static_cast<fl::u32
>(info->
loop_max) : 0;
241 const fl::size bufferSize = 4096;
242 fl::u8 buffer[bufferSize];
243 fl::size bytesRead =
stream_->read(buffer, bufferSize);
245 if (bytesRead == 0) {
262 if (bytesRead < bufferSize) {
279 setError(
"convertBitmapToFrame called with null bitmap");
287 setError(
"GIF bitmap has invalid data or dimensions");
307 if (!frame || !frame->isValid()) {
308 setError(
"Failed to create valid Frame from GIF bitmap");
fl::u32 getFrameCount() const FL_NOEXCEPT override
fl::u16 getHeight() const FL_NOEXCEPT
fl::Frame getCurrentFrame() FL_NOEXCEPT override
static fl::u8 * bitmapGetBuffer(nsgif_bitmap_t *bitmap) FL_NOEXCEPT
fl::u32 currentFrameIndex_
void setError(const fl::string &message) FL_NOEXCEPT
fl::DecodeResult decode() FL_NOEXCEPT override
bool hasMoreFrames() const FL_NOEXCEPT override
bool seek(fl::u32 frameIndex) FL_NOEXCEPT override
static nsgif_bitmap_t * bitmapCreate(int width, int height) FL_NOEXCEPT
bool loadMoreData() FL_NOEXCEPT
void cleanupDecoder() FL_NOEXCEPT
fl::shared_ptr< fl::Frame > currentFrame_
static void bitmapDestroy(nsgif_bitmap_t *bitmap) FL_NOEXCEPT
bool initializeDecoder() FL_NOEXCEPT
bool hasError(fl::string *msg=nullptr) const FL_NOEXCEPT override
bool isAnimated() const FL_NOEXCEPT
void end() FL_NOEXCEPT override
fl::u32 getLoopCount() const FL_NOEXCEPT
fl::u16 getWidth() const FL_NOEXCEPT
static nsgif_bitmap_cb_vt bitmapCallbacks_
fl::shared_ptr< fl::Frame > convertBitmapToFrame(nsgif_bitmap_t *bitmap) FL_NOEXCEPT
SoftwareGifDecoder(fl::PixelFormat format=fl::PixelFormat::RGB888) FL_NOEXCEPT
fl::vector< fl::u8 > dataBuffer_
bool begin(fl::filebuf_ptr stream) FL_NOEXCEPT override
pointer get() const FL_NOEXCEPT
@ NSGIF_BITMAP_FMT_R8G8B8A8
Bite-wise RGBA: Byte order: 0xRR, 0xGG, 0xBB, 0xAA.
nsgif_error
LibNSGIF return codes.
@ NSGIF_ERR_DATA_COMPLETE
Can't supply more data after calling nsgif_data_complete.
@ NSGIF_ERR_OOM
Out of memory error.
@ NSGIF_ERR_BAD_FRAME
Frame number is not valid.
@ NSGIF_ERR_END_OF_DATA
Unexpected end of GIF source data.
@ NSGIF_ERR_ANIMATION_END
Indicates an animation is complete, and nsgif_reset must be called to restart the animation from the ...
@ NSGIF_ERR_DATA_FRAME
GIF source data contained an error in a frame.
@ NSGIF_ERR_DATA
GIF source data is invalid, and no frames are recoverable.
@ NSGIF_ERR_FRAME_DISPLAY
The current frame cannot be displayed.
nsgif_error nsgif_data_scan(nsgif_t *gif, fl::size size, const fl::u8 *data) FL_NOEXCEPT
Scan the source image data.
nsgif_error nsgif_frame_decode(nsgif_t *gif, fl::u32 frame, nsgif_bitmap_t **bitmap) FL_NOEXCEPT
Decodes a GIF frame.
nsgif_error nsgif_create(const nsgif_bitmap_cb_vt *bitmap_vt, nsgif_bitmap_fmt_t bitmap_fmt, nsgif_t **gif_out) FL_NOEXCEPT
Create the NSGIF object.
const nsgif_info_t * nsgif_get_info(const nsgif_t *gif) FL_NOEXCEPT
Get information about a GIF from an nsgif_t object.
void nsgif_data_complete(nsgif_t *gif) FL_NOEXCEPT
Tell libnsgif that all the gif data has been provided.
const char * nsgif_strerror(nsgif_error err) FL_NOEXCEPT
Convert an error code to a string.
void nsgif_bitmap_t
Client bitmap type.
void nsgif_destroy(nsgif_t *gif) FL_NOEXCEPT
Free a NSGIF object.
struct fl::third_party::nsgif_info nsgif_info_t
Information about a GIF.
enum fl::third_party::nsgif_bitmap_fmt nsgif_bitmap_fmt_t
NSGIF nsgif_bitmap_t pixel format.
int loop_max
number of times to play animation (zero means loop forever)
fl::u32 frame_count
number of frames decoded
fl::u32 width
width of GIF (may increase during decoding)
fl::u32 height
height of GIF (may increase during decoding)
Bitmap callbacks function table.
void * memcpy(void *dest, const void *src, size_t n) FL_NOEXCEPT
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
expected< T, E > result
Alias for expected (Rust-style naming)
fl::shared_ptr< filebuf > filebuf_ptr
fl::string format(const char *fmt)
Format with no arguments.
Base definition for an LED controller.
fl::unique_ptr< fl::u8[]> pixels