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

# Class CL_SurfaceProvider

The image source interface.
Contained in: global
Derived from: CL_Target
Derived by: CL_Canvas CL_JPEGProvider CL_JPGDProvider CL_SurfaceProvider_32bpp CL_SurfaceProvider_Generic
Group: Display (Display 2D)

#include <ClanLib/display.h>

### public function member index:

### Construction:

``static` `CL_SurfaceProvider`*` | `load` | `(`const` `std::string`& `resource_id`, `CL_ResourceManager`* `manager`)`;
``virtual`` | `~CL_SurfaceProvider` | `()`;

### Attributes:

``virtual` `int`` | `get_translate_x` | `() `const``;
``virtual` `int`` | `get_translate_y` | `() `const``;
``virtual` `bool`` | `uses_src_colorkey` | `() `const``;
``virtual` `unsigned` `int`` | `get_src_colorkey` | `() `const``;
``virtual` `void`` | `get_pixel` | `(`int` `x`, `int` `y`, `float`* `r`, `float`* `g`, `float`* `b`, `float`* `a`)`;
``virtual` `int`` | `get_pixel` | `(`int` `x`, `int` `y`)`;

## Description:

This is the interface used by a CL_Surface surface to load an image. For more information about the relationship between a surface and its provider, please the CL_Surface class description.
The surface provider interface extends the CL_Target renderer target interface with some blitting related functions. Currently, this is translation of the image and colorkey transparency.
ClanLib includes a large range of surface providers that can load an image from various sources: PCX, TGA, PNG and so on.
If you want to be able to load your (newly created) surface provider as a resource, you have to implement the CL_ResourceSource_Surface as well.

## Function Member Descriptions:

CL_SurfaceProvider::get_pixel - Get Pixel
``virtual` `void`` `get_pixel` `(`int` `x`, `int` `y`, `float`* `r`, `float`* `g`, `float`* `b`, `float`* `a`)`;

CL_SurfaceProvider::get_pixel - Get Pixel
``virtual` `int`` `get_pixel` `(`int` `x`, `int` `y`)`;

CL_SurfaceProvider::get_src_colorkey - Returns the source color key.
``virtual` `unsigned` `int`` `get_src_colorkey` `() `const``;

CL_SurfaceProvider::get_translate_x - Returns the offset of the surface_data returned by get_data(). This translation will be applied to every putscreen using a given surfaceproviders data as input.
``virtual` `int`` `get_translate_x` `() `const``;

> Returns - The x-offset of the surface data.

CL_SurfaceProvider::get_translate_y - Returns the offset of the surface_data returned by get_data(). This translation will be applied to every putscreen using a given surfaceproviders data as input.
``virtual` `int`` `get_translate_y` `() `const``;

> Returns - The y-offset of the surface data.

CL_SurfaceProvider::load - This function loads a surface provider from a resource file (usually a datafile).
``static` `CL_SurfaceProvider`*` `load` `(`const` `std::string`& `resource_id`, `CL_ResourceManager`* `manager`)`;

CL_SurfaceProvider::uses_src_colorkey - Returns true if the surface provider uses a source color key.
``virtual` `bool`` `uses_src_colorkey` `() `const``;

CL_SurfaceProvider::~CL_SurfaceProvider - Surface Provider Destructor
``virtual`` `~CL_SurfaceProvider` `()`;