FLTK 1.4.3
|
PNG image support functions. More...
#include <config.h>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_RGB_Image.H>
#include <FL/fl_string_functions.h>
#include <FL/fl_utf8.h>
#include <stdio.h>
#include <time.h>
Functions | |
int | fl_write_png (const char *filename, const char *pixels, int w, int h, int d, int ld) |
Write raw image data to a PNG image file. | |
int | fl_write_png (const char *filename, const unsigned char *pixels, int w, int h, int d, int ld) |
Write raw image data to a PNG image file. | |
int | fl_write_png (const char *filename, Fl_RGB_Image *img) |
Write an RGB(A) image to a PNG image file. | |
PNG image support functions.
int fl_write_png | ( | const char * | filename, |
const char * | pixels, | ||
int | w, | ||
int | h, | ||
int | d, | ||
int | ld ) |
Write raw image data to a PNG image file.
This is a very basic and restricted function to create a PNG image file from raw image data, e.g. a screenshot.
The image data must be aligned w/o gaps after each row (ld = 0 or ld = w * d) or ld
must be the total length of each row, i.e. w * d + gapsize. If ld == 0 then ld = w * d is assumed.
The total data size must be (w * d + gapsize) * h = ld' * h where ld' = w * d if ld == 0.
For further restrictions and return values please see fl_write_png(const char *filename, Fl_RGB_Image *img).
[in] | filename | Output filename, extension should be '.png' |
[in] | pixels | Image data |
[in] | w | Image data width |
[in] | h | Image data height |
[in] | d | Image depth: 1 = GRAY, 2 = GRAY + alpha, 3 = RGB, 4 = RGBA |
[in] | ld | Line delta: default (0) = w * d |
int fl_write_png | ( | const char * | filename, |
const unsigned char * | pixels, | ||
int | w, | ||
int | h, | ||
int | d, | ||
int | ld ) |
Write raw image data to a PNG image file.
int fl_write_png | ( | const char * | filename, |
Fl_RGB_Image * | img ) |
Write an RGB(A) image to a PNG image file.
This is a very basic and restricted function to create a PNG image file from an RGB image (Fl_RGB_Image).
The image data must be aligned w/o gaps, i.e. ld() MUST be zero or equal to data_w() * data_h().
The image file is always written with the original image size data_w() and data_h(), even if the image has been scaled.
Image depth 1 (gray), 2 (gray + alpha channel), 3 (RGB) and 4 (RGBA) are supported.
[in] | filename | Output filename, extension should be '.png' |
[in] | img | RGB image to be written |
0 | success, file has been written |
-1 | png or zlib library not available |
-2 | file open error |