Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CEGUI::Imageset Class Reference

Offers functions to define, access, and draw, a set of image components on a single graphical surface or Texture. More...

#include <CEGUIImageset.h>

Collaboration diagram for CEGUI::Imageset:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ConstBaseIterator<
ImageRegistry > 
ImageIterator
 Iterator type for this collection.

Public Member Functions

 ~Imageset (void)
 Destroys Imageset objects.
TexturegetTexture (void) const
 return Texture object for this Imageset
const StringgetName (void) const
 return String object holding the name of the Imageset
uint getImageCount (void) const
 return number of images defined for this Imageset
bool isImageDefined (const String &name) const
 return true if an Image with the specified name exists.
const ImagegetImage (const String &name) const
 return a copy of the Image object for the named image
void undefineImage (const String &name)
 remove the definition for the Image with the specified name. If no such Image exists, nothing happens.
void undefineAllImages (void)
 Removes the definitions for all Image objects currently defined in the Imageset.
Size getImageSize (const String &name) const
 return a Size object describing the dimensions of the named image.
float getImageWidth (const String &name) const
 return the width of the named image.
float getImageHeight (const String &name) const
 return the height of the named image.
Point getImageOffset (const String &name) const
 return the rendering offsets applied to the named image.
float getImageOffsetX (const String &name) const
 return the x rendering offset for the named image.
float getImageOffsetY (const String &name) const
 return the y rendering offset for the named image.
void defineImage (const String &name, const Point &position, const Size &size, const Point &render_offset)
 Define a new Image for this Imageset.
void defineImage (const String &name, const Rect &image_rect, const Point &render_offset)
 Define a new Image for this Imageset.
void draw (const Rect &source_rect, const Rect &dest_rect, float z, const Rect &clip_rect, const ColourRect &colours, QuadSplitMode quad_split_mode) const
 Queues an area of the associated Texture the be drawn on the screen. Low-level routine to be used carefully!
void draw (const Rect &source_rect, const Rect &dest_rect, float z, const Rect &clip_rect, const colour &top_left_colour=-1, const colour &top_right_colour=-1, const colour &bottom_left_colour=-1, const colour &bottom_right_colour=-1, QuadSplitMode quad_split_mode=TopLeftToBottomRight) const
 Queues an area of the associated Texture the be drawn on the screen. Low-level routine to be used carefully!
bool isAutoScaled (void) const
 Return whether this Imageset is auto-scaled.
Size getNativeResolution (void) const
 Return the native display size for this Imageset. This is only relevant if the Imageset is being auto-scaled.
void setAutoScalingEnabled (bool setting)
 Enable or disable auto-scaling for this Imageset.
void setNativeResolution (const Size &size)
 Set the native resolution for this Imageset.
void notifyScreenResolution (const Size &size)
 Notify the Imageset of the current (usually new) display resolution.
ImageIterator getIterator (void) const
 Return an Imageset::ImageIterator object that can be used to iterate over the Image objects in the Imageset.

Protected Member Functions

void load (const String &filename, const String &resourceGroup)
 Initialise the Imageset with information taken from the specified file.
void unload (void)
 Unloads all loaded data and leaves the Imageset in a clean (but un-usable) state. This should be called for cleanup purposes only.
void setTexture (Texture *texture)
 set the Texture object to be used by this Imageset. Changing textures on an Imageset that is in use is not a good idea!
void updateImageScalingFactors (void)
 Sets the scaling factor for all Images that are a part of this Imageset.

Protected Attributes

String d_name
 Holds the name of this imageset.
ImageRegistry d_images
 Registry of Image objects for the images defined for this Imageset.
Textured_texture
 Texture object that handles imagery for this Imageset.
bool d_autoScale
 true when auto-scaling is enabled.
float d_horzScaling
 current horizontal scaling factor.
float d_vertScaling
 current vertical scaling factor.
float d_nativeHorzRes
 native horizontal resolution for this Imageset.
float d_nativeVertRes
 native vertical resolution for this Imageset.

Static Protected Attributes

const char ImagesetSchemaName [] = "Imageset.xsd"
 Filename of the XML schema used for validating Imageset files.

Friends

class Imageset_xmlHandler
ImagesetImagesetManager::createImageset (const String &name, Texture *texture)
ImagesetImagesetManager::createImageset (const String &filename, const String &resourceGroup)
void ImagesetManager::destroyImageset (const String &name)

Detailed Description

Offers functions to define, access, and draw, a set of image components on a single graphical surface or Texture.

Imageset objects are a means by which a single graphical image (file, Texture, etc), can be split into a number of 'components' which can later be accessed via name. The components of an Imageset can queried for various details, and sent to the Renderer object for drawing.

Definition at line 58 of file CEGUIImageset.h.


Member Typedef Documentation

typedef ConstBaseIterator<ImageRegistry> CEGUI::Imageset::ImageIterator
 

Iterator type for this collection.

Definition at line 111 of file CEGUIImageset.h.

Referenced by getIterator().


Constructor & Destructor Documentation

CEGUI::Imageset::~Imageset void   ) 
 

Destroys Imageset objects.

Definition at line 88 of file CEGUIImageset.cpp.

References unload().


Member Function Documentation

void CEGUI::Imageset::defineImage const String name,
const Rect image_rect,
const Point render_offset
 

Define a new Image for this Imageset.

Parameters:
name String object holding the name that will be assigned to the new Image, which must be unique within the Imageset.
image_rect Rect object describing the area on the image file / texture associated with this Imageset that will be used for the Image.
render_offset Point object describing the offsets, in pixels, that are to be applied to the Image when it is drawn.
Returns:
Nothing
Exceptions:
AlreadyExistsException thrown if an Image named name is already defined for this Imageset

Definition at line 225 of file CEGUIImageset.cpp.

References CEGUI_LOGINSANE, d_autoScale, d_horzScaling, d_images, d_name, d_vertScaling, isImageDefined(), and CEGUI::Point.

void CEGUI::Imageset::defineImage const String name,
const Point position,
const Size size,
const Point render_offset
[inline]
 

Define a new Image for this Imageset.

Parameters:
name String object holding the name that will be assigned to the new Image, which must be unique within the Imageset.
position Point object describing the pixel location of the Image on the image file / texture associated with this Imageset.
size Size object describing the dimensions of the Image, in pixels.
render_offset Point object describing the offsets, in pixels, that are to be applied to the Image when it is drawn.
Returns:
Nothing
Exceptions:
AlreadyExistsException thrown if an Image named name is already defined for this Imageset

Definition at line 307 of file CEGUIImageset.h.

References CEGUI::Size::d_height, CEGUI::Size::d_width, CEGUI::Vector2::d_x, CEGUI::Vector2::d_y, and CEGUI::Point.

Referenced by CEGUI::Imageset_xmlHandler::startElement().

void CEGUI::Imageset::draw const Rect source_rect,
const Rect dest_rect,
float  z,
const Rect clip_rect,
const colour top_left_colour = -1,
const colour top_right_colour = -1,
const colour bottom_left_colour = -1,
const colour bottom_right_colour = -1,
QuadSplitMode  quad_split_mode = TopLeftToBottomRight
const [inline]
 

Queues an area of the associated Texture the be drawn on the screen. Low-level routine to be used carefully!

Parameters:
source_rect Rect object describing the area of the image file / texture that is to be queued for drawing
dest_rect Rect describing the area of the screen that will be filled with the imagery from source_rect.
z float value specifying 'z' order. 0 is topmost with increasing values moving back into the screen.
clip_rect Rect object describing a 'clipping rectangle' that will be applied when drawing the requested imagery
top_left_colour colour to be applied to the top left corner of the rendered imagery.
top_right_colour colour to be applied to the top right corner of the rendered imagery.
bottom_left_colour colour to be applied to the bottom left corner of the rendered imagery.
bottom_right_colour colour to be applied to the bottom right corner of the rendered imagery.
quad_split_mode One of the QuadSplitMode values specifying the way quads are split into triangles
Returns:
Nothing

Definition at line 396 of file CEGUIImageset.h.

void CEGUI::Imageset::draw const Rect source_rect,
const Rect dest_rect,
float  z,
const Rect clip_rect,
const ColourRect colours,
QuadSplitMode  quad_split_mode
const
 

Queues an area of the associated Texture the be drawn on the screen. Low-level routine to be used carefully!

Parameters:
source_rect Rect object describing the area of the image file / texture that is to be queued for drawing
dest_rect Rect describing the area of the screen that will be filled with the imagery from source_rect.
z float value specifying 'z' order. 0 is topmost with increasing values moving back into the screen.
clip_rect Rect object describing a 'clipping rectangle' that will be applied when drawing the requested imagery
colours ColourRect object holding the ARGB colours to be applied to the four corners of the rendered imagery.
quad_split_mode One of the QuadSplitMode values specifying the way quads are split into triangles
Returns:
Nothing

Definition at line 247 of file CEGUIImageset.cpp.

References CEGUI::Renderer::addQuad(), CEGUI::Rect::d_bottom, CEGUI::Rect::d_left, CEGUI::Rect::d_right, d_texture, CEGUI::Rect::d_top, CEGUI::Rect::getHeight(), CEGUI::Texture::getHeight(), CEGUI::Rect::getIntersection(), CEGUI::Texture::getRenderer(), CEGUI::Rect::getWidth(), CEGUI::Texture::getWidth(), and PixelAligned.

Referenced by CEGUI::Image::draw().

const Image & CEGUI::Imageset::getImage const String name  )  const
 

return a copy of the Image object for the named image

Parameters:
name String object holding the name of the Image object to be returned
Returns:
constant Image object that has the requested name.
Exceptions:
UnknownObjectException thrown if no Image named name is defined for the Imageset

Definition at line 209 of file CEGUIImageset.cpp.

References d_images, d_name, and CEGUI::String::find().

Referenced by CEGUI::Font_xmlHandler::startElement().

uint CEGUI::Imageset::getImageCount void   )  const [inline]
 

return number of images defined for this Imageset

Returns:
uint value equal to the number of Image objects defined for the Imageset

Definition at line 143 of file CEGUIImageset.h.

References CEGUI::uint.

float CEGUI::Imageset::getImageHeight const String name  )  const [inline]
 

return the height of the named image.

Parameters:
name String object holding the name of the Image.
Returns:
float value equalling the height of the requested Image.
Exceptions:
UnknownObjectException thrown if no Image named name is defined for the Imageset

Definition at line 238 of file CEGUIImageset.h.

Point CEGUI::Imageset::getImageOffset const String name  )  const [inline]
 

return the rendering offsets applied to the named image.

Parameters:
name String object holding the name of the Image.
Returns:
Point object that holds the rendering offsets for the requested Image.
Exceptions:
UnknownObjectException thrown if no Image named name is defined for the Imageset

Definition at line 253 of file CEGUIImageset.h.

References CEGUI::Point.

float CEGUI::Imageset::getImageOffsetX const String name  )  const [inline]
 

return the x rendering offset for the named image.

Parameters:
name String object holding the name of the Image.
Returns:
float value equal to the x rendering offset applied when drawing the requested Image.
Exceptions:
UnknownObjectException thrown if no Image named name is defined for the Imageset

Definition at line 268 of file CEGUIImageset.h.

float CEGUI::Imageset::getImageOffsetY const String name  )  const [inline]
 

return the y rendering offset for the named image.

Parameters:
name String object holding the name of the Image.
Returns:
float value equal to the y rendering offset applied when drawing the requested Image.
Exceptions:
UnknownObjectException thrown if no Image named name is defined for the Imageset

Definition at line 283 of file CEGUIImageset.h.

Size CEGUI::Imageset::getImageSize const String name  )  const [inline]
 

return a Size object describing the dimensions of the named image.

Parameters:
name String object holding the name of the Image.
Returns:
Size object holding the dimensions of the requested Image.
Exceptions:
UnknownObjectException thrown if no Image named name is defined for the Imageset

Definition at line 208 of file CEGUIImageset.h.

float CEGUI::Imageset::getImageWidth const String name  )  const [inline]
 

return the width of the named image.

Parameters:
name String object holding the name of the Image.
Returns:
float value equalling the width of the requested Image.
Exceptions:
UnknownObjectException thrown if no Image named name is defined for the Imageset

Definition at line 223 of file CEGUIImageset.h.

Imageset::ImageIterator CEGUI::Imageset::getIterator void   )  const
 

Return an Imageset::ImageIterator object that can be used to iterate over the Image objects in the Imageset.

Definition at line 365 of file CEGUIImageset.cpp.

References d_images, and ImageIterator.

const String& CEGUI::Imageset::getName void   )  const [inline]
 

return String object holding the name of the Imageset

Returns:
String object that holds the name of the Imageset.

Definition at line 133 of file CEGUIImageset.h.

Referenced by CEGUI::ImagesetManager::createImageset(), CEGUI::ImagesetManager::destroyImageset(), CEGUI::Image::getImagesetName(), and CEGUI::Scheme::loadResources().

Size CEGUI::Imageset::getNativeResolution void   )  const [inline]
 

Return the native display size for this Imageset. This is only relevant if the Imageset is being auto-scaled.

Returns:
Size object describing the native display size for this Imageset.

Definition at line 419 of file CEGUIImageset.h.

Texture* CEGUI::Imageset::getTexture void   )  const [inline]
 

return Texture object for this Imageset

Returns:
Texture object that holds the imagery for this Imageset

Definition at line 123 of file CEGUIImageset.h.

bool CEGUI::Imageset::isAutoScaled void   )  const [inline]
 

Return whether this Imageset is auto-scaled.

Returns:
true if Imageset is auto-scaled, false if not.

Definition at line 409 of file CEGUIImageset.h.

bool CEGUI::Imageset::isImageDefined const String name  )  const [inline]
 

return true if an Image with the specified name exists.

Parameters:
name String object holding the name of the Image to look for.
Returns:
true if an Image object named name is defined for this Imageset, else false.

Definition at line 156 of file CEGUIImageset.h.

Referenced by defineImage().

void CEGUI::Imageset::load const String filename,
const String resourceGroup
[protected]
 

Initialise the Imageset with information taken from the specified file.

Parameters:
filename String object that holds the name of the Imageset data file that is to be processed.
resourceGroup Resource group identifier to be passed to the resource manager. NB: This affects the imageset xml file only, the texture loaded may have its own group specified in the XML file.
Returns:
Nothing
Exceptions:
FileIOException thrown if something goes wrong while processing the file filename.

Definition at line 111 of file CEGUIImageset.cpp.

References CEGUI::String::c_str(), CEGUI::String::empty(), CEGUI::DataContainer< T >::getDataPtr(), CEGUI::DataContainer< T >::getSize(), ImagesetSchemaName, unload(), and CEGUI::utf8.

void CEGUI::Imageset::notifyScreenResolution const Size size  ) 
 

Notify the Imageset of the current (usually new) display resolution.

Parameters:
size Size object describing the display resolution
Returns:
Nothing

Definition at line 348 of file CEGUIImageset.cpp.

References CEGUI::Size::d_height, d_horzScaling, d_vertScaling, CEGUI::Size::d_width, and updateImageScalingFactors().

Referenced by CEGUI::ImagesetManager::notifyScreenResolution(), CEGUI::Font::notifyScreenResolution(), and setNativeResolution().

void CEGUI::Imageset::setAutoScalingEnabled bool  setting  ) 
 

Enable or disable auto-scaling for this Imageset.

Parameters:
setting true to enable auto-scaling, false to disable auto-scaling.
Returns:
Nothing.

Definition at line 321 of file CEGUIImageset.cpp.

References d_autoScale, and updateImageScalingFactors().

Referenced by CEGUI::Font::setAutoScalingEnabled(), and CEGUI::Imageset_xmlHandler::startElement().

void CEGUI::Imageset::setNativeResolution const Size size  ) 
 

Set the native resolution for this Imageset.

Parameters:
size Size object describing the new native screen resolution for this Imageset.
Returns:
Nothing

Definition at line 335 of file CEGUIImageset.cpp.

References CEGUI::Size::d_height, d_nativeHorzRes, d_nativeVertRes, CEGUI::Size::d_width, and notifyScreenResolution().

Referenced by CEGUI::Font::setNativeResolution(), and CEGUI::Imageset_xmlHandler::startElement().

void CEGUI::Imageset::setTexture Texture texture  )  [protected]
 

set the Texture object to be used by this Imageset. Changing textures on an Imageset that is in use is not a good idea!

Parameters:
texture Texture object to be used by the Imageset. The old texture is NOT disposed of, that is the clients responsibility.
Returns:
Nothing
Exceptions:
NullObjectException thrown if texture is NULL

Definition at line 97 of file CEGUIImageset.cpp.

References d_texture, and CEGUI::utf8.

void CEGUI::Imageset::undefineAllImages void   ) 
 

Removes the definitions for all Image objects currently defined in the Imageset.

Returns:
Nothing

Definition at line 379 of file CEGUIImageset.cpp.

References CEGUI_LOGINSANE, d_images, and d_name.

Referenced by unload().

void CEGUI::Imageset::undefineImage const String name  ) 
 

remove the definition for the Image with the specified name. If no such Image exists, nothing happens.

Parameters:
name String object holding the name of the Image object to be removed from the Imageset,
Returns:
Nothing.

Definition at line 371 of file CEGUIImageset.cpp.

References CEGUI_LOGINSANE, d_images, and d_name.

void CEGUI::Imageset::unload void   )  [protected]
 

Unloads all loaded data and leaves the Imageset in a clean (but un-usable) state. This should be called for cleanup purposes only.

Definition at line 281 of file CEGUIImageset.cpp.

References d_texture, CEGUI::Renderer::destroyTexture(), and undefineAllImages().

Referenced by load(), and ~Imageset().

void CEGUI::Imageset::updateImageScalingFactors void   )  [protected]
 

Sets the scaling factor for all Images that are a part of this Imageset.

Returns:
Nothing.

Definition at line 294 of file CEGUIImageset.cpp.

References d_images.

Referenced by notifyScreenResolution(), and setAutoScalingEnabled().


Friends And Related Function Documentation

friend class Imageset_xmlHandler [friend]
 

Definition at line 60 of file CEGUIImageset.h.

Imageset* ImagesetManager::createImageset const String filename,
const String resourceGroup
[friend]
 

Imageset* ImagesetManager::createImageset const String name,
Texture texture
[friend]
 

void ImagesetManager::destroyImageset const String name  )  [friend]
 


Member Data Documentation

bool CEGUI::Imageset::d_autoScale [protected]
 

true when auto-scaling is enabled.

Definition at line 536 of file CEGUIImageset.h.

Referenced by defineImage(), and setAutoScalingEnabled().

float CEGUI::Imageset::d_horzScaling [protected]
 

current horizontal scaling factor.

Definition at line 537 of file CEGUIImageset.h.

Referenced by defineImage(), and notifyScreenResolution().

ImageRegistry CEGUI::Imageset::d_images [protected]
 

Registry of Image objects for the images defined for this Imageset.

Definition at line 532 of file CEGUIImageset.h.

Referenced by defineImage(), getImage(), getIterator(), undefineAllImages(), undefineImage(), and updateImageScalingFactors().

String CEGUI::Imageset::d_name [protected]
 

Holds the name of this imageset.

Definition at line 531 of file CEGUIImageset.h.

Referenced by defineImage(), CEGUI::Imageset_xmlHandler::endElement(), getImage(), CEGUI::Imageset_xmlHandler::startElement(), undefineAllImages(), and undefineImage().

float CEGUI::Imageset::d_nativeHorzRes [protected]
 

native horizontal resolution for this Imageset.

Definition at line 539 of file CEGUIImageset.h.

Referenced by setNativeResolution().

float CEGUI::Imageset::d_nativeVertRes [protected]
 

native vertical resolution for this Imageset.

Definition at line 540 of file CEGUIImageset.h.

Referenced by setNativeResolution().

Texture* CEGUI::Imageset::d_texture [protected]
 

Texture object that handles imagery for this Imageset.

Definition at line 533 of file CEGUIImageset.h.

Referenced by draw(), setTexture(), CEGUI::Imageset_xmlHandler::startElement(), and unload().

float CEGUI::Imageset::d_vertScaling [protected]
 

current vertical scaling factor.

Definition at line 538 of file CEGUIImageset.h.

Referenced by defineImage(), and notifyScreenResolution().

const char CEGUI::Imageset::ImagesetSchemaName = "Imageset.xsd" [static, protected]
 

Filename of the XML schema used for validating Imageset files.

Definition at line 50 of file CEGUIImageset.cpp.

Referenced by load().


The documentation for this class was generated from the following files:
Generated on Wed Feb 16 12:41:10 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1