![]() | |
![]() | ![]() |
CL_SurfaceImage class in ClanLib. Description
This class is used to draw 2D images onto the backbuffer or to a renderer target. In ClanLib, a surface is understood to be an image represented in a form, where it is most suitable for as fast rendering as possible. Unlike many other libraries, it is not possible to get direct access to the surface data. A surface uses a surface provider to load its data. It is passed at creation time, and you can either roll your own provider, or use one already available in ClanLib. It is also possible to create a surface from a resource source. This will allow you to load an image using a resource ID instead of directly specifying the image in your source code. Dynamic surfacesIf you have an image which changes very frequently (eg. each frame), you want to use a dynamic surface instead. The difference is that the surface won't cache the image, and it won't convert it to another image format more suitable for the display target. Note that this is only faster if you change your image very frequently - otherwise a normal surface is the best solution. When constructing your own images, you will most likely find the canvas surface provider interesting. This class will make it easier to create a custom drawing area where you can draw your image. All surfaceproviders is a renderer target. However, most of the normal surface providers are "read only", meaning that their image data will only remain intact during a lock session. This is because the providers consume less memory when the image is only available, when someone needs it. Only the canvas provider will not destroy the image. A surface can blit (draw itself) itself to the backbuffer, or to a renderer target. This means that you can use the surface to draw one surface provider to another. Class membersstatic CL_Surface *load( const char *resource_id, CL_ResourceManager *manager) See AlsoNone |