FastLED 3.9.15
Loading...
Searching...
No Matches
nsgif.hpp File Reference

Detailed Description

Interface to progressive animated GIF file decoding - FastLED namespace wrapped version.

Definition in file nsgif.hpp.

#include "fl/stl/int.h"
#include "fl/stl/noexcept.h"
#include <stdbool.h>
+ Include dependency graph for nsgif.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::third_party::nsgif_bitmap_cb_vt
 Bitmap callbacks function table. More...
 
struct  fl::third_party::nsgif_frame_info
 Information about a GIF frame. More...
 
struct  fl::third_party::nsgif_info
 Information about a GIF. More...
 
struct  fl::third_party::nsgif_rect
 LibNSGIF rectangle structure. More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 
namespace  fl::third_party
 

Macros

#define NSGIF_INFINITE   (0xFFFFFFFFU)
 Representation of infinity.
 
#define NSGIF_MAX_COLOURS   256
 Maximum colour table size.
 

Typedefs

typedef struct fl::third_party::nsgif_bitmap_cb_vt fl::third_party::nsgif_bitmap_cb_vt
 Bitmap callbacks function table.
 
typedef enum fl::third_party::nsgif_bitmap_fmt fl::third_party::nsgif_bitmap_fmt_t
 NSGIF nsgif_bitmap_t pixel format.
 
typedef void fl::third_party::nsgif_bitmap_t
 Client bitmap type.
 
typedef struct fl::third_party::nsgif_frame_info fl::third_party::nsgif_frame_info_t
 Information about a GIF frame.
 
typedef struct fl::third_party::nsgif_info fl::third_party::nsgif_info_t
 Information about a GIF.
 
typedef struct fl::third_party::nsgif_rect fl::third_party::nsgif_rect_t
 LibNSGIF rectangle structure.
 
typedef struct nsgif fl::third_party::nsgif_t
 Opaque type used by LibNSGIF to represent a GIF object in memory.
 

Enumerations

enum  fl::third_party::nsgif_bitmap_fmt {
  fl::third_party::NSGIF_BITMAP_FMT_R8G8B8A8 , fl::third_party::NSGIF_BITMAP_FMT_B8G8R8A8 , fl::third_party::NSGIF_BITMAP_FMT_A8R8G8B8 , fl::third_party::NSGIF_BITMAP_FMT_A8B8G8R8 ,
  fl::third_party::NSGIF_BITMAP_FMT_RGBA8888 , fl::third_party::NSGIF_BITMAP_FMT_BGRA8888 , fl::third_party::NSGIF_BITMAP_FMT_ARGB8888 , fl::third_party::NSGIF_BITMAP_FMT_ABGR8888
}
 NSGIF nsgif_bitmap_t pixel format. More...
 
enum  fl::third_party::nsgif_disposal {
  fl::third_party::NSGIF_DISPOSAL_UNSPECIFIED , fl::third_party::NSGIF_DISPOSAL_NONE , fl::third_party::NSGIF_DISPOSAL_RESTORE_BG , fl::third_party::NSGIF_DISPOSAL_RESTORE_PREV ,
  fl::third_party::NSGIF_DISPOSAL_RESTORE_QUIRK
}
 Frame disposal method. More...
 
enum  fl::third_party::nsgif_error {
  fl::third_party::NSGIF_OK , fl::third_party::NSGIF_ERR_OOM , fl::third_party::NSGIF_ERR_DATA , fl::third_party::NSGIF_ERR_BAD_FRAME ,
  fl::third_party::NSGIF_ERR_DATA_FRAME , fl::third_party::NSGIF_ERR_END_OF_DATA , fl::third_party::NSGIF_ERR_DATA_COMPLETE , fl::third_party::NSGIF_ERR_FRAME_DISPLAY ,
  fl::third_party::NSGIF_ERR_ANIMATION_END
}
 LibNSGIF return codes. More...
 

Functions

nsgif_error fl::third_party::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.
 
void fl::third_party::nsgif_data_complete (nsgif_t *gif) FL_NOEXCEPT
 Tell libnsgif that all the gif data has been provided.
 
nsgif_error fl::third_party::nsgif_data_scan (nsgif_t *gif, fl::size size, const fl::u8 *data) FL_NOEXCEPT
 Scan the source image data.
 
void fl::third_party::nsgif_destroy (nsgif_t *gif) FL_NOEXCEPT
 Free a NSGIF object.
 
nsgif_error fl::third_party::nsgif_frame_decode (nsgif_t *gif, fl::u32 frame, nsgif_bitmap_t **bitmap) FL_NOEXCEPT
 Decodes a GIF frame.
 
nsgif_error fl::third_party::nsgif_frame_prepare (nsgif_t *gif, nsgif_rect_t *area, fl::u32 *delay_cs, fl::u32 *frame_new) FL_NOEXCEPT
 Prepare to show a frame.
 
const nsgif_frame_info_tfl::third_party::nsgif_get_frame_info (const nsgif_t *gif, fl::u32 frame) FL_NOEXCEPT
 Get information about a GIF from an nsgif_t object.
 
const nsgif_info_tfl::third_party::nsgif_get_info (const nsgif_t *gif) FL_NOEXCEPT
 Get information about a GIF from an nsgif_t object.
 
void fl::third_party::nsgif_global_palette (const nsgif_t *gif, fl::u32 table[NSGIF_MAX_COLOURS], fl::size *entries) FL_NOEXCEPT
 Get the global colour palette.
 
bool fl::third_party::nsgif_local_palette (const nsgif_t *gif, fl::u32 frame, fl::u32 table[NSGIF_MAX_COLOURS], fl::size *entries) FL_NOEXCEPT
 Get the local colour palette for a frame.
 
nsgif_error fl::third_party::nsgif_reset (nsgif_t *gif) FL_NOEXCEPT
 Reset a GIF animation.
 
void fl::third_party::nsgif_set_frame_delay_behaviour (nsgif_t *gif, fl::u16 delay_min, fl::u16 delay_default) FL_NOEXCEPT
 Configure handling of small frame delays.
 
const char * fl::third_party::nsgif_str_disposal (enum nsgif_disposal disposal) FL_NOEXCEPT
 Convert a disposal method to a string.
 
const char * fl::third_party::nsgif_strerror (nsgif_error err) FL_NOEXCEPT
 Convert an error code to a string.
 

Class Documentation

◆ fl::third_party::nsgif_bitmap_cb_vt

struct fl::third_party::nsgif_bitmap_cb_vt
Class Members
nsgif_bitmap_t *(*)(int width, int height) create Callback to create a bitmap with the given dimensions.
Parameters
[in]widthRequired bitmap width in pixels.
[in]heightRequired bitmap height in pixels.
Returns
pointer to client's bitmap structure or NULL on error.
void(*)(nsgif_bitmap_t *bitmap) destroy Callback to free a bitmap.
Parameters
[in]bitmapThe bitmap to destroy.
fl::u8 *(*)(nsgif_bitmap_t *bitmap) get_buffer Get pointer to pixel buffer in a bitmap.

The pixel buffer must be (width + N) * height * sizeof(fl::u32). Where N is any number greater than or equal to 0. Note that the returned pointer to fl::u8 must be 4-byte aligned.

Parameters
[in]bitmapThe bitmap.
Returns
pointer to bitmap's pixel buffer.
fl::u32(*)(nsgif_bitmap_t *bitmap) get_rowspan Get row span in pixels.

If this callback is not provided, LibNSGIF will use the width.

If row span is greater than width, this callback must be provided.

Parameters
[in]bitmapThe bitmap.
void(*)(nsgif_bitmap_t *bitmap) modified Bitmap modified notification.
Parameters
[in]bitmapThe bitmap.
void(*)(nsgif_bitmap_t *bitmap, bool opaque) set_opaque Set whether a bitmap can be plotted opaque.
Parameters
[in]bitmapThe bitmap.
[in]opaqueWhether the current frame is opaque.
bool(*)(nsgif_bitmap_t *bitmap) test_opaque Tests whether a bitmap has an opaque alpha channel.
Parameters
[in]bitmapThe bitmap.
Returns
true if the bitmap is opaque, false otherwise.

◆ fl::third_party::nsgif_frame_info

struct fl::third_party::nsgif_frame_info
+ Collaboration diagram for fl::third_party::nsgif_frame_info:
Class Members
u32 delay delay (in cs) before animating the frame
bool display whether the frame should be displayed/animated
u8 disposal Disposal method for previous frame; affects plotting.
bool interlaced whether the frame is interlaced
bool local_palette whether the frame has a local colour table
nsgif_rect_t rect Frame's redraw rectangle.
bool transparency whether the frame may have transparency

◆ fl::third_party::nsgif_info

struct fl::third_party::nsgif_info
Class Members
u32 background background colour in same pixel format as nsgif_bitmap_t.
u32 frame_count number of frames decoded
bool global_palette whether the GIF has a global colour table
u32 height height of GIF (may increase during decoding)
int loop_max number of times to play animation (zero means loop forever)
u32 width width of GIF (may increase during decoding)

◆ fl::third_party::nsgif_rect

struct fl::third_party::nsgif_rect
Class Members
u32 x0 x co-ordinate of redraw rectangle, left
u32 x1 x co-ordinate of redraw rectangle, right
u32 y0 y co-ordinate of redraw rectangle, top
u32 y1 y co-ordinate of redraw rectangle, bottom