Rocket::Core::ElementImage Class Reference

#include <ElementImage.h>

Inheritance diagram for Rocket::Core::ElementImage:
Collaboration diagram for Rocket::Core::ElementImage:

Public Member Functions

 ElementImage (const String &tag)
bool GetIntrinsicDimensions (Vector2f &dimensions)

Protected Member Functions

virtual void OnRender ()
 Renders the image.
virtual void OnAttributeChange (const AttributeNameList &changed_attributes)
virtual void ProcessEvent (Event &event)

Detailed Description

The 'img' element. The image element can have a rectangular sub-region of its source texture specified with the 'coords' attribute; the element will render this region rather than the entire image.

The 'coords' attribute is similar to that of the HTML imagemap. It takes four comma-separated integer values, specifying the top-left and the bottom right of the region in pixel-coordinates, in that order. So for example, the attribute "coords" = "0, 10, 100, 210" will render a 100 x 200 region, beginning at (0, 10) and rendering through to (100, 210). No clamping to the dimensions of the source image will occur; rendered results in this case will depend on the texture addressing mode.

The intrinsic dimensions of the image can now come from three different sources. They are used in the following order:

1) 'width' / 'height' attributes if present 2) pixel width / height given by the 'coords' attribute 3) width / height of the source texture

This has the result of sizing the element to the pixel-size of the rendered image, unless overridden by the 'width' or 'height' attributes.

Author:
Peter Curry

Constructor & Destructor Documentation

Rocket::Core::ElementImage::ElementImage ( const String tag  ) 

Constructs a new ElementImage. This should not be called directly; use the Factory instead.

Parameters:
[in] tag The tag the element was declared as in RML.


Member Function Documentation

bool Rocket::Core::ElementImage::GetIntrinsicDimensions ( Vector2f dimensions  )  [virtual]

Returns the element's inherent size.

Parameters:
[out] The element's intrinsic dimensions.
Returns:
True.

Reimplemented from Rocket::Core::Element.

void Rocket::Core::ElementImage::OnAttributeChange ( const AttributeNameList &  changed_attributes  )  [protected, virtual]

Checks for changes to the image's source or dimensions.

Parameters:
[in] changed_attributes A list of attributes changed on the element.

Reimplemented from Rocket::Core::Element.

void Rocket::Core::ElementImage::ProcessEvent ( Event event  )  [protected, virtual]

Regenerates the element's geometry on a resize event.

Parameters:
[in] event The event to process.

Reimplemented from Rocket::Core::Element.


The documentation for this class was generated from the following files: