MyGUI::Canvas Class Reference

#include <MyGUI_Canvas.h>

Inheritance diagram for MyGUI::Canvas:
Inheritance graph
[legend]

Data Structures

struct  Event

Public Types

enum  TextureResizeMode { TRM_PT_CONST_SIZE, TRM_PT_VIEW_REQUESTED, TRM_PT_VIEW_ALL }
typedef delegates::CDelegate1
< CanvasPtr
EventInfo_Canvas
typedef delegates::CDelegate2
< CanvasPtr, Event
EventInfo_CanvasEvent

Public Member Functions

 Canvas ()
void createTexture (TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat())
 Creates texture.
void createTexture (int _width, int _height, TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat())
 Creates texture.
void createTexture (const IntSize &_size, TextureResizeMode _resizeMode, TextureUsage _usage=getDefaultTextureUsage(), PixelFormat _format=getDefaultTextureFormat())
 Creates texture.
void destroyTexture ()
 Destroys texture.
void updateTexture ()
 Call user delegate update and removes old texture if it isn't original.
void * lock (TextureUsage _usage=TextureUsage::Write)
 Locks hardware pixel buffer.
void unlock ()
 Unlocks hardware pixel buffer.
bool isLocked () const
 Checks lockness of hardware _pixel buffer.
int getTextureRealWidth () const
 Returns real width of texture.
int getTextureRealHeight () const
 Returns real height of texture.
IntSize getTextureRealSize () const
 Returns real _size of texture.
int getTextureSrcWidth () const
 Returns needed width while creating texture.
int getTextureSrcHeight () const
 Returns needed height while creating texture.
IntSize getTextureSrcSize () const
 Returns needed sizes while creating texture.
PixelFormat getTextureFormat () const
 Returns needed sizes while creating texture.
const std::string & getTextureName () const
 Returns name of the current texture.
virtual void setSize (const IntSize &_value)
virtual void setCoord (const IntCoord &_value)
void setSize (int _width, int _height)
void setCoord (int _left, int _top, int _width, int _height)
TextureResizeMode getResizeMode () const
 Returns resize mode.
void setResizeMode (TextureResizeMode _set)
 Sets resize mode of texture.
bool isTextureSrcSize () const
 Checks if the texture has the source (required by user) size, otherwise real texture size are bigger.
bool isTextureCreated () const
 Returns true if the texture was created (and exists), otherwise false.
bool isTextureManaged () const
 Returns true if we own the texture, otherwise false.
ITexturegetTexture ()
 Reurns interface texture.
void setTextureManaged (bool _value)
 Sets the texture managed.
virtual void _initialise (WidgetStyle _style, const IntCoord &_coord, Align _align, ResourceSkin *_info, WidgetPtr _parent, ICroppedRectangle *_croppedParent, IWidgetCreator *_creator, const std::string &_name)

Static Public Member Functions

static TextureUsage getDefaultTextureUsage ()
 Returns default GUI texture usage.
static PixelFormat getDefaultTextureFormat ()
 Returns default GUI texture format.

Data Fields

EventInfo_Canvas eventPreTextureChanges
EventInfo_CanvasEvent requestUpdateCanvas

Protected Member Functions

virtual ~Canvas ()
void _destroyTexture (bool _sendEvent)
 Destroys texture.
void validate (int &_width, int &_height, TextureUsage &_usage, PixelFormat &_format) const
 Update entered parameters according to current texture resize mode(size) and restore (if can) parameters of usage and format from texture.
void createExactTexture (int _width, int _height, TextureUsage _usage, PixelFormat _format)
 Creates the texture itself.
bool checkCreate (int _width, int _height) const
 Checks if we need to create a texture with such sizes.
void resize (const IntSize &_size)
 Calls when resize widget.
void correctUV ()
 Correct texture uv-coordinates.
void baseChangeWidgetSkin (ResourceSkin *_info)
void initialiseWidgetSkin (ResourceSkin *_info)
void shutdownWidgetSkin ()
void frameAdvise (bool _advise)
 For updating once per frame.
void frameEntered (float _time)
 For updating once per frame.

Protected Attributes

ITexturemTexture
 Current texture.
IntSize mReqTexSize
 Requested bu user sizes.
std::string mGenTexName
 Generated texture name.
TextureResizeMode mTexResizeMode
 Texture resize mode.
uint8mTexData
 Saved pointer from last calling lock.
bool mTexManaged
 true if we own the texture (can delete it or replace by another instance), otherwise false
bool mFrameAdvise
 For updating once per frame. True state means updating before next frame starts.

Detailed Description

Widget wrapper over Texture - shows the texture. Implemented: resizing of texture (see TextureResizeMode); recovery after lossing device;

Definition at line 37 of file MyGUI_Canvas.h.


Member Typedef Documentation

Definition at line 61 of file MyGUI_Canvas.h.

Definition at line 62 of file MyGUI_Canvas.h.


Member Enumeration Documentation

Available resize and view modes of texture

Remarks:
PT - Power of Two (size)
Enumerator:
TRM_PT_CONST_SIZE 
TRM_PT_VIEW_REQUESTED 

Texture doesn't resizes and fills all widget space.

TRM_PT_VIEW_ALL 

You can view all pixels of texture, texture cropped by sizes of widget.

Texture resizes and fills all widget space

Definition at line 69 of file MyGUI_Canvas.h.


Constructor & Destructor Documentation

MyGUI::Canvas::Canvas (  ) 

Definition at line 33 of file MyGUI_Canvas.cpp.

MyGUI::Canvas::~Canvas (  )  [protected, virtual]

Definition at line 48 of file MyGUI_Canvas.cpp.


Member Function Documentation

void MyGUI::Canvas::_destroyTexture ( bool  _sendEvent  )  [protected]

Destroys texture.

Definition at line 164 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::_initialise ( WidgetStyle  _style,
const IntCoord _coord,
Align  _align,
ResourceSkin _info,
WidgetPtr  _parent,
ICroppedRectangle _croppedParent,
IWidgetCreator _creator,
const std::string &  _name 
) [virtual]

Definition at line 43 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::baseChangeWidgetSkin ( ResourceSkin _info  )  [protected, virtual]

Reimplemented from MyGUI::Widget.

Definition at line 209 of file MyGUI_Canvas.cpp.

bool MyGUI::Canvas::checkCreate ( int  _width,
int  _height 
) const [protected]

Checks if we need to create a texture with such sizes.

Definition at line 132 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::correctUV (  )  [protected]

Correct texture uv-coordinates.

Definition at line 179 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::createExactTexture ( int  _width,
int  _height,
TextureUsage  _usage,
PixelFormat  _format 
) [protected]

Creates the texture itself.

Definition at line 69 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::createTexture ( const IntSize _size,
TextureResizeMode  _resizeMode,
TextureUsage  _usage = getDefaultTextureUsage(),
PixelFormat  _format = getDefaultTextureFormat() 
)

Creates texture.

Definition at line 58 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::createTexture ( int  _width,
int  _height,
TextureResizeMode  _resizeMode,
TextureUsage  _usage = getDefaultTextureUsage(),
PixelFormat  _format = getDefaultTextureFormat() 
)

Creates texture.

Definition at line 95 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::createTexture ( TextureResizeMode  _resizeMode,
TextureUsage  _usage = getDefaultTextureUsage(),
PixelFormat  _format = getDefaultTextureFormat() 
)

Creates texture.

Definition at line 53 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::destroyTexture (  ) 

Destroys texture.

Definition at line 159 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::frameAdvise ( bool  _advise  )  [protected]

For updating once per frame.

Definition at line 227 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::frameEntered ( float  _time  )  [protected]

For updating once per frame.

Reimplemented from MyGUI::Widget.

Definition at line 247 of file MyGUI_Canvas.cpp.

static PixelFormat MyGUI::Canvas::getDefaultTextureFormat (  )  [inline, static]

Returns default GUI texture format.

Definition at line 162 of file MyGUI_Canvas.h.

static TextureUsage MyGUI::Canvas::getDefaultTextureUsage (  )  [inline, static]

Returns default GUI texture usage.

Definition at line 159 of file MyGUI_Canvas.h.

TextureResizeMode MyGUI::Canvas::getResizeMode (  )  const [inline]

Returns resize mode.

Definition at line 138 of file MyGUI_Canvas.h.

ITexture* MyGUI::Canvas::getTexture (  )  [inline]

Reurns interface texture.

Definition at line 153 of file MyGUI_Canvas.h.

PixelFormat MyGUI::Canvas::getTextureFormat (  )  const [inline]

Returns needed sizes while creating texture.

Definition at line 122 of file MyGUI_Canvas.h.

const std::string& MyGUI::Canvas::getTextureName (  )  const [inline]

Returns name of the current texture.

Definition at line 125 of file MyGUI_Canvas.h.

int MyGUI::Canvas::getTextureRealHeight (  )  const [inline]

Returns real height of texture.

Definition at line 107 of file MyGUI_Canvas.h.

IntSize MyGUI::Canvas::getTextureRealSize (  )  const [inline]

Returns real _size of texture.

Definition at line 110 of file MyGUI_Canvas.h.

int MyGUI::Canvas::getTextureRealWidth (  )  const [inline]

Returns real width of texture.

Definition at line 104 of file MyGUI_Canvas.h.

int MyGUI::Canvas::getTextureSrcHeight (  )  const [inline]

Returns needed height while creating texture.

Definition at line 116 of file MyGUI_Canvas.h.

IntSize MyGUI::Canvas::getTextureSrcSize (  )  const [inline]

Returns needed sizes while creating texture.

Definition at line 119 of file MyGUI_Canvas.h.

int MyGUI::Canvas::getTextureSrcWidth (  )  const [inline]

Returns needed width while creating texture.

Definition at line 113 of file MyGUI_Canvas.h.

void MyGUI::Canvas::initialiseWidgetSkin ( ResourceSkin _info  )  [protected]

Definition at line 214 of file MyGUI_Canvas.cpp.

bool MyGUI::Canvas::isLocked (  )  const [inline]

Checks lockness of hardware _pixel buffer.

Definition at line 101 of file MyGUI_Canvas.h.

bool MyGUI::Canvas::isTextureCreated (  )  const [inline]

Returns true if the texture was created (and exists), otherwise false.

Definition at line 147 of file MyGUI_Canvas.h.

bool MyGUI::Canvas::isTextureManaged (  )  const [inline]

Returns true if we own the texture, otherwise false.

See also:
mManaged

Definition at line 150 of file MyGUI_Canvas.h.

bool MyGUI::Canvas::isTextureSrcSize (  )  const

Checks if the texture has the source (required by user) size, otherwise real texture size are bigger.

Definition at line 222 of file MyGUI_Canvas.cpp.

void * MyGUI::Canvas::lock ( TextureUsage  _usage = TextureUsage::Write  ) 

Locks hardware pixel buffer.

Definition at line 195 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::resize ( const IntSize _size  )  [protected]

Calls when resize widget.

Definition at line 85 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setCoord ( int  _left,
int  _top,
int  _width,
int  _height 
) [inline]

See Widget::setCoord(const IntCoord& _coord)

Reimplemented from MyGUI::Widget.

Definition at line 135 of file MyGUI_Canvas.h.

void MyGUI::Canvas::setCoord ( const IntCoord _value  )  [virtual]

Set widget position and size

Reimplemented from MyGUI::Widget.

Definition at line 120 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setResizeMode ( TextureResizeMode  _set  )  [inline]

Sets resize mode of texture.

See also:
TextureResizeMode

Definition at line 141 of file MyGUI_Canvas.h.

void MyGUI::Canvas::setSize ( int  _width,
int  _height 
) [inline]

See Widget::setSize(const IntSize& _size)

Reimplemented from MyGUI::Widget.

Definition at line 133 of file MyGUI_Canvas.h.

void MyGUI::Canvas::setSize ( const IntSize _value  )  [virtual]

Set widget size

Reimplemented from MyGUI::Widget.

Definition at line 113 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::setTextureManaged ( bool  _value  )  [inline]

Sets the texture managed.

Remarks:
Be careful with assigning managed status to texture, which wasn't created in Canvas!
See also:
mManaged

Definition at line 156 of file MyGUI_Canvas.h.

void MyGUI::Canvas::shutdownWidgetSkin (  )  [protected]

Definition at line 218 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::unlock (  ) 

Unlocks hardware pixel buffer.

Definition at line 204 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::updateTexture (  ) 

Call user delegate update and removes old texture if it isn't original.

Definition at line 127 of file MyGUI_Canvas.cpp.

void MyGUI::Canvas::validate ( int &  _width,
int &  _height,
TextureUsage _usage,
PixelFormat _format 
) const [protected]

Update entered parameters according to current texture resize mode(size) and restore (if can) parameters of usage and format from texture.

Definition at line 143 of file MyGUI_Canvas.cpp.


Field Documentation

Event : Notify user texture instance will be changed

See also:
requestUpdateCanvas
signature : void method(MyGUI::CanvasPtr _canvas)
Parameters:
_canvas,which will be updated

Definition at line 169 of file MyGUI_Canvas.h.

bool MyGUI::Canvas::mFrameAdvise [protected]

For updating once per frame. True state means updating before next frame starts.

Definition at line 237 of file MyGUI_Canvas.h.

std::string MyGUI::Canvas::mGenTexName [protected]

Generated texture name.

Definition at line 225 of file MyGUI_Canvas.h.

Requested bu user sizes.

Definition at line 222 of file MyGUI_Canvas.h.

Saved pointer from last calling lock.

See also:
lock

Definition at line 231 of file MyGUI_Canvas.h.

bool MyGUI::Canvas::mTexManaged [protected]

true if we own the texture (can delete it or replace by another instance), otherwise false

Definition at line 234 of file MyGUI_Canvas.h.

Texture resize mode.

See also:
TextureResizeMode

Definition at line 228 of file MyGUI_Canvas.h.

Current texture.

Reimplemented from MyGUI::Widget.

Definition at line 219 of file MyGUI_Canvas.h.

Event : Texture instance was changed (May be caused by resizing texture or lossing device). User have to update all references to new instance of texture.
signature : void method(MyGUI::CanvasPtr _canvas, MyGUI::Canvas::Event _event)

Parameters:
_canvas,which needs to update
_event 

Definition at line 176 of file MyGUI_Canvas.h.


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

Generated on 3 Dec 2009 for MyGUI by  doxygen 1.6.1