PixelLightAPI  .
Public Member Functions | Protected Attributes
PLGui::Graphics Class Reference

Graphics class. More...

#include <Graphics.h>

List of all members.

Public Member Functions

PLGUI_API Graphics (Gui &cGui)
 Constructor.
PLGUI_API Graphics (Gui &cGui, GraphicsImpl &cGraphicsImpl)
 Constructor.
PLGUI_API ~Graphics ()
 Destructor.
PLGUI_API GuiGetGui () const
 Get owner GUI.
PLGUI_API GraphicsImpl * GetImpl () const
 Get implementation.
PLGUI_API const PLCore::List
< GraphicsHint * > & 
GetHints ()
 Get hints.
PLGUI_API void AddHint (GraphicsHint *pHint)
 Add a hint.
PLGUI_API void DrawLine (const PLGraphics::Color4 &cColor, const PLMath::Vector2i &vPos1, const PLMath::Vector2i &vPos2, PLCore::uint32 nWidth=1)
 Draws a line.
PLGUI_API void DrawRect (const PLGraphics::Color4 &cColor, const PLMath::Vector2i &vPos1, const PLMath::Vector2i &vPos2, PLCore::uint32 nRoundX=0, PLCore::uint32 nRoundY=0, PLCore::uint32 nWidth=1)
 Draws a rectangle.
PLGUI_API void DrawBox (const PLGraphics::Color4 &cColor, const PLMath::Vector2i &vPos1, const PLMath::Vector2i &vPos2, PLCore::uint32 nRoundX=0, PLCore::uint32 nRoundY=0)
 Draws a filled box.
PLGUI_API void DrawGradientBox (const PLGraphics::Color4 &cColor1, const PLGraphics::Color4 &cColor2, float fAngle, const PLMath::Vector2i &vPos1, const PLMath::Vector2i &vPos2)
 Draws a filled box with a color gradient.
PLGUI_API void DrawImage (const Image &cImage, const PLMath::Vector2i &vPos, const PLMath::Vector2i &vSize)
 Draws an image.
PLGUI_API void DrawTiledImage (const Image &cImage, const PLMath::Vector2i &vPos, const PLMath::Vector2i &vSize)
 Draws an tiled image.
PLGUI_API void DrawText (const Font &cFont, const PLGraphics::Color4 &cTextColor, const PLGraphics::Color4 &cBkColor, const PLMath::Vector2i &vPos, const PLCore::String &sText)
 Draws a text.
PLGUI_API PLCore::uint32 GetTextWidth (const Font &cFont, const PLCore::String &sText)
 Gets the width of a given text in the current font.
PLGUI_API PLCore::uint32 GetTextHeight (const Font &cFont, const PLCore::String &sText)
 Gets the height of a given text in the current font.

Protected Attributes

Guim_pGui
GraphicsImpl * m_pGraphicsImpl
bool m_bManageImpl
PLCore::List< GraphicsHint * > m_lstHints

Detailed Description

Graphics class.

Note:
  • Implementation of the bridge design pattern, this class is the abstraction

Constructor & Destructor Documentation

PLGUI_API PLGui::Graphics::Graphics ( Gui cGui)

Constructor.

Parameters:
[in]cGuiOwner GUI
Remarks:
This function creates a new graphics implementation by calling the appropriate functions from cGui. This is useful e.g. for offscreen graphics objects. The implementation will be deleted along with the graphics object itself.
PLGUI_API PLGui::Graphics::Graphics ( Gui cGui,
GraphicsImpl &  cGraphicsImpl 
)

Constructor.

Parameters:
[in]cGuiOwner GUI
[in]cGraphicsImplReference to graphics implementation
Remarks:
This function takes an already created graphics implementation and embeds it inside the graphics object. This implementation will not be deleted automatically!

Destructor.


Member Function Documentation

PLGUI_API Gui* PLGui::Graphics::GetGui ( ) const

Get owner GUI.

Returns:
Pointer to GUI object (never a null pointer)
PLGUI_API GraphicsImpl* PLGui::Graphics::GetImpl ( ) const

Get implementation.

Returns:
Pointer to platform specific implementation

Get hints.

Returns:
List of hints
PLGUI_API void PLGui::Graphics::AddHint ( GraphicsHint pHint)

Add a hint.

Parameters:
[in]pHintGraphicsHint for the GUI renderer
PLGUI_API void PLGui::Graphics::DrawLine ( const PLGraphics::Color4 cColor,
const PLMath::Vector2i vPos1,
const PLMath::Vector2i vPos2,
PLCore::uint32  nWidth = 1 
)

Draws a line.

Parameters:
[in]cColorColor of the line
[in]vPos1Start position
[in]vPos2End position
[in]nWidthLine width
PLGUI_API void PLGui::Graphics::DrawRect ( const PLGraphics::Color4 cColor,
const PLMath::Vector2i vPos1,
const PLMath::Vector2i vPos2,
PLCore::uint32  nRoundX = 0,
PLCore::uint32  nRoundY = 0,
PLCore::uint32  nWidth = 1 
)

Draws a rectangle.

Parameters:
[in]cColorColor of the line
[in]vPos1First corner
[in]vPos2Second corner
[in]nRoundXRounded border in X direction
[in]nRoundYRounded border in Y direction
[in]nWidthLine width
PLGUI_API void PLGui::Graphics::DrawBox ( const PLGraphics::Color4 cColor,
const PLMath::Vector2i vPos1,
const PLMath::Vector2i vPos2,
PLCore::uint32  nRoundX = 0,
PLCore::uint32  nRoundY = 0 
)

Draws a filled box.

Parameters:
[in]cColorColor of the box
[in]vPos1First corner
[in]vPos2Second corner
[in]nRoundXRounded border in X direction
[in]nRoundYRounded border in Y direction
PLGUI_API void PLGui::Graphics::DrawGradientBox ( const PLGraphics::Color4 cColor1,
const PLGraphics::Color4 cColor2,
float  fAngle,
const PLMath::Vector2i vPos1,
const PLMath::Vector2i vPos2 
)

Draws a filled box with a color gradient.

Parameters:
[in]cColor1First color
[in]cColor2Second color
[in]fAngleClockwise angle of the gradient color (in degrees). 0° means from left to right.
[in]vPos1First corner
[in]vPos2Second corner
PLGUI_API void PLGui::Graphics::DrawImage ( const Image cImage,
const PLMath::Vector2i vPos,
const PLMath::Vector2i vSize 
)

Draws an image.

Parameters:
[in]cImageImage to draw
[in]vPosImage position
[in]vSizeImage size
Note:
  • If vSize = (0 0), the image size is used
PLGUI_API void PLGui::Graphics::DrawTiledImage ( const Image cImage,
const PLMath::Vector2i vPos,
const PLMath::Vector2i vSize 
)

Draws an tiled image.

Parameters:
[in]cImageImage to draw
[in]vPosImage position
[in]vSizeImage size
Note:
  • If vSize = (0 0), the image size is used
PLGUI_API void PLGui::Graphics::DrawText ( const Font cFont,
const PLGraphics::Color4 cTextColor,
const PLGraphics::Color4 cBkColor,
const PLMath::Vector2i vPos,
const PLCore::String sText 
)

Draws a text.

Parameters:
[in]cFontFont to use
[in]cTextColorText color
[in]cBkColorBackground color
[in]vPosText position
[in]sTextText
PLGUI_API PLCore::uint32 PLGui::Graphics::GetTextWidth ( const Font cFont,
const PLCore::String sText 
)

Gets the width of a given text in the current font.

Parameters:
[in]cFontFont to use
[in]sTextText to get the width of
Returns:
The width of the given text using the given font
PLGUI_API PLCore::uint32 PLGui::Graphics::GetTextHeight ( const Font cFont,
const PLCore::String sText 
)

Gets the height of a given text in the current font.

Parameters:
[in]cFontFont to use
[in]sTextText to get the height of
Returns:
The height of the given text using the given font

Member Data Documentation

GUI instance

GraphicsImpl* PLGui::Graphics::m_pGraphicsImpl [protected]

Graphics implementation object

If 'true', m_pGraphicsImpl will be destroyed in destructor

Rendering hints


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:32
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported