| Description | uses | Classes, Interfaces, Objects and Records | Functions and Procedures | Types | Constants | Variables |
Some utilities to deal with PNGs and libpng.
I don't put these things inside KambiPng unit, because KambiPng unit should contain only the things present in libpng, not some additional related utilities.
| Name | Description |
|---|---|
Class ELibPngNotAvailable |
function SO_PNG_LIBPNG_VER_STRING: PChar; |
function SO_PNG_LIBPNG_VER_MAJOR: Integer; |
function SO_PNG_LIBPNG_VER_MINOR: Integer; |
function SO_PNG_LIBPNG_VER_RELEASE: Integer; |
procedure png_transform_to_rgb3byte(png_ptr: png_structp; info_ptr: png_infop); |
procedure png_transform_to_rgba4byte(png_ptr: png_structp; info_ptr: png_infop); |
function png_has_alpha_info(png_ptr: png_structp; info_ptr: png_infop): boolean; |
function PngColorTypeToStr(PngColorType: longint): string; |
function PngInterlaceTypeToStr(PngInterlaceType: longint): string; |
function PngTextCompressionToStr(PngTextCompression: longint): string; |
function SO_PNG_LIBPNG_VER_STRING: PChar; |
|
Functions SO_Xxx return the version of used libpng library (taken by querying png_access_version_number). They raise ELibPngNotAvailable exception if libpng library was not available (not KambiPngInited) or if version of libpng library is incompatible with interface defined in KamiPng unit. So these functions actually not only return version of libpng, they also check is libpng available (and has the proper version). The three Integer functions should always match the first 3 components of |
function SO_PNG_LIBPNG_VER_MAJOR: Integer; |
function SO_PNG_LIBPNG_VER_MINOR: Integer; |
function SO_PNG_LIBPNG_VER_RELEASE: Integer; |
procedure png_transform_to_rgb3byte(png_ptr: png_structp; info_ptr: png_infop); |
|
Apply transformations in such a way that EVERY png format wil be converted to RGB 8bit depth, no fill, no alpha. So, paletted and grayscales must be converted, bytes got to have appriopriate order, alpha channel must be applied and then thrown out. |
procedure png_transform_to_rgba4byte(png_ptr: png_structp; info_ptr: png_infop); |
|
Apply transformation to convert EVERY png to RGBA 8 byte depth. So, paletted and grayscales must be converted, bytes got to have appriopriate order and alpha channel must be added (=1.0) if it is not already present in file. |
function png_has_alpha_info(png_ptr: png_structp; info_ptr: png_infop): boolean; |
|
png file has alpha info if it is has alpha channel (grayscale or rgb) or if it has tRNS chunk (for paletted image this stores alpha values for each palette color, for grayscale/rgb it determines one particular color to mean "transparent"). Function below checks it. |
function PngColorTypeToStr(PngColorType: longint): string; |
function PngInterlaceTypeToStr(PngInterlaceType: longint): string; |
function PngTextCompressionToStr(PngTextCompression: longint): string; |