|
AnimaEngine
1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
|
Implementations of custom LZW animated GIF writing utilities. More...
#include "gif_writer.h"Data Structures | |
| struct | GifBitWriter |
Macros | |
| #define | GIF_COMPAT_MIN_FAST_DELAY_CS 5 |
Typedefs | |
| typedef struct GifBitWriter | GifBitWriter |
Functions | |
| static void | WriteU16 (FILE *f, int value) |
| Writes a 16-bit unsigned integer in little-endian format to a file stream. More... | |
| static void | ResolveCompatibleTiming (int requested_delay_cs, int *out_frame_step, int *out_delay_cs) |
| Resolves compatible delay timing constraints to prevent browser lag. More... | |
| static int | ColorTableSize (int color_count) |
| Computes power-of-two color table size matching number of palette colors. More... | |
| static int | BitsForColorTable (int table_size) |
| Computes bits of precision needed to index a color table size. More... | |
| static int | GifBitWriter_FlushBlock (GifBitWriter *writer) |
| Flushes accumulated byte block buffer of the LZW stream to disk. More... | |
| static int | GifBitWriter_WriteByte (GifBitWriter *writer, u8 value) |
| Adds a single byte to the output stream block. More... | |
| static int | GifBitWriter_WriteCode (GifBitWriter *writer, int code, int code_size) |
| Writes an LZW code of variable bit length. More... | |
| static int | GifBitWriter_Finish (GifBitWriter *writer) |
| Flushes remaining bits and terminates image block. More... | |
| static int | WriteLzwLiteralImageData (FILE *f, const u8 *frame, int width, int height, int scale, int min_code_size) |
| Emits LZW literal code stream from pixel index frame data. More... | |
| int | Gif_WriteIndexed (const char *path, const u8 *frames, int frame_count, int width, int height, const RgbaColor *palette, int palette_count, int transparent_index, int delay_cs, int loop_count, int scale) |
| Encodes and writes a sequence of indexed frames to a GIF file. More... | |
Implementations of custom LZW animated GIF writing utilities.
| #define GIF_COMPAT_MIN_FAST_DELAY_CS 5 |
| typedef struct GifBitWriter GifBitWriter |
|
static |
Computes bits of precision needed to index a color table size.
| table_size | Color table size. |
|
static |
Computes power-of-two color table size matching number of palette colors.
| color_count | Quantity of colors. |
| int Gif_WriteIndexed | ( | const char * | path, |
| const u8 * | frames, | ||
| int | frame_count, | ||
| int | width, | ||
| int | height, | ||
| const RgbaColor * | palette, | ||
| int | palette_count, | ||
| int | transparent_index, | ||
| int | delay_cs, | ||
| int | loop_count, | ||
| int | scale | ||
| ) |
Encodes and writes a sequence of indexed frames to a GIF file.
| path | Path to write the final GIF file. |
| frames | Pointer to 8-bit indexed frame pixel buffer. Size: (width * height * frame_count). |
| frame_count | Total number of frames in sequence. |
| width | Canvas width in pixels. |
| height | Canvas height in pixels. |
| palette | Pointer to an array of colors defining the color map (palette). |
| palette_count | Total number of entries in color palette (up to 256). |
| transparent_index | Index in the palette mapping transparency, or -1. |
| delay_cs | Base duration between frames in centiseconds (1/100ths of a second). |
| loop_count | Number of loops (0 = infinite). |
| scale | Bilinear scale multiplier applied to output image sizes. |
|
static |
Flushes remaining bits and terminates image block.
| writer | Bit writer context. |
|
static |
Flushes accumulated byte block buffer of the LZW stream to disk.
| writer | Bit writer context. |
|
static |
Adds a single byte to the output stream block.
| writer | Bit writer context. |
| value | Byte value. |
|
static |
Writes an LZW code of variable bit length.
| writer | Bit writer context. |
| code | LZW code value. |
| code_size | Bit size of the code. |
|
static |
Resolves compatible delay timing constraints to prevent browser lag.
| requested_delay_cs | Target requested delay duration. |
| out_frame_step | Pointer to resolved frame step multiplier. |
| out_delay_cs | Pointer to output resolved delay duration. |
|
static |
Emits LZW literal code stream from pixel index frame data.
| f | Output file stream. |
| frame | Source indexed pixel frame. |
| width | Source frame width. |
| height | Source frame height. |
| scale | Scaling factor. |
| min_code_size | Minimum LZW code size. |
|
static |
Writes a 16-bit unsigned integer in little-endian format to a file stream.
| f | Target file stream. |
| value | Integer value to write. |