Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_PNGProvider

Surface provider that can load PNG (.png) files.
Contained in: global
Derived from: CL_SurfaceProvider_Generic
Derived by: none
Group: PNG (Surface Providers)

#include <ClanLib/png.h>

### public function member index:

### Construction:

``static` `CL_Surface`*` | `create` | `(`CL_String` `handle`, `CL_InputSourceProvider`* `provider`=NULL, `bool` `transparent`=true, `bool` `ignore_alphachannel`=false)`;
`` | `CL_PNGProvider` | `(`CL_String` `name`, `CL_InputSourceProvider`* `provider` = NULL, `bool` `transparent`=true, `bool` `ignore_alphachannel`=false)`;
``virtual`` | `~CL_PNGProvider` | `()`;

### Attributes:

``CL_InputSource`*` | `get_input_source` | `()`;
``virtual` `unsigned` `int`` | `get_pitch` | `() `const``;
``virtual` `unsigned` `int`` | `get_width` | `() `const``;
``virtual` `unsigned` `int`` | `get_height` | `() `const``;
``virtual` `unsigned` `int`` | `get_num_frames` | `() `const``;
``virtual` `EPixelFormat`` | `get_pixel_format` | `() `const``;
``virtual` `CL_Palette`*` | `get_palette` | `() `const``;
``virtual` `unsigned` `int`` | `get_src_colorkey` | `() `const``;
``virtual` `bool`` | `uses_src_colorkey` | `() `const``;
``virtual` `bool`` | `is_indexed` | `() `const``;
``virtual` `unsigned` `int`` | `get_red_mask` | `() `const``;
``virtual` `unsigned` `int`` | `get_green_mask` | `() `const``;
``virtual` `unsigned` `int`` | `get_blue_mask` | `() `const``;
``virtual` `unsigned` `int`` | `get_alpha_mask` | `() `const``;
``virtual` `unsigned` `int`` | `get_depth` | `() `const``;
``virtual` `void`*` | `get_data` | `() `const``;

### Operations:

``virtual` `void`` | `perform_lock` | `()`;
``virtual` `void`` | `perform_unlock` | `()`;
``static` `void`` | `pngread_file` | `(`png_structp` `png_ptr`, `png_bytep` `data`, `png_size_t` `length`)`;

### private function member index:

### Implementation:

``void`` | `read_data` | `()`;
``void`` | `read_data_rgb` | `()`;
``void`` | `read_data_rgba` | `()`;
``void`` | `read_data_grayscale` | `()`;
``void`` | `read_data_grayscale_alpha` | `()`;
``void`` | `read_data_palette` | `()`;

## Description:

## Function Member Descriptions:

CL_PNGProvider::CL_PNGProvider - Constructs a surface provider that can read PNG files.
`` `CL_PNGProvider` `(`CL_String` `name`, `CL_InputSourceProvider`* `provider` = NULL, `bool` `transparent`=true, `bool` `ignore_alphachannel`=false)`;

> name - Name of the PNG file to load.
> provider - Input source provider that delivers the PNG file.
> transparent - True if a transparency color should be used.
> ignore_alphachannel - True if the alpha component should be ignored.
> trans_red - Red component of the transparency color.
> trans_green - Green component of the transparency color.
> trans_blue - blue component of the transparency color.

CL_PNGProvider::create - Loads the PNG file 'handle' from the inputsource provider 'provider.
Creates a CL_Surface using the PNG image and returns it.
``static` `CL_Surface`*` `create` `(`CL_String` `handle`, `CL_InputSourceProvider`* `provider`=NULL, `bool` `transparent`=true, `bool` `ignore_alphachannel`=false)`;

CL_PNGProvider::get_alpha_mask - Returns the alpha mask by the target.
``virtual` `unsigned` `int`` `get_alpha_mask` `() `const``;

CL_PNGProvider::get_blue_mask - Returns the blue color mask by the target.
``virtual` `unsigned` `int`` `get_blue_mask` `() `const``;

CL_PNGProvider::get_data - Returns the image data. Provider must be locked before pointer is valid.
``virtual` `void`*` `get_data` `() `const``;

CL_PNGProvider::get_depth - Returns the bit depth of the surface provider
``virtual` `unsigned` `int`` `get_depth` `() `const``;

CL_PNGProvider::get_green_mask - Returns the green color mask by the target.
``virtual` `unsigned` `int`` `get_green_mask` `() `const``;

CL_PNGProvider::get_height - Returns the height of the image.
``virtual` `unsigned` `int`` `get_height` `() `const``;

CL_PNGProvider::get_input_source - returns Pointer to CL_InputSource
(used by libpng-callback CL_PNGProvider::pngread_file() )
``CL_InputSource`*` `get_input_source` `()`;

CL_PNGProvider::get_num_frames - Returns the number of subsprites in the image.
``virtual` `unsigned` `int`` `get_num_frames` `() `const``;

CL_PNGProvider::get_palette - Returns the palette used by the image. NULL if system palette.
``virtual` `CL_Palette`*` `get_palette` `() `const``;

CL_PNGProvider::get_pitch - Returns the pitch of the image (bytes per line).
``virtual` `unsigned` `int`` `get_pitch` `() `const``;

CL_PNGProvider::get_pixel_format - Returns the pixelformat used by the image.
``virtual` `EPixelFormat`` `get_pixel_format` `() `const``;

CL_PNGProvider::get_red_mask - Returns the red color mask used by the target.
``virtual` `unsigned` `int`` `get_red_mask` `() `const``;

CL_PNGProvider::get_src_colorkey - Returns the transparency color used.
``virtual` `unsigned` `int`` `get_src_colorkey` `() `const``;

CL_PNGProvider::get_width - Returns the width of the image.
``virtual` `unsigned` `int`` `get_width` `() `const``;

CL_PNGProvider::is_indexed - Returns whether the target uses an indexed color mode or not.
``virtual` `bool`` `is_indexed` `() `const``;

CL_PNGProvider::perform_lock - Locks the surface provider.
``virtual` `void`` `perform_lock` `()`;

CL_PNGProvider::perform_unlock - Unlocks the surface provider.
``virtual` `void`` `perform_unlock` `()`;

CL_PNGProvider::pngread_file - Callback used by libpng to retrieve the filedata.
(calls get_input_source()->read_uchar8())
``static` `void`` `pngread_file` `(`png_structp` `png_ptr`, `png_bytep` `data`, `png_size_t` `length`)`;

CL_PNGProvider::uses_src_colorkey - Returns whether a source colorkey is used.
``virtual` `bool`` `uses_src_colorkey` `() `const``;

## Variable Member Descriptions: