KSD_EXPORT_CLASSclass TImage

An image surface.

Inheritance:


Public Fields

[more]SigC::Signal1<void, TImage*> OnChange
Signal called when image is modified

Public Methods

[more] TImage()
Constructs an un-initialized image.
[more] TImage(int width, int height, TPixelFormatType pixel_format = TPixelFormat::DISPLAY, Uint8 image_type = SYSTEM_MEMORY)
Construct an image with the given attributes.
[more] TImage(int width, int height, Uint8 bpp, Uint8 image_type = SYSTEM_MEMORY)
Construct an image with the given attributes.
[more] TImage(const char* filename, char* type = "AUTODETECT")
Contruct an image loaded from the given file.
[more] TImage(const TImage& V)
Contruct an image as a copy of an other image.
[more]TImage& operator = (const TImage& V)
Assign this image to the data of another image.
[more] ~TImage()
destructor
[more]void Create(int width, int height, TPixelFormatType pixel_format = TPixelFormat::DISPLAY, Uint8 image_type = SYSTEM_MEMORY)
Initialize this image with the given attributes.
[more]void Create(int width, int height, Uint8 bpp, Uint8 image_flags = SYSTEM_MEMORY)
Initialize this image with the given attributes.
[more]TImage Convert(const TPixelFormat &pixel_format, Uint8 image_type)
Convert an image to the given format
[more]TImage Convert(const TPixelFormat &pixel_format)
Convert an image to the given format
[more]void Load(const char* Filename, char* type = "AUTODETECT")
Load the image data from a file.
[more]void Save(const char* Filename, char* type)
Save the image data to a file.
[more]void OnWrite()
Call this function to perform "copy on write"
[more]void Resize(int width, int height)
Resizes the image to the given dimensions
[more]TSubSurface* CreateSubSurface(int X, int Y, int Width, int Height, bool Buffered)
Creates a sub-surface with the given dimensions
[more]void Fill(const TColor& Color)
Clears the image with the given color
[more]TCanvas* GetCanvas()
Returns a TCanvas object for drawing to this image.
[more]void SetSurface(SDL_Surface* sdl_surface, bool owned = true)
Sets this image to an sdl_surface.
[more]SDL_Surface* GetSurface()
Returns the SDL_Surface object underlying this image


Documentation

An image surface. TImage is a surface that you can construct to any artibrary size, load files, save files, and draw to. TImage objects are copied on write. This means that when one image is assigned to another, its data is shared until one of the images is actually written to.
o TImage()
Constructs an un-initialized image. Use Create or Load to make a valid image.

o TImage(int width, int height, TPixelFormatType pixel_format = TPixelFormat::DISPLAY, Uint8 image_type = SYSTEM_MEMORY)
Construct an image with the given attributes. Uses the same arguments as Create.

o TImage(int width, int height, Uint8 bpp, Uint8 image_type = SYSTEM_MEMORY)
Construct an image with the given attributes. Uses the same arguments as Create.

o TImage(const char* filename, char* type = "AUTODETECT")
Contruct an image loaded from the given file. Uses the same arguments as Load.

o TImage(const TImage& V)
Contruct an image as a copy of an other image. The image is not actually copied until the copy is written to (called "copy on write").

oTImage& operator = (const TImage& V)
Assign this image to the data of another image. The image is not actually copied until the copy is written to (called "copy on write").

o ~TImage()
destructor

oSigC::Signal1<void, TImage*> OnChange
Signal called when image is modified

ovoid Create(int width, int height, TPixelFormatType pixel_format = TPixelFormat::DISPLAY, Uint8 image_type = SYSTEM_MEMORY)
Initialize this image with the given attributes.

Parameters:
width - The desired width.
height - The desired height.
pixel_format - The desired TPixelFormatType for this image.
image_type - Controls the type of image that is created.

ovoid Create(int width, int height, Uint8 bpp, Uint8 image_flags = SYSTEM_MEMORY)
Initialize this image with the given attributes.

Parameters:
width - The desired width.
height - The desired height.
pixel_format - The desired TPixelFormatType for this image.
image_type - Controls the type of image that is created.

oTImage Convert(const TPixelFormat &pixel_format, Uint8 image_type)
Convert an image to the given format

oTImage Convert(const TPixelFormat &pixel_format)
Convert an image to the given format

ovoid Load(const char* Filename, char* type = "AUTODETECT")
Load the image data from a file. The image loader uses a plugin system, so make sure that you have the appropriate plugins loaded. You can specify an image type string as the type argument as one of the following:

ovoid Save(const char* Filename, char* type)
Save the image data to a file. The image loaded uses a plugin system, so make sure that you have the approprate plugins loaded. Currently, the only valid image type string is "BMP".

ovoid OnWrite()
Call this function to perform "copy on write"

ovoid Resize(int width, int height)
Resizes the image to the given dimensions

oTSubSurface* CreateSubSurface(int X, int Y, int Width, int Height, bool Buffered)
Creates a sub-surface with the given dimensions

ovoid Fill(const TColor& Color)
Clears the image with the given color

oTCanvas* GetCanvas()
Returns a TCanvas object for drawing to this image. This function is garenteed to return a valid pointer.

ovoid SetSurface(SDL_Surface* sdl_surface, bool owned = true)
Sets this image to an sdl_surface. The reference to previous surface is first cleared.

oSDL_Surface* GetSurface()
Returns the SDL_Surface object underlying this image


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.