FastLED 3.9.15
Loading...
Searching...
No Matches

◆ nsgif_local_palette()

bool fl::third_party::nsgif_local_palette ( const nsgif_t * gif,
fl::u32 frame,
fl::u32 table[NSGIF_MAX_COLOURS],
fl::size * entries )

Get the local colour palette for a frame.

Frames may have no local palette. In this case they use the global palette. This function returns false if the frame has no local palette.

Colours in same pixel format as nsgif_bitmap_t.

Parameters
[in]gifThe nsgif_t object.
[in]frameThe frame to get the palette for.
[out]tableClient buffer to hold the colour table.
[out]entriesThe number of used entries in the colour table.
Returns
true if a palette is returned, false otherwise.

Definition at line 2020 of file gif.cpp.hpp.

2025{
2026 const nsgif_frame *f;
2027
2028 if (frame >= gif->frame_count_partial) {
2029 return false;
2030 }
2031
2032 f = &gif->frames[frame];
2033 if (f->info.local_palette == false) {
2034 return false;
2035 }
2036
2037 *entries = 2 << (f->flags & NSGIF_COLOUR_TABLE_SIZE_MASK);
2039 *entries, gif->buf + f->colour_table_offset);
2040
2041 return true;
2042}
static void nsgif__colour_table_decode(fl::u32 colour_table[NSGIF_MAX_COLOURS], const struct nsgif_colour_layout *layout, fl::size colour_table_entries, const fl::u8 *data) FL_NOEXCEPT
Extract a GIF colour table into a LibNSGIF colour table buffer.
Definition gif.cpp.hpp:1079
bool local_palette
whether the frame has a local colour table
Definition nsgif.hpp:428
nsgif_frame * frames
decoded frames
Definition gif.cpp.hpp:79
fl::u32 colour_table_offset
offset to frame colour table
Definition gif.cpp.hpp:56
struct nsgif_colour_layout colour_layout
Client's colour component order.
Definition gif.cpp.hpp:127
fl::u32 frame_count_partial
number of frames partially decoded
Definition gif.cpp.hpp:100
struct nsgif_frame_info info
Definition gif.cpp.hpp:38
const fl::u8 * buf
pointer to GIF data
Definition gif.cpp.hpp:109
#define NSGIF_COLOUR_TABLE_SIZE_MASK
Definition gif.cpp.hpp:172

References fl::third_party::nsgif_frame::colour_table_offset, FL_NOEXCEPT, fl::third_party::nsgif_frame::flags, fl::third_party::nsgif_frame::info, fl::third_party::nsgif_frame_info::local_palette, nsgif__colour_table_decode(), NSGIF_COLOUR_TABLE_SIZE_MASK, and NSGIF_MAX_COLOURS.

+ Here is the call graph for this function: