# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Classes | Public Member Functions

# vl::VectorGraphics Class Reference

The VectorGraphics class is used in conjuction with SceneManagerVectorGraphics to generate and render 2D vector graphics. More...

`#include <VectorGraphics.hpp>`

Inheritance diagram for vl::VectorGraphics:

List of all members.

## Classes

class | ImageState
class | State

## Public Member Functions

| VectorGraphics ()
const ActorCollection * | actors () const
| Returns the list of Actor[s] generated by a VectorGraphics object.
ActorCollection * | actors ()
| Returns the list of Actor[s] generated by a VectorGraphics object.
Actor * | drawLine (double x1, double y1, double x2, double y2)
| Renders a line starting a point <x1,y1> and ending at point <x2,y2>
Actor * | drawLines (const std::vector< dvec2 > &ln)
| Renders a set of lines. The 'ln' parameter shoud contain N pairs of dvec2. Each pair defines a line segment.
Actor * | drawLineStrip (const std::vector< dvec2 > &ln)
| Renders a line passing through the points defined by 'ln'.
Actor * | drawLineLoop (const std::vector< dvec2 > &ln)
| Renders a closed line passing through the points defined by 'ln'.
Actor * | fillPolygon (const std::vector< dvec2 > &poly)
| Renders a convex polygon whose corners are defined by 'poly'.
Actor * | fillTriangles (const std::vector< dvec2 > &triangles)
| Renders a set of triangles. The 'triangles' parameters must contain N triplets of dvec2. Each triplet defines a triangle.
Actor * | fillTriangleFan (const std::vector< dvec2 > &fan)
| Renders a triangle fan.
Actor * | fillTriangleStrip (const std::vector< dvec2 > &strip)
| Renders a strip of triangles as defined by the OpenGL primitive GL_TRIANGLE_STRIP.
Actor * | fillQuads (const std::vector< dvec2 > &quads)
| Renders a set of rectangles as defined by the OpenGL primitive GL_QUADS.
Actor * | fillQuadStrip (const std::vector< dvec2 > &quad_strip)
| Renders a set of rectangles as defined by the OpenGL primitive GL_QUAD_STRIP.
Actor * | drawPoint (double x, double y)
| Renders a single point. This is only an utility function. If you want to draw many points use drawPoints(const std::vector<dvec2>& pt) instead.
Actor * | drawPoints (const std::vector< dvec2 > &pt)
| Renders a set of points using the currently set pointSize(), color() and image().
Actor * | drawEllipse (double origx, double origy, double xaxis, double yaxis, int segments=64)
| Renders the outline of an ellipse.
Actor * | fillEllipse (double origx, double origy, double xaxis, double yaxis, int segments=64)
| Renders an ellipse.
Actor * | drawQuad (double left, double bottom, double right, double top)
| Utility function that renders the outline of a quad.
Actor * | fillQuad (double left, double bottom, double right, double top)
| Utility function that renders a single quad.
void | startDrawing ()
| Starts the drawing process.
void | continueDrawing ()
| Continues the rendering on a VectorGraphics object.
void | endDrawing (bool release_cache=true)
| Ends the rendering on a VectorGraphics and releases the resources used during the Actor generation process.
void | clear ()
| Resets the VectorGraphics removing all the graphics objects and resetting its internal state.
void | setColor (const fvec4 &color)
| The current color. Note that the current color also modulates the currently active image.
const fvec4 & | color () const
| The current color. Note that the current color also modulates the currently active image.
void | setPointSize (int size)
| The current point size.
int | pointSize () const
| The current point size.
void | setImage (Image *image)
| The current image used to texture the rendered objects. Note that the current color also modulates the currently active image.
const Image * | image () const
| The current image used to texture the rendered objects. Note that the current color also modulates the currently active image.
Image * | image ()
| The current image used to texture the rendered objects. Note that the current color also modulates the currently active image.
void | setPoint (Image *image)
| Utility function equivalent to 'setImage(image); setPointSize(image->width());'.
void | setTextureMode (ETextureMode mode)
| The current texture mode.
ETextureMode | textureMode () const
| The current texture mode.
void | setLogicOp (ELogicOp op)
| The current logic operation, see also http://www.opengl.org/sdk/docs/man/xhtml/glLogicOp.xml for more information.
ELogicOp | logicOp () const
| The current logic operation.
void | setLineWidth (float width)
| The current line width, see also http://www.opengl.org/sdk/docs/man/xhtml/glLineWidth.xml for more information.
float | lineWidth () const
| The current line width.
void | setPointSmoothing (bool smooth)
| The current point smoothing mode.
bool | pointSmoothing () const
| The current point smoothing mode.
void | setLineSmoothing (bool smooth)
| The current line smoothing mode.
bool | lineSmoothing () const
| The current line smoothing mode.
void | setPolygonSmoothing (bool smooth)
| The current polygon smoothing mode.
bool | polygonSmoothing () const
| The current polygon smoothing mode.
void | setLineStipple (ELineStipple stipple)
| The current line stipple, see also http://www.opengl.org/sdk/docs/man/xhtml/glLineStipple.xml for more information.
void | setLineStipple (unsigned short stipple)
| The current line stipple.
unsigned short | lineStipple () const
| The current line stipple.
void | setPolygonStipple (EPolygonStipple stipple)
| The current polygon stipple, see also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonStipple.xml for more information.
void | setPolygonStipple (unsigned char *stipple)
| The current polygon stipple.
const unsigned char * | polygonStipple () const
| The current polygon stipple.
unsigned char * | polygonStipple ()
| The current polygon stipple.
void | setAlphaFunc (EFunction func, float ref_value)
| The current alpha function, see also http://www.opengl.org/sdk/docs/man/xhtml/glAlphaFunc.xml for more information.
void | getAlphaFunc (EFunction &func, float &ref_value) const
| The current alpha function.
void | setBlendFunc (EBlendFactor src_rgb, EBlendFactor dst_rgb, EBlendFactor src_alpha, EBlendFactor dst_alpha)
| The current blending factor, see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml for more information.
void | getBlendFunc (EBlendFactor &src_rgb, EBlendFactor &dst_rgb, EBlendFactor &src_alpha, EBlendFactor &dst_alpha) const
| The current blending factor.
void | setBlendEquation (EBlendEquation rgb_eq, EBlendEquation alpha_eq)
| The current blend equation, see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendEquation.xml for more information.
void | getBlendEquation (EBlendEquation &rgb_eq, EBlendEquation &alpha_eq) const
| The current blend equation.
void | setColorMask (bool r, bool g, bool b, bool a)
| The current color mask, see also http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml for more information.
const ivec4 & | colorMask () const
| The current color mask.
void | setStencilTestEnabled (bool enabled)
| If set to 'true' the stencil test and operations will be enabled.
bool | stencilTestEnabled () const
| If set to 'true' the stencil test and operations will be enabled.
void | setStencilMask (unsigned int mask)
| Current stencil mask, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilMask.xml for more information.
unsigned int | stencilMask () const
| Current stencil mask.
void | setStencilOp (EStencilOp sfail, EStencilOp dpfail, EStencilOp dppass)
| Current stencil operation, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilOp.xml for more information.
void | getStencilOp (EStencilOp &sfail, EStencilOp &dpfail, EStencilOp &dppass)
| Current stencil operation.
void | setStencilFunc (EFunction func, int refval, unsigned int mask)
| The current stencil function, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilFunc.xml for more information.
void | getStencilFunc (EFunction &func, int &refval, unsigned int &mask)
| The current stencil function.
void | setFont (const String &name, int size, bool smooth=false)
| Sets the current Font.
void | setFont (const Font *font)
| Sets the current Font.
void | setDefaultFont ()
| Sets the default Font.
const Font * | font () const
| Returns the current Font.
void | setScissor (int x, int y, int width, int height)
| Defines the scissor box and enables the scissor test.
const Scissor * | scissor () const
| Returns the currently active Scissor.
void | removeScissor ()
| Disables the Scissor test and clipping.
Actor * | clearColor (const fvec4 &color, int x=0, int y=0, int w=-1, int h=-1)
| Clears the specific area of the viewport.
Actor * | clearStencil (int clear_val, int x=0, int y=0, int w=-1, int h=-1)
| Clears the specific area of the viewport.
Actor * | drawText (Text *text)
| Draw the specified Text object.
Actor * | drawText (int x, int y, const String &text, int alignment=AlignBottom|AlignLeft)
| Draws the specified text at the specified position.
Actor * | drawText (const String &text, int alignment=AlignBottom|AlignLeft)
| Draws the specified text.
Actor * | drawActor (Actor *actor, Transform *transform=NULL, bool keep_effect=false)
| Draws the specified Actor with the specified Transform.
Actor * | drawActorCopy (Actor *actor, Transform *transform=NULL)
| Like drawActor() but instead of drawing the given actor creates a copy of it and draws that.
const dmat4 & | matrix () const
| Returns the current transform matrix.
void | setMatrix (const dmat4 &matrix)
| Sets the current transform matrix.
void | resetMatrix ()
| Resets the current transform matrix.
void | rotate (double deg)
| Performs a rotation of 'deg' degrees around the z axis.
void | translate (double x, double y, double z=0.0)
| Translates the current transform matrix.
void | scale (double x, double y, double z=1.0)
| Scales the current transform matrix.
void | pushMatrix ()
| Pushes the current matrix in the matrix stack in order to restore it later with popMatrix().
void | popMatrix ()
| Pops the top most matrix in the matrix stack and sets it as the current matrix.
const std::vector< dmat4 > & | matrixStack () const
| Returns the matrix stack.
void | pushState ()
| Pushes the current VectorGraphics state (including the matrix state) in the state stack in order to restore it later with popState().
void | popState ()
| Pops the top most state in the state stack and sets it as the current state.
void | pushScissor (int x, int y, int w, int h)
| Pushes the current scissor in the scissor stack in order to restore it later with popScissor() and activates a new one.
void | popScissor ()
| Pops the top most scissor in the scissor stack and sets it as the current scissor.
const std::vector< ref < Scissor > > & | scissorStack () const
| Returns the scissor stack.
void | setTransform (Transform *transform)
| Binds the given Transform to all the Actor[s] that have been generated so far.
Effect * | currentEffect ()
| Returns the Effect representing the current VectorGraphic's state.

## Detailed Description

The VectorGraphics class is used in conjuction with SceneManagerVectorGraphics to generate and render 2D vector graphics.

The VectorGraphics object is basically nothing more than an container of Actor[s] generated by functions like drawLines(), fillTriangles() etc. The Actor[s] are rendered in the order in which they are generated.

The VectorGraphics class features a set of advanced capabilites:

- Matrix transformations and matrix stack
- State stack
- All the blending operations supported by OpenGL
- All the stencil operations supported by OpenGL
- Texture mapping on all the primitives with automatic texture coordinate generation
- Several primitives like lines, points, quads, triangles, line strips, triangle strips, ellipses etc.
- Polygon and line stipple
- Text rendering
- Scissor test to clip the objects against a rectangular region
- Line and point smoothing
- Color logic operations

For more information please refer to the 2D Vector Graphics page.

Definition at line 106 of file VectorGraphics.hpp.

## Constructor & Destructor Documentation

VectorGraphics::VectorGraphics | ( | ) |

Definition at line 37 of file VectorGraphics.cpp.

References vl::EN_BLEND, and vl::Object::setAutomaticDelete().

## Member Function Documentation

const ActorCollection* vl::VectorGraphics::actors | ( | ) | const`[inline]`

Returns the list of Actor[s] generated by a VectorGraphics object.

Definition at line 330 of file VectorGraphics.hpp.

Referenced by vl::SceneManagerVectorGraphics::extractActors().

ActorCollection* vl::VectorGraphics::actors | ( | ) | `[inline]`

Returns the list of Actor[s] generated by a VectorGraphics object.

Definition at line 333 of file VectorGraphics.hpp.

Actor * VectorGraphics::drawLine | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2
| ) |  |

Renders a line starting a point <x1,y1> and ending at point <x2,y2>

Definition at line 44 of file VectorGraphics.cpp.

References drawLines().

Actor * VectorGraphics::drawLines | ( | const std::vector< dvec2 > & | ln ) |

Renders a set of lines. The 'ln' parameter shoud contain N pairs of dvec2. Each pair defines a line segment.

Definition at line 52 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_LINES.

Referenced by drawLine().

Actor * VectorGraphics::drawLineStrip | ( | const std::vector< dvec2 > & | ln ) |

Renders a line passing through the points defined by 'ln'.

Definition at line 77 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_LINE_STRIP.

Referenced by drawEllipse().

Actor * VectorGraphics::drawLineLoop | ( | const std::vector< dvec2 > & | ln ) |

Renders a closed line passing through the points defined by 'ln'.

Definition at line 89 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_LINE_LOOP.

Referenced by drawQuad().

Actor * VectorGraphics::fillPolygon | ( | const std::vector< dvec2 > & | poly ) |

Renders a convex polygon whose corners are defined by 'poly'.

Definition at line 101 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_TRIANGLES.

Referenced by fillEllipse().

Actor * VectorGraphics::fillTriangles | ( | const std::vector< dvec2 > & | triangles ) |

Renders a set of triangles. The 'triangles' parameters must contain N triplets of dvec2. Each triplet defines a triangle.

Definition at line 113 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_TRIANGLES.

Actor * VectorGraphics::fillTriangleFan | ( | const std::vector< dvec2 > & | fan ) |

Renders a triangle fan.

Definition at line 125 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_TRIANGLE_FAN.

Actor * VectorGraphics::fillTriangleStrip | ( | const std::vector< dvec2 > & | strip ) |

Renders a strip of triangles as defined by the OpenGL primitive GL_TRIANGLE_STRIP.

Definition at line 137 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_TRIANGLE_STRIP.

Actor * VectorGraphics::fillQuads | ( | const std::vector< dvec2 > & | quads ) |

Renders a set of rectangles as defined by the OpenGL primitive GL_QUADS.

Definition at line 149 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_QUADS.

Actor * VectorGraphics::fillQuadStrip | ( | const std::vector< dvec2 > & | quad_strip ) |

Renders a set of rectangles as defined by the OpenGL primitive GL_QUAD_STRIP.

Definition at line 161 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_QUAD_STRIP.

Actor * VectorGraphics::drawPoint | ( | double | x,
|  | double | y
| ) |  |

Renders a single point. This is only an utility function. If you want to draw many points use drawPoints(const std::vector<dvec2>& pt) instead.

Definition at line 173 of file VectorGraphics.cpp.

References drawPoints().

Actor * VectorGraphics::drawPoints | ( | const std::vector< dvec2 > & | pt ) |

Renders a set of points using the currently set pointSize(), color() and image().

Definition at line 180 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), matrix(), NULL, and vl::PT_POINTS.

Referenced by drawPoint().

Actor * VectorGraphics::drawEllipse | ( | double | origx,
|  | double | origy,
|  | double | xaxis,
|  | double | yaxis,
|  | int | segments = `64`
| ) |  |

Renders the outline of an ellipse.

Definition at line 204 of file VectorGraphics.cpp.

References vl::cos(), vl::dPi, drawLineStrip(), and vl::sin().

Actor * VectorGraphics::fillEllipse | ( | double | origx,
|  | double | origy,
|  | double | xaxis,
|  | double | yaxis,
|  | int | segments = `64`
| ) |  |

Renders an ellipse.

Definition at line 216 of file VectorGraphics.cpp.

References vl::cos(), vl::dPi, fillPolygon(), and vl::sin().

Actor * VectorGraphics::drawQuad | ( | double | left,
|  | double | bottom,
|  | double | right,
|  | double | top
| ) |  |

Utility function that renders the outline of a quad.

Definition at line 228 of file VectorGraphics.cpp.

References drawLineLoop().

Actor * VectorGraphics::fillQuad | ( | double | left,
|  | double | bottom,
|  | double | right,
|  | double | top
| ) |  |

Utility function that renders a single quad.

Definition at line 238 of file VectorGraphics.cpp.

References currentEffect(), vl::ref< T >::get(), NULL, and vl::PT_TRIANGLE_FAN.

void vl::VectorGraphics::startDrawing | ( | ) | `[inline]`

Starts the drawing process.

You have to call this function before calling any of the fill* and draw* functions. This function will erase all the previously generated content of the VectorGraphics.

Definition at line 385 of file VectorGraphics.hpp.

void VectorGraphics::continueDrawing | ( | ) |

Continues the rendering on a VectorGraphics object.

This function will reset the VectorGraphics state and matrix but will not erase the previously generated graphics.

Definition at line 255 of file VectorGraphics.cpp.

void VectorGraphics::endDrawing | ( | bool | release_cache = `true` ) |

Ends the rendering on a VectorGraphics and releases the resources used during the Actor generation process.

If you intend to continue the rendering or to add new graphics objects later set 'release_cache' to false.

Definition at line 270 of file VectorGraphics.cpp.

void VectorGraphics::clear | ( | ) |

Resets the VectorGraphics removing all the graphics objects and resetting its internal state.

Definition at line 284 of file VectorGraphics.cpp.

References vl::Collection< T >::clear().

Referenced by clearColor(), and clearStencil().

void vl::VectorGraphics::setColor | ( | const fvec4 & | color ) | `[inline]`

The current color. Note that the current color also modulates the currently active image.

Definition at line 399 of file VectorGraphics.hpp.

const fvec4& vl::VectorGraphics::color | ( | ) | const`[inline]`

The current color. Note that the current color also modulates the currently active image.

Definition at line 402 of file VectorGraphics.hpp.

void vl::VectorGraphics::setPointSize | ( | int | size ) | `[inline]`

The current point size.

Definition at line 405 of file VectorGraphics.hpp.

int vl::VectorGraphics::pointSize | ( | ) | const`[inline]`

The current point size.

Definition at line 408 of file VectorGraphics.hpp.

void vl::VectorGraphics::setImage | ( | Image * | image ) | `[inline]`

The current image used to texture the rendered objects. Note that the current color also modulates the currently active image.

Definition at line 411 of file VectorGraphics.hpp.

const Image* vl::VectorGraphics::image | ( | ) | const`[inline]`

The current image used to texture the rendered objects. Note that the current color also modulates the currently active image.

Definition at line 414 of file VectorGraphics.hpp.

Image* vl::VectorGraphics::image | ( | ) | `[inline]`

The current image used to texture the rendered objects. Note that the current color also modulates the currently active image.

Definition at line 417 of file VectorGraphics.hpp.

void vl::VectorGraphics::setPoint | ( | Image * | image ) | `[inline]`

Utility function equivalent to 'setImage(image); setPointSize(image->width());'.

Definition at line 420 of file VectorGraphics.hpp.

References vl::Image::width().

void vl::VectorGraphics::setTextureMode | ( | ETextureMode | mode ) | `[inline]`

The current texture mode.

Definition at line 423 of file VectorGraphics.hpp.

ETextureMode vl::VectorGraphics::textureMode | ( | ) | const`[inline]`

The current texture mode.

Definition at line 426 of file VectorGraphics.hpp.

void vl::VectorGraphics::setLogicOp | ( | ELogicOp | op ) | `[inline]`

The current logic operation, see also http://www.opengl.org/sdk/docs/man/xhtml/glLogicOp.xml for more information.

Definition at line 429 of file VectorGraphics.hpp.

ELogicOp vl::VectorGraphics::logicOp | ( | ) | const`[inline]`

The current logic operation.

Definition at line 432 of file VectorGraphics.hpp.

void vl::VectorGraphics::setLineWidth | ( | float | width ) | `[inline]`

The current line width, see also http://www.opengl.org/sdk/docs/man/xhtml/glLineWidth.xml for more information.

Definition at line 435 of file VectorGraphics.hpp.

float vl::VectorGraphics::lineWidth | ( | ) | const`[inline]`

The current line width.

Definition at line 438 of file VectorGraphics.hpp.

void vl::VectorGraphics::setPointSmoothing | ( | bool | smooth ) | `[inline]`

The current point smoothing mode.

Definition at line 441 of file VectorGraphics.hpp.

bool vl::VectorGraphics::pointSmoothing | ( | ) | const`[inline]`

The current point smoothing mode.

Definition at line 444 of file VectorGraphics.hpp.

void vl::VectorGraphics::setLineSmoothing | ( | bool | smooth ) | `[inline]`

The current line smoothing mode.

Definition at line 447 of file VectorGraphics.hpp.

bool vl::VectorGraphics::lineSmoothing | ( | ) | const`[inline]`

The current line smoothing mode.

Definition at line 450 of file VectorGraphics.hpp.

void vl::VectorGraphics::setPolygonSmoothing | ( | bool | smooth ) | `[inline]`

The current polygon smoothing mode.

Definition at line 453 of file VectorGraphics.hpp.

bool vl::VectorGraphics::polygonSmoothing | ( | ) | const`[inline]`

The current polygon smoothing mode.

Definition at line 456 of file VectorGraphics.hpp.

void VectorGraphics::setLineStipple | ( | ELineStipple | stipple ) |

The current line stipple, see also http://www.opengl.org/sdk/docs/man/xhtml/glLineStipple.xml for more information.

Definition at line 301 of file VectorGraphics.cpp.

References vl::LineStipple_Dash, vl::LineStipple_Dash4, vl::LineStipple_Dash8, vl::LineStipple_DashDot, vl::LineStipple_DashDotDot, vl::LineStipple_Dot, and vl::LineStipple_Solid.

void vl::VectorGraphics::setLineStipple | ( | unsigned short | stipple ) | `[inline]`

The current line stipple.

Definition at line 462 of file VectorGraphics.hpp.

unsigned short vl::VectorGraphics::lineStipple | ( | ) | const`[inline]`

The current line stipple.

Definition at line 465 of file VectorGraphics.hpp.

void VectorGraphics::setPolygonStipple | ( | EPolygonStipple | stipple ) |

The current polygon stipple, see also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonStipple.xml for more information.

Definition at line 315 of file VectorGraphics.cpp.

References vl::PolygonStipple_Chain, vl::PolygonStipple_Dot, vl::PolygonStipple_HLine, vl::PolygonStipple_Solid, and vl::PolygonStipple_VLine.

void vl::VectorGraphics::setPolygonStipple | ( | unsigned char * | stipple ) | `[inline]`

The current polygon stipple.

Definition at line 471 of file VectorGraphics.hpp.

const unsigned char* vl::VectorGraphics::polygonStipple | ( | ) | const`[inline]`

The current polygon stipple.

Definition at line 474 of file VectorGraphics.hpp.

unsigned char* vl::VectorGraphics::polygonStipple | ( | ) | `[inline]`

The current polygon stipple.

Definition at line 477 of file VectorGraphics.hpp.

void vl::VectorGraphics::setAlphaFunc | ( | EFunction | func,
|  | float | ref_value
| ) |  | `[inline]`

The current alpha function, see also http://www.opengl.org/sdk/docs/man/xhtml/glAlphaFunc.xml for more information.

Definition at line 480 of file VectorGraphics.hpp.

void vl::VectorGraphics::getAlphaFunc | ( | EFunction & | func,
|  | float & | ref_value
| ) |  | const`[inline]`

The current alpha function.

Definition at line 483 of file VectorGraphics.hpp.

void VectorGraphics::setBlendFunc | ( | EBlendFactor | src_rgb,
|  | EBlendFactor | dst_rgb,
|  | EBlendFactor | src_alpha,
|  | EBlendFactor | dst_alpha
| ) |  |

The current blending factor, see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml for more information.

Definition at line 372 of file VectorGraphics.cpp.

void VectorGraphics::getBlendFunc | ( | EBlendFactor & | src_rgb,
|  | EBlendFactor & | dst_rgb,
|  | EBlendFactor & | src_alpha,
|  | EBlendFactor & | dst_alpha
| ) |  | const

The current blending factor.

Definition at line 380 of file VectorGraphics.cpp.

void VectorGraphics::setBlendEquation | ( | EBlendEquation | rgb_eq,
|  | EBlendEquation | alpha_eq
| ) |  |

The current blend equation, see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendEquation.xml for more information.

Definition at line 388 of file VectorGraphics.cpp.

void VectorGraphics::getBlendEquation | ( | EBlendEquation & | rgb_eq,
|  | EBlendEquation & | alpha_eq
| ) |  | const

The current blend equation.

Definition at line 394 of file VectorGraphics.cpp.

void vl::VectorGraphics::setColorMask | ( | bool | r,
|  | bool | g,
|  | bool | b,
|  | bool | a
| ) |  | `[inline]`

The current color mask, see also http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml for more information.

Definition at line 498 of file VectorGraphics.hpp.

const ivec4& vl::VectorGraphics::colorMask | ( | ) | const`[inline]`

The current color mask.

Definition at line 501 of file VectorGraphics.hpp.

void vl::VectorGraphics::setStencilTestEnabled | ( | bool | enabled ) | `[inline]`

If set to 'true' the stencil test and operations will be enabled.

Definition at line 507 of file VectorGraphics.hpp.

bool vl::VectorGraphics::stencilTestEnabled | ( | ) | const`[inline]`

If set to 'true' the stencil test and operations will be enabled.

Definition at line 510 of file VectorGraphics.hpp.

void vl::VectorGraphics::setStencilMask | ( | unsigned int | mask ) | `[inline]`

Current stencil mask, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilMask.xml for more information.

Definition at line 513 of file VectorGraphics.hpp.

unsigned int vl::VectorGraphics::stencilMask | ( | ) | const`[inline]`

Current stencil mask.

Definition at line 516 of file VectorGraphics.hpp.

void VectorGraphics::setStencilOp | ( | EStencilOp | sfail,
|  | EStencilOp | dpfail,
|  | EStencilOp | dppass
| ) |  |

Current stencil operation, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilOp.xml for more information.

Definition at line 400 of file VectorGraphics.cpp.

void VectorGraphics::getStencilOp | ( | EStencilOp & | sfail,
|  | EStencilOp & | dpfail,
|  | EStencilOp & | dppass
| ) |  |

Current stencil operation.

Definition at line 407 of file VectorGraphics.cpp.

void VectorGraphics::setStencilFunc | ( | EFunction | func,
|  | int | refval,
|  | unsigned int | mask
| ) |  |

The current stencil function, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilFunc.xml for more information.

Definition at line 414 of file VectorGraphics.cpp.

void VectorGraphics::getStencilFunc | ( | EFunction & | func,
|  | int & | refval,
|  | unsigned int & | mask
| ) |  |

The current stencil function.

Definition at line 421 of file VectorGraphics.cpp.

void vl::VectorGraphics::setFont | ( | const String & | name,
|  | int | size,
|  | bool | smooth = `false`
| ) |  | `[inline]`

Sets the current Font.

Definition at line 531 of file VectorGraphics.hpp.

References vl::FontManager::acquireFont(), and vl::defFontManager().

void vl::VectorGraphics::setFont | ( | const Font * | font ) | `[inline]`

Sets the current Font.

Definition at line 534 of file VectorGraphics.hpp.

References vl::Font::filePath(), setFont(), vl::Font::size(), and vl::Font::smooth().

Referenced by setFont().

void vl::VectorGraphics::setDefaultFont | ( | ) | `[inline]`

Sets the default Font.

Definition at line 537 of file VectorGraphics.hpp.

References vl::defFontManager().

const Font* vl::VectorGraphics::font | ( | ) | const`[inline]`

Returns the current Font.

Definition at line 540 of file VectorGraphics.hpp.

void vl::VectorGraphics::setScissor | ( | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  | `[inline]`

Defines the scissor box and enables the scissor test.

The parameters are considered in windows coordinates. The Scissor is used to clip the rendering against a specific rectangular area. See also http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml for more information.

Definition at line 546 of file VectorGraphics.hpp.

Referenced by pushScissor().

const Scissor* vl::VectorGraphics::scissor | ( | ) | const`[inline]`

Returns the currently active Scissor.

Definition at line 552 of file VectorGraphics.hpp.

void vl::VectorGraphics::removeScissor | ( | ) | `[inline]`

Disables the Scissor test and clipping.

Definition at line 555 of file VectorGraphics.hpp.

References NULL.

Actor * VectorGraphics::clearColor | ( | const fvec4 & | color,
|  | int | x = `0`,
|  | int | y = `0`,
|  | int | w = `-1`,
|  | int | h = `-1`
| ) |  |

Clears the specific area of the viewport.

The parameters x y w h define a rectangular area in viewport coordinates that is clipped against the viewport itself.

Note:
  The specified rectangular area is not affected by the current matrix transform.

Definition at line 428 of file VectorGraphics.cpp.

References clear(), currentEffect(), vl::ref< T >::get(), and NULL.

Actor * VectorGraphics::clearStencil | ( | int | clear_val,
|  | int | x = `0`,
|  | int | y = `0`,
|  | int | w = `-1`,
|  | int | h = `-1`
| ) |  |

Clears the specific area of the viewport.

The parameters x y w h define a rectangular area in viewport coordinates that is clipped against the viewport itself.

Note:
  The specified rectangular area is not affected by the current matrix transform.

Definition at line 437 of file VectorGraphics.cpp.

References clear(), currentEffect(), vl::ref< T >::get(), and NULL.

Actor * VectorGraphics::drawText | ( | Text * | text ) |

Draw the specified Text object.

Definition at line 446 of file VectorGraphics.cpp.

References currentEffect(), vl::Text::font(), NULL, and vl::Text::setFont().

Referenced by drawText().

Actor * VectorGraphics::drawText | ( | int | x,
|  | int | y,
|  | const String & | text,
|  | int | alignment = `AlignBottom|AlignLeft`
| ) |  |

Draws the specified text at the specified position.

Note that the current matrix transform affect the final position, rotation and scaling of the text.

Definition at line 453 of file VectorGraphics.cpp.

References drawText(), vl::Matrix4< double >::getTranslation(), popMatrix(), and pushMatrix().

Actor * VectorGraphics::drawText | ( | const String & | text,
|  | int | alignment = `AlignBottom|AlignLeft`
| ) |  |

Draws the specified text.

Definition at line 462 of file VectorGraphics.cpp.

References vl::AlignBottom, vl::AlignLeft, drawText(), vl::ref< T >::get(), and matrix().

Actor * VectorGraphics::drawActor | ( | Actor * | actor,
|  | Transform * | transform = `NULL`,
|  | bool | keep_effect = `false`
| ) |  |

Draws the specified Actor with the specified Transform.

If keep_effect is set to 'false' or the Actor's Effect is NULL a default Effect is automatically generated. If 'transform' is non NULL it is bound to the Actor.

Definition at line 473 of file VectorGraphics.cpp.

References currentEffect(), vl::Actor::effect(), NULL, vl::Actor::setEffect(), vl::Actor::setTransform(), and VL_CHECK.

Referenced by drawActorCopy().

Actor * VectorGraphics::drawActorCopy | ( | Actor * | actor,
|  | Transform * | transform = `NULL`
| ) |  |

Like drawActor() but instead of drawing the given actor creates a copy of it and draws that.

This function is useful when you want to crate multiple instances of the same geometry.

Definition at line 483 of file VectorGraphics.cpp.

References drawActor(), and vl::ref< T >::get().

const dmat4& vl::VectorGraphics::matrix | ( | ) | const`[inline]`

Returns the current transform matrix.

Definition at line 592 of file VectorGraphics.hpp.

Referenced by drawPoints(), and drawText().

void vl::VectorGraphics::setMatrix | ( | const dmat4 & | matrix ) | `[inline]`

Sets the current transform matrix.

Definition at line 595 of file VectorGraphics.hpp.

Referenced by popMatrix().

void vl::VectorGraphics::resetMatrix | ( | ) | `[inline]`

Resets the current transform matrix.

Definition at line 598 of file VectorGraphics.hpp.

void VectorGraphics::rotate | ( | double | deg ) |

Performs a rotation of 'deg' degrees around the z axis.

Definition at line 491 of file VectorGraphics.cpp.

References vl::Matrix4< double >::getRotation().

void VectorGraphics::translate | ( | double | x,
|  | double | y,
|  | double | z = `0.0`
| ) |  |

Translates the current transform matrix.

Definition at line 496 of file VectorGraphics.cpp.

References vl::Matrix4< double >::getTranslation().

void VectorGraphics::scale | ( | double | x,
|  | double | y,
|  | double | z = `1.0`
| ) |  |

Scales the current transform matrix.

Definition at line 501 of file VectorGraphics.cpp.

References vl::Matrix4< double >::getScaling().

void vl::VectorGraphics::pushMatrix | ( | ) | `[inline]`

Pushes the current matrix in the matrix stack in order to restore it later with popMatrix().

Definition at line 610 of file VectorGraphics.hpp.

Referenced by drawText(), and pushState().

void VectorGraphics::popMatrix | ( | ) |

Pops the top most matrix in the matrix stack and sets it as the current matrix.

Definition at line 506 of file VectorGraphics.cpp.

References vl::Log::error(), and setMatrix().

Referenced by drawText(), and popState().

const std::vector<dmat4>& vl::VectorGraphics::matrixStack | ( | ) | const`[inline]`

Returns the matrix stack.

Definition at line 616 of file VectorGraphics.hpp.

void VectorGraphics::pushState | ( | ) |

Pushes the current VectorGraphics state (including the matrix state) in the state stack in order to restore it later with popState().

Definition at line 517 of file VectorGraphics.cpp.

References pushMatrix().

void VectorGraphics::popState | ( | ) |

Pops the top most state in the state stack and sets it as the current state.

Definition at line 523 of file VectorGraphics.cpp.

References vl::Log::error(), and popMatrix().

void VectorGraphics::pushScissor | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  |

Pushes the current scissor in the scissor stack in order to restore it later with popScissor() and activates a new one.

The 'x', 'y', 'w' and 'h' parameters define the new scissor rectangle. Note that such rectangle is clipped against the currently active one.

Definition at line 535 of file VectorGraphics.cpp.

References vl::ref< T >::get(), vl::Rect< T >::height(), setScissor(), vl::Rect< T >::width(), vl::Rect< T >::x(), and vl::Rect< T >::y().

void VectorGraphics::popScissor | ( | ) |

Pops the top most scissor in the scissor stack and sets it as the current scissor.

Definition at line 542 of file VectorGraphics.cpp.

References vl::Log::error().

const std::vector< ref<Scissor> >& vl::VectorGraphics::scissorStack | ( | ) | const`[inline]`

Returns the scissor stack.

Definition at line 635 of file VectorGraphics.hpp.

void vl::VectorGraphics::setTransform | ( | Transform * | transform ) | `[inline]`

Binds the given Transform to all the Actor[s] that have been generated so far.

Definition at line 638 of file VectorGraphics.hpp.

Effect* vl::VectorGraphics::currentEffect | ( | ) | `[inline]`

Returns the Effect representing the current VectorGraphic's state.

Definition at line 641 of file VectorGraphics.hpp.

References currentEffect().

Referenced by clearColor(), clearStencil(), currentEffect(), drawActor(), drawLineLoop(), drawLines(), drawLineStrip(), drawPoints(), drawText(), fillPolygon(), fillQuad(), fillQuads(), fillQuadStrip(), fillTriangleFan(), fillTriangles(), and fillTriangleStrip().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlVG/VectorGraphics.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlVG/VectorGraphics.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:59.
Permission is granted to use this page to write and publish articles regarding Visualization Library.