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

# Class CL_SpriteProvider

ClanLib datafile sprite.
Contained in: global
Derived from: CL_SurfaceProvider_Generic
Derived by: none
Group: Display (Surface Providers)

#include <ClanLib/display.h>

### public function member index:

### Construction:

``static` `CL_Surface`*` | `create` | `(`const` `std::string`& `surface_id`, `CL_InputSourceProvider`* `datafile`)`;
`` | `CL_SpriteProvider` | `(`const` `std::string`& `surface_id`, `CL_InputSourceProvider`* `datafile`)`;
``virtual`` | `~CL_SpriteProvider` | `()`;

### Attributes:

``virtual` `unsigned` `int`` | `get_width` | `() `const``;
``virtual` `unsigned` `int`` | `get_height` | `() `const``;
``virtual` `unsigned` `int`` | `get_pitch` | `() `const``;
``virtual` `unsigned` `int`` | `get_num_frames` | `() `const``;
``virtual` `CL_Palette`*` | `get_palette` | `() `const``;
``virtual` `bool`` | `uses_src_colorkey` | `() `const``;
``virtual` `unsigned` `int`` | `get_src_colorkey` | `() `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` `bool`` | `is_indexed` | `() `const``;
``virtual` `void`*` | `get_data` | `() `const``;

### Operations:

``virtual` `void`` | `perform_lock` | `()`;
``virtual` `void`` | `perform_unlock` | `()`;

### protected function member index:

``void`` | `load_data` | `()`;

## Description:

Used to load surfaces stored in ClanLib's datafile sprite format.

## Function Member Descriptions:

CL_SpriteProvider::CL_SpriteProvider - Constructs a surface provider that represents the sprite 'surface_id' from the inputsource provider 'datafile'.
`` `CL_SpriteProvider` `(`const` `std::string`& `surface_id`, `CL_InputSourceProvider`* `datafile`)`;

CL_SpriteProvider::create - Loads the sprite 'surface_id' from the inputsource provider 'datafile'.
Creates a surface using this sprite (surfaceprovider) and returns it.
This function is a easier way of typing:
CL_Surface::create(new CL_Sprite(surface_id, datafile), true);
``static` `CL_Surface`*` `create` `(`const` `std::string`& `surface_id`, `CL_InputSourceProvider`* `datafile`)`;

CL_SpriteProvider::get_alpha_mask - Get alpha mask
``virtual` `unsigned` `int`` `get_alpha_mask` `() `const``;

CL_SpriteProvider::get_blue_mask - Get blue mask
``virtual` `unsigned` `int`` `get_blue_mask` `() `const``;

CL_SpriteProvider::get_data - Returns a pointer to the sprites image data. Can only be called between lock() and unlock().
``virtual` `void`*` `get_data` `() `const``;

CL_SpriteProvider::get_depth - Get depth
``virtual` `unsigned` `int`` `get_depth` `() `const``;

CL_SpriteProvider::get_green_mask - Get green mask
``virtual` `unsigned` `int`` `get_green_mask` `() `const``;

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

CL_SpriteProvider::get_num_frames - Returns the number of subsprites in this sprite.
``virtual` `unsigned` `int`` `get_num_frames` `() `const``;

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

CL_SpriteProvider::get_pitch - Returns the pitch of the sprite.
``virtual` `unsigned` `int`` `get_pitch` `() `const``;

CL_SpriteProvider::get_red_mask - Get red mask
``virtual` `unsigned` `int`` `get_red_mask` `() `const``;

CL_SpriteProvider::get_src_colorkey - Returns the transparency color used, or -1 if none.
``virtual` `unsigned` `int`` `get_src_colorkey` `() `const``;

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

CL_SpriteProvider::is_indexed - Is indexed
``virtual` `bool`` `is_indexed` `() `const``;

CL_SpriteProvider::perform_lock - Locks the surface provider. This causes the sprite to retrieve its surface data from the datafile.
``virtual` `void`` `perform_lock` `()`;

CL_SpriteProvider::perform_unlock - Unlocks the surface provider. The sprite releases its surface data when it is called.
``virtual` `void`` `perform_unlock` `()`;

CL_SpriteProvider::uses_src_colorkey - Uses src colourkey
``virtual` `bool`` `uses_src_colorkey` `() `const``;

CL_SpriteProvider::~CL_SpriteProvider - Sprite Provider Destructor
``virtual`` `~CL_SpriteProvider` `()`;

## Variable Member Descriptions: