Blender V2.61 - r43446
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes

GPC_Canvas Class Reference

#include <GPC_Canvas.h>

Inheritance diagram for GPC_Canvas:
Inheritance graph
[legend]

List of all members.

Classes

struct  CanvasRenderState
struct  TBannerData

Public Types

enum  TBannerAlignment { alignTopLeft, alignBottomRight }
typedef int TBannerId

Public Member Functions

 GPC_Canvas (int width, int height)
virtual ~GPC_Canvas ()
void Resize (int width, int height)
int GetWidth () const
int GetHeight () const
const RAS_RectGetDisplayArea () const
void SetDisplayArea (RAS_Rect *rect)
RAS_RectGetWindowArea ()
void BeginFrame ()
void EndFrame ()
void SetViewPort (int x1, int y1, int x2, int y2)
void ClearColor (float r, float g, float b, float a)
void SetMouseState (RAS_MouseState mousestate)
void SetMousePosition (int x, int y)
virtual void MakeScreenShot (const char *filename)
void ClearBuffer (int type)
TBannerId AddBanner (unsigned int bannerWidth, unsigned int bannerHeight, unsigned int imageWidth, unsigned int imageHeight, unsigned char *imageData, TBannerAlignment alignment=alignTopLeft, bool enabled=true)
void DisposeBanner (TBannerId id)
void DisposeAllBanners ()
void SetBannerEnabled (TBannerId id, bool enabled=true)
void SetBannerDisplayEnabled (bool enabled=true)

Protected Types

typedef std::map< TBannerId,
TBannerData
TBannerMap

Protected Member Functions

void DisposeBanner (TBannerData &banner)
void DrawAllBanners (void)
void DrawBanner (TBannerData &banner)
void PushRenderState (CanvasRenderState &render_state)
void PopRenderState (const CanvasRenderState &render_state)
void SetOrthoProjection ()

Protected Attributes

int m_width
int m_height
RAS_Rect m_displayarea
TBannerMap m_banners
bool m_bannersEnabled

Static Protected Attributes

static TBannerId s_bannerId = 0

Detailed Description

Definition at line 48 of file GPC_Canvas.h.


Member Typedef Documentation

typedef int GPC_Canvas::TBannerId

Definition at line 59 of file GPC_Canvas.h.

typedef std::map<TBannerId, TBannerData> GPC_Canvas::TBannerMap [protected]

Definition at line 83 of file GPC_Canvas.h.


Member Enumeration Documentation

Used to position banners in the canvas.

Enumerator:
alignTopLeft 
alignBottomRight 

Definition at line 54 of file GPC_Canvas.h.


Constructor & Destructor Documentation

GPC_Canvas::GPC_Canvas ( int  width,
int  height 
)

Definition at line 47 of file GPC_Canvas.cpp.

GPC_Canvas::~GPC_Canvas ( ) [virtual]

Definition at line 58 of file GPC_Canvas.cpp.

References DisposeAllBanners().


Member Function Documentation

GPC_Canvas::TBannerId GPC_Canvas::AddBanner ( unsigned int  bannerWidth,
unsigned int  bannerHeight,
unsigned int  imageWidth,
unsigned int  imageHeight,
unsigned char *  imageData,
TBannerAlignment  alignment = alignTopLeft,
bool  enabled = true 
)

provided by this class.

Enables display of a banner. The image data is copied inside.

Parameters:
bannerWidthDisplay width of the banner.
bannerHeightDisplay height of the banner.
imageWidthWidth of the banner image in pixels.
imageHeightHeight of the banner image in pixels.
imageDataPointer to the pixels of the image to display.
alignementWhere the banner will be positioned on the canvas.
enabledWhether the banner will be displayed intiallly.
Returns:
A banner id.

Definition at line 133 of file GPC_Canvas.cpp.

References GPC_Canvas::TBannerData::alignment, GPC_Canvas::TBannerData::displayHeight, GPC_Canvas::TBannerData::displayWidth, GPC_Canvas::TBannerData::enabled, GPC_Canvas::TBannerData::imageData, GPC_Canvas::TBannerData::imageHeight, GPC_Canvas::TBannerData::imageWidth, m_banners, s_bannerId, and GPC_Canvas::TBannerData::textureName.

void GPC_Canvas::BeginFrame ( ) [inline, virtual]

Implements RAS_ICanvas.

Definition at line 144 of file GPC_Canvas.h.

void GPC_Canvas::ClearBuffer ( int  type) [virtual]

Implements RAS_ICanvas.

Definition at line 119 of file GPC_Canvas.cpp.

References RAS_ICanvas::COLOR_BUFFER, and RAS_ICanvas::DEPTH_BUFFER.

void GPC_Canvas::ClearColor ( float  r,
float  g,
float  b,
float  a 
) [virtual]

Implements RAS_ICanvas.

Definition at line 95 of file GPC_Canvas.cpp.

References g.

void GPC_Canvas::DisposeAllBanners ( )

Disposes all the banners.

Definition at line 166 of file GPC_Canvas.cpp.

References DisposeBanner(), and m_banners.

Referenced by ~GPC_Canvas().

void GPC_Canvas::DisposeBanner ( TBannerId  id)

Disposes a banner.

Parameters:
idBannner to be disposed.

Definition at line 157 of file GPC_Canvas.cpp.

References m_banners.

Referenced by DisposeAllBanners().

void GPC_Canvas::DisposeBanner ( TBannerData banner) [protected]

Disposes a banner.

Parameters:
itBannner to be disposed.

Definition at line 190 of file GPC_Canvas.cpp.

References GPC_Canvas::TBannerData::imageData, and GPC_Canvas::TBannerData::textureName.

void GPC_Canvas::DrawAllBanners ( void  ) [protected]

Draws all the banners enabled.

Definition at line 201 of file GPC_Canvas.cpp.

References DrawBanner(), m_banners, m_bannersEnabled, PopRenderState(), PushRenderState(), and SetOrthoProjection().

Referenced by EndFrame().

void GPC_Canvas::DrawBanner ( TBannerData banner) [protected]
void GPC_Canvas::EndFrame ( ) [virtual]

Draws overlay banners and progress bars.

Implements RAS_ICanvas.

Definition at line 88 of file GPC_Canvas.cpp.

References DrawAllBanners(), and m_bannersEnabled.

const RAS_Rect& GPC_Canvas::GetDisplayArea ( ) const [inline, virtual]

Implements RAS_ICanvas.

Definition at line 125 of file GPC_Canvas.h.

References m_displayarea.

int GPC_Canvas::GetHeight ( ) const [inline, virtual]

Implements RAS_ICanvas.

Definition at line 118 of file GPC_Canvas.h.

References m_height.

Referenced by GPG_Canvas::GetMouseNormalizedY(), and MakeScreenShot().

int GPC_Canvas::GetWidth ( ) const [inline, virtual]

inherited from abstract base class RAS_ICanvas.

Implements RAS_ICanvas.

Definition at line 112 of file GPC_Canvas.h.

References m_width.

Referenced by GPG_Canvas::GetMouseNormalizedX(), and MakeScreenShot().

RAS_Rect& GPC_Canvas::GetWindowArea ( ) [inline, virtual]

Used to get canvas area within blender.

Implements RAS_ICanvas.

Definition at line 138 of file GPC_Canvas.h.

References m_displayarea.

void GPC_Canvas::MakeScreenShot ( const char *  filename) [virtual]

Implements RAS_ICanvas.

Definition at line 384 of file GPC_Canvas.cpp.

References GetHeight(), GetWidth(), i, and NULL.

void GPC_Canvas::PopRenderState ( const CanvasRenderState render_state) [protected]
void GPC_Canvas::PushRenderState ( CanvasRenderState render_state) [protected]
void GPC_Canvas::Resize ( int  width,
int  height 
)

Definition at line 82 of file GPC_Canvas.cpp.

References m_height, and m_width.

Referenced by GPG_Canvas::GPG_Canvas(), and GPG_Application::processEvent().

void GPC_Canvas::SetBannerDisplayEnabled ( bool  enabled = true)

Enables or disables display of all banners.

Parameters:
enabledNew state of the banners.

Definition at line 184 of file GPC_Canvas.cpp.

References m_bannersEnabled.

Referenced by GPC_Engine::Start().

void GPC_Canvas::SetBannerEnabled ( TBannerId  id,
bool  enabled = true 
)

Enables or disables display of a banner.

Parameters:
idBanner id of the banner to be enabled/disabled.
enabledNew state of the banner.

Definition at line 175 of file GPC_Canvas.cpp.

References m_banners.

void GPC_Canvas::SetDisplayArea ( RAS_Rect rect) [inline, virtual]

Implements RAS_ICanvas.

Definition at line 131 of file GPC_Canvas.h.

References m_displayarea.

void GPC_Canvas::SetMousePosition ( int  x,
int  y 
) [inline, virtual]

Implements RAS_ICanvas.

Reimplemented in GPG_Canvas.

Definition at line 168 of file GPC_Canvas.h.

void GPC_Canvas::SetMouseState ( RAS_MouseState  mousestate) [inline, virtual]

inherited from abstract base class RAS_ICanvas.

Semantics are not yet honoured.

Implements RAS_ICanvas.

Reimplemented in GPG_Canvas.

Definition at line 163 of file GPC_Canvas.h.

void GPC_Canvas::SetOrthoProjection ( ) [protected]

Set up an orthogonal viewing,model and texture matrix for banners and progress bars.

Definition at line 368 of file GPC_Canvas.cpp.

References m_height, and m_width.

Referenced by DrawAllBanners().

void GPC_Canvas::SetViewPort ( int  x1,
int  y1,
int  x2,
int  y2 
) [virtual]

Set the visible vieport

Implements RAS_ICanvas.

Definition at line 100 of file GPC_Canvas.cpp.


Member Data Documentation

Storage for the banners to display.

Definition at line 94 of file GPC_Canvas.h.

Referenced by AddBanner(), DisposeAllBanners(), DisposeBanner(), DrawAllBanners(), and SetBannerEnabled().

bool GPC_Canvas::m_bannersEnabled [protected]

State of banner display.

Definition at line 96 of file GPC_Canvas.h.

Referenced by DrawAllBanners(), EndFrame(), and SetBannerDisplayEnabled().

Rect that defines the area used for rendering, relative to the context

Definition at line 91 of file GPC_Canvas.h.

Referenced by GetDisplayArea(), GetWindowArea(), and SetDisplayArea().

int GPC_Canvas::m_height [protected]

Height of the context.

Definition at line 88 of file GPC_Canvas.h.

Referenced by DrawBanner(), GetHeight(), Resize(), and SetOrthoProjection().

int GPC_Canvas::m_width [protected]

Width of the context.

Definition at line 86 of file GPC_Canvas.h.

Referenced by DrawBanner(), GetWidth(), Resize(), and SetOrthoProjection().

Definition at line 269 of file GPC_Canvas.h.

Referenced by AddBanner().


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