GrafX2 2.9.3227
The ultimate 256-color painting program
|
Portable Network Graphics. More...
Data Structures | |
struct | PNG_memory_buffer |
Private structure used in PNG_memory_read() and PNG_memory_write() More... | |
Functions | |
void | Test_PNG (T_IO_Context *context, FILE *file) |
Test for PNG format. More... | |
static int | PNG_read_unknown_chunk (png_structp ptr, png_unknown_chunkp chunk) |
Callback to handle our private chunks. More... | |
static void | PNG_memory_read (png_structp png_ptr, png_bytep p, png_size_t count) |
read from memory buffer More... | |
void | Load_PNG_Sub (T_IO_Context *context, FILE *file, const char *memory_buffer, unsigned long memory_buffer_size) |
Read PNG format file. More... | |
void | Load_PNG (T_IO_Context *context) |
Read PNG format files. More... | |
static void | PNG_memory_write (png_structp png_ptr, png_bytep p, png_size_t count) |
Write to memory buffer. More... | |
static void | PNG_memory_flush (png_structp png_ptr) |
do nothing More... | |
void | Save_PNG_Sub (T_IO_Context *context, FILE *file, char **buffer, unsigned long *buffer_size) |
Save a PNG to file or memory. More... | |
void | Save_PNG (T_IO_Context *context) |
Save a PNG file. More... | |
Portable Network Graphics.
We make use of libpng : http://www.libpng.org/pub/png/libpng.html
void Test_PNG | ( | T_IO_Context * | context, |
FILE * | file | ||
) |
Test for PNG format.
The 8 byte signature at the start of file is tested
References File_error, and Read_bytes().
|
static |
Callback to handle our private chunks.
We have one private chunk at the moment :
References T_IO_Context::Color_cycles, T_IO_Context::Cycle_range, T_Color_cycle::End, flags, GFX2_DEBUG, GFX2_Log(), GFX2_LogHexDump(), T_Color_cycle::Inverse, T_Color_cycle::Speed, T_Color_cycle::Start, and SWAP_BYTES.
Referenced by Load_PNG_Sub().
|
static |
read from memory buffer
References PNG_memory_buffer::buffer, GFX2_DEBUG, GFX2_Log(), NULL, and PNG_memory_buffer::size.
Referenced by Load_PNG_Sub().
void Load_PNG_Sub | ( | T_IO_Context * | context, |
FILE * | file, | ||
const char * | memory_buffer, | ||
unsigned long | memory_buffer_size | ||
) |
Read PNG format file.
References PNG_memory_buffer::buffer, T_Config::Clear_palette, COMMENT_SIZE, Config, CONTEXT_BRUSH, CONTEXT_MAIN_IMAGE, CONTEXT_PALETTE, CONTEXT_PREVIEW, CONTEXT_PREVIEW_PALETTE, CONTEXT_SURFACE, File_error, File_length_file(), FORMAT_PNG, GFX2_DEBUG, GFX2_Log(), MIN, NULL, PIXEL_SIMPLE, PIXEL_TALL, PIXEL_WIDE, png_get_bit_depth, png_get_color_type, png_get_image_height, png_get_image_width, png_get_rowbytes, png_jmpbuf, PNG_memory_read(), PNG_read_unknown_chunk(), png_set_expand_gray_1_2_4_to_8, Pre_load(), Set_pixel(), Set_pixel_24b(), and PNG_memory_buffer::size.
Referenced by Load_BMP_Pixels(), Load_ClipBoard_Image(), Load_ICO(), and Load_PNG().
void Load_PNG | ( | T_IO_Context * | context | ) |
Read PNG format files.
just read/test the header and call Load_PNG_Sub()
References File_error, Load_PNG_Sub(), NULL, Open_file_read(), and Read_bytes().
|
static |
Write to memory buffer.
References PNG_memory_buffer::buffer, File_error, GFX2_DEBUG, GFX2_ERROR, GFX2_Log(), and NULL.
Referenced by Save_PNG_Sub().
|
static |
do nothing
References PNG_memory_buffer::buffer, GFX2_DEBUG, and GFX2_Log().
Referenced by Save_PNG_Sub().
void Save_PNG_Sub | ( | T_IO_Context * | context, |
FILE * | file, | ||
char ** | buffer, | ||
unsigned long * | buffer_size | ||
) |
Save a PNG to file or memory.
context | the IO context |
file | the FILE to write to or NULL to write to memory |
buffer | will receive a malloc'ed buffer if writting to memory |
buffer_size | will receive the PNG size in memory |
References T_IO_Context::Background_transparent, PNG_memory_buffer::buffer, memory_buffer::buffer, T_IO_Context::Color_cycles, T_IO_Context::Comment, T_IO_Context::Cycle_range, T_Color_cycle::End, File_error, flags, T_IO_Context::Height, T_Color_cycle::Inverse, NULL, memory_buffer::offset, T_IO_Context::Palette, T_IO_Context::Pitch, Pixel_ratio, PIXEL_TALL, PIXEL_TALL2, PIXEL_TALL3, PIXEL_WIDE, PIXEL_WIDE2, PNG_HAVE_PLTE, png_jmpbuf, PNG_memory_flush(), PNG_memory_write(), T_Color_cycle::Speed, T_Color_cycle::Start, T_IO_Context::Target_address, T_IO_Context::Transparent_color, and T_IO_Context::Width.
Referenced by Save_ClipBoard_Image(), and Save_PNG().
void Save_PNG | ( | T_IO_Context * | context | ) |
Save a PNG file.
References File_error, NULL, Open_file_write(), Remove_file(), and Save_PNG_Sub().