Parse a GIF Image Descriptor.
+0 CHAR Image Separator (0x2c) +1 SHORT Image Left Position +3 SHORT Image Top Position +5 SHORT Width +7 SHORT Height +9 CHAR Packed Fields 1BIT Local Colour Table Flag 1BIT Interlace Flag 1BIT Sort Flag 2BITS Reserved 3BITS Size of Local Colour Table
1020{
1022 fl::size len = gif->
buf + gif->
buf_len - data;
1023 enum {
1024 NSGIF_IMAGE_DESCRIPTOR_LEN = 10u,
1025 NSGIF_IMAGE_SEPARATOR = 0x2Cu,
1026 NSGIF_MASK_INTERLACE = 0x40u,
1027 };
1028
1029 FL_ASSERT(gif !=
nullptr,
"GIF object required");
1030 FL_ASSERT(frame !=
nullptr,
"Frame object required");
1031
1032 if (len < NSGIF_IMAGE_DESCRIPTOR_LEN) {
1034 }
1035
1036 if (decode) {
1038
1039 if (data[0] != NSGIF_IMAGE_SEPARATOR) {
1041 }
1042
1043 x = data[1] | (data[2] << 8);
1044 y = data[3] | (data[4] << 8);
1045 w = data[5] | (data[6] << 8);
1046 h = data[7] | (data[8] << 8);
1047 frame->
flags = data[9];
1048
1053
1055
1056
1060 }
1063 }
1064 }
1065 }
1066
1067 *
pos += NSGIF_IMAGE_DESCRIPTOR_LEN;
1069}
#define FL_ASSERT(x, MSG)
@ NSGIF_ERR_END_OF_DATA
Unexpected end of GIF source data.
@ NSGIF_ERR_DATA_FRAME
GIF source data contained an error in a frame.
nsgif_rect_t rect
Frame's redraw rectangle.
fl::u32 frame_count
number of frames decoded
fl::u32 y0
y co-ordinate of redraw rectangle, top
fl::u32 width
width of GIF (may increase during decoding)
fl::u32 height
height of GIF (may increase during decoding)
fl::size buf_len
total number of bytes of GIF data available
bool interlaced
whether the frame is interlaced
fl::u32 x1
x co-ordinate of redraw rectangle, right
fl::u32 y1
y co-ordinate of redraw rectangle, bottom
fl::u32 x0
x co-ordinate of redraw rectangle, left
struct nsgif_frame_info info
const fl::u8 * buf
pointer to GIF data