Otclient  14/8/2020
Painter Class Referenceabstract

#include <painter.h>

Inheritance diagram for Painter:
Collaboration diagram for Painter:

Public Types

enum  BlendEquation { BlendEquation_Add, BlendEquation_Max }
 
enum  CompositionMode {
  CompositionMode_Normal, CompositionMode_Multiply, CompositionMode_Add, CompositionMode_Replace,
  CompositionMode_DestBlending, CompositionMode_Light
}
 
enum  DrawMode { Triangles = GL_TRIANGLES, TriangleStrip = GL_TRIANGLE_STRIP }
 

Public Member Functions

 Painter ()
 
virtual ~Painter ()
 
virtual void bind ()
 
virtual void unbind ()
 
virtual void saveState ()=0
 
virtual void saveAndResetState ()=0
 
virtual void restoreSavedState ()=0
 
virtual void clear (const Color &color)=0
 
virtual void drawCoords (CoordsBuffer &coordsBuffer, DrawMode drawMode=Triangles)=0
 
virtual void drawFillCoords (CoordsBuffer &coordsBuffer)=0
 
virtual void drawTextureCoords (CoordsBuffer &coordsBuffer, const TexturePtr &texture)=0
 
virtual void drawTexturedRect (const Rect &dest, const TexturePtr &texture, const Rect &src)=0
 
void drawTexturedRect (const Rect &dest, const TexturePtr &texture)
 
virtual void drawUpsideDownTexturedRect (const Rect &dest, const TexturePtr &texture, const Rect &src)=0
 
virtual void drawRepeatedTexturedRect (const Rect &dest, const TexturePtr &texture, const Rect &src)=0
 
virtual void drawFilledRect (const Rect &dest)=0
 
virtual void drawFilledTriangle (const Point &a, const Point &b, const Point &c)=0
 
virtual void drawBoundingRect (const Rect &dest, int innerLineWidth=1)=0
 
virtual void setTexture (Texture *texture)=0
 
virtual void setClipRect (const Rect &clipRect)=0
 
virtual void setColor (const Color &color)
 
virtual void setAlphaWriting (bool enable)=0
 
virtual void setBlendEquation (BlendEquation blendEquation)=0
 
virtual void setShaderProgram (PainterShaderProgram *shaderProgram)
 
void setShaderProgram (const PainterShaderProgramPtr &shaderProgram)
 
virtual void scale (float x, float y)=0
 
void scale (float factor)
 
virtual void translate (float x, float y)=0
 
void translate (const Point &p)
 
virtual void rotate (float angle)=0
 
virtual void rotate (float x, float y, float angle)=0
 
void rotate (const Point &p, float angle)
 
virtual void setOpacity (float opacity)
 
virtual void setResolution (const Size &resolution)
 
Size getResolution ()
 
Color getColor ()
 
float getOpacity ()
 
Rect getClipRect ()
 
CompositionMode getCompositionMode ()
 
virtual void setCompositionMode (CompositionMode compositionMode)=0
 
virtual void pushTransformMatrix ()=0
 
virtual void popTransformMatrix ()=0
 
void resetClipRect ()
 
void resetOpacity ()
 
void resetCompositionMode ()
 
void resetColor ()
 
void resetShaderProgram ()
 
virtual bool hasShaders ()=0
 

Protected Attributes

PainterShaderProgramm_shaderProgram
 
CompositionMode m_compositionMode
 
Color m_color
 
Size m_resolution
 
float m_opacity
 
Rect m_clipRect
 

Detailed Description

Definition at line 31 of file painter.h.

Member Enumeration Documentation

◆ BlendEquation

Enumerator
BlendEquation_Add 
BlendEquation_Max 

Definition at line 34 of file painter.h.

◆ CompositionMode

Enumerator
CompositionMode_Normal 
CompositionMode_Multiply 
CompositionMode_Add 
CompositionMode_Replace 
CompositionMode_DestBlending 
CompositionMode_Light 

Definition at line 38 of file painter.h.

◆ DrawMode

Enumerator
Triangles 
TriangleStrip 

Definition at line 46 of file painter.h.

Constructor & Destructor Documentation

◆ Painter()

Painter::Painter ( )

Definition at line 30 of file painter.cpp.

◆ ~Painter()

virtual Painter::~Painter ( )
inlinevirtual

Definition at line 53 of file painter.h.

Member Function Documentation

◆ bind()

virtual void Painter::bind ( )
inlinevirtual

Reimplemented in PainterOGL, PainterOGL1, and PainterOGL2.

Definition at line 55 of file painter.h.

Here is the caller graph for this function:

◆ clear()

virtual void Painter::clear ( const Color color)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ drawBoundingRect()

virtual void Painter::drawBoundingRect ( const Rect dest,
int  innerLineWidth = 1 
)
pure virtual

Implemented in PainterOGL2, and PainterOGL1.

Here is the caller graph for this function:

◆ drawCoords()

virtual void Painter::drawCoords ( CoordsBuffer coordsBuffer,
DrawMode  drawMode = Triangles 
)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

◆ drawFillCoords()

virtual void Painter::drawFillCoords ( CoordsBuffer coordsBuffer)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

Here is the caller graph for this function:

◆ drawFilledRect()

virtual void Painter::drawFilledRect ( const Rect dest)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

Here is the caller graph for this function:

◆ drawFilledTriangle()

virtual void Painter::drawFilledTriangle ( const Point a,
const Point b,
const Point c 
)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

Here is the caller graph for this function:

◆ drawRepeatedTexturedRect()

virtual void Painter::drawRepeatedTexturedRect ( const Rect dest,
const TexturePtr texture,
const Rect src 
)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

◆ drawTextureCoords()

virtual void Painter::drawTextureCoords ( CoordsBuffer coordsBuffer,
const TexturePtr texture 
)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

Here is the caller graph for this function:

◆ drawTexturedRect() [1/2]

void Painter::drawTexturedRect ( const Rect dest,
const TexturePtr texture 
)
inline

Definition at line 68 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawTexturedRect() [2/2]

virtual void Painter::drawTexturedRect ( const Rect dest,
const TexturePtr texture,
const Rect src 
)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

Here is the caller graph for this function:

◆ drawUpsideDownTexturedRect()

virtual void Painter::drawUpsideDownTexturedRect ( const Rect dest,
const TexturePtr texture,
const Rect src 
)
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

◆ getClipRect()

Rect Painter::getClipRect ( )
inline

Definition at line 97 of file painter.h.

Here is the caller graph for this function:

◆ getColor()

Color Painter::getColor ( )
inline

Definition at line 95 of file painter.h.

Here is the caller graph for this function:

◆ getCompositionMode()

CompositionMode Painter::getCompositionMode ( )
inline

Definition at line 98 of file painter.h.

Here is the caller graph for this function:

◆ getOpacity()

float Painter::getOpacity ( )
inline

Definition at line 96 of file painter.h.

Here is the caller graph for this function:

◆ getResolution()

Size Painter::getResolution ( )
inline

Definition at line 94 of file painter.h.

Here is the caller graph for this function:

◆ hasShaders()

virtual bool Painter::hasShaders ( )
pure virtual

Implemented in PainterOGL1, and PainterOGL2.

Here is the caller graph for this function:

◆ popTransformMatrix()

virtual void Painter::popTransformMatrix ( )
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ pushTransformMatrix()

virtual void Painter::pushTransformMatrix ( )
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ resetClipRect()

void Painter::resetClipRect ( )
inline

Definition at line 105 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetColor()

void Painter::resetColor ( )
inline

Definition at line 108 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetCompositionMode()

void Painter::resetCompositionMode ( )
inline

Definition at line 107 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetOpacity()

void Painter::resetOpacity ( )
inline

Definition at line 106 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetShaderProgram()

void Painter::resetShaderProgram ( )
inline

Definition at line 109 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restoreSavedState()

virtual void Painter::restoreSavedState ( )
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ rotate() [1/3]

void Painter::rotate ( const Point p,
float  angle 
)
inline

Definition at line 89 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rotate() [2/3]

virtual void Painter::rotate ( float  angle)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ rotate() [3/3]

virtual void Painter::rotate ( float  x,
float  y,
float  angle 
)
pure virtual

Implemented in PainterOGL.

◆ saveAndResetState()

virtual void Painter::saveAndResetState ( )
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ saveState()

virtual void Painter::saveState ( )
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ scale() [1/2]

void Painter::scale ( float  factor)
inline

Definition at line 84 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale() [2/2]

virtual void Painter::scale ( float  x,
float  y 
)
pure virtual

Implemented in PainterOGL.

◆ setAlphaWriting()

virtual void Painter::setAlphaWriting ( bool  enable)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ setBlendEquation()

virtual void Painter::setBlendEquation ( BlendEquation  blendEquation)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ setClipRect()

virtual void Painter::setClipRect ( const Rect clipRect)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ setColor()

virtual void Painter::setColor ( const Color color)
inlinevirtual

Reimplemented in PainterOGL1.

Definition at line 77 of file painter.h.

Here is the caller graph for this function:

◆ setCompositionMode()

virtual void Painter::setCompositionMode ( CompositionMode  compositionMode)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ setOpacity()

virtual void Painter::setOpacity ( float  opacity)
inlinevirtual

Reimplemented in PainterOGL1.

Definition at line 91 of file painter.h.

Here is the caller graph for this function:

◆ setResolution()

virtual void Painter::setResolution ( const Size resolution)
inlinevirtual

Reimplemented in PainterOGL.

Definition at line 92 of file painter.h.

Here is the caller graph for this function:

◆ setShaderProgram() [1/2]

void Painter::setShaderProgram ( const PainterShaderProgramPtr shaderProgram)
inline

Definition at line 81 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShaderProgram() [2/2]

virtual void Painter::setShaderProgram ( PainterShaderProgram shaderProgram)
inlinevirtual

Reimplemented in PainterOGL.

Definition at line 80 of file painter.h.

Here is the caller graph for this function:

◆ setTexture()

virtual void Painter::setTexture ( Texture texture)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ translate() [1/2]

void Painter::translate ( const Point p)
inline

Definition at line 86 of file painter.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ translate() [2/2]

virtual void Painter::translate ( float  x,
float  y 
)
pure virtual

Implemented in PainterOGL.

Here is the caller graph for this function:

◆ unbind()

virtual void Painter::unbind ( )
inlinevirtual

Reimplemented in PainterOGL, PainterOGL1, and PainterOGL2.

Definition at line 56 of file painter.h.

Here is the caller graph for this function:

Member Data Documentation

◆ m_clipRect

Rect Painter::m_clipRect
protected

Definition at line 119 of file painter.h.

◆ m_color

Color Painter::m_color
protected

Definition at line 116 of file painter.h.

◆ m_compositionMode

CompositionMode Painter::m_compositionMode
protected

Definition at line 115 of file painter.h.

◆ m_opacity

float Painter::m_opacity
protected

Definition at line 118 of file painter.h.

◆ m_resolution

Size Painter::m_resolution
protected

Definition at line 117 of file painter.h.

◆ m_shaderProgram

PainterShaderProgram* Painter::m_shaderProgram
protected

Definition at line 114 of file painter.h.


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