class ffw::GLCanvas
Class List > ffw :: GLCanvas
Classes
Type | Name |
---|---|
class | Font |
struct | GlyphPosition |
class | Image |
struct | ImageFlags |
struct | Paint |
struct | Settings |
struct | TextAlign |
struct | TextRow |
Public Types
Type | Name |
---|---|
enum | API { AUTO = 0, GL2, GL3, GLES2, GLES3 } |
enum | Mode { FILL, STROKE, FILL_AND_STROKE } |
enum | Winding { CCW, CW } |
enum | Solidity { SOLID, HOLE } |
enum | LineCap { BUTT, ROUND, SQUARE } |
enum | LineJoin { ROUND, BEVEL, MITER } |
enum | BlendFactor { ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, SRC_ALPHA_SATURATE } |
enum | CompositeOperation { SOURCE_OVER, SOURCE_IN, SOURCE_OUT, ATOP, DESTINATION_OVER, DESTINATION_IN, DESTINATION_OUT, DESTINATION_ATOP, LIGHTER, COPY, XOR } |
Public Attributes
Type | Name |
---|---|
friend | Font |
Public Functions
Type | Name |
---|---|
GLCanvas () | |
GLCanvas (const Settings & settings) | |
GLCanvas (const GLCanvas & other) = delete | |
GLCanvas (GLCanvas && other) | |
GLCanvas & | operator= (const GLCanvas & other) = delete |
GLCanvas & | operator= (GLCanvas && other) |
void | swap (GLCanvas & other) |
virtual | ~GLCanvas () |
void | destroy () |
void | beginFrame (const Vec2f & size) const Begin drawing a new frame. |
void | endFrame () const Ends drawing flushing remaining render state. |
void | cancelFrame () const Cancels drawing the current frame. |
void | globalCompositeOperation (CompositeOperation op) const Sets the composite operation. |
void | globalCompositeBlendFunc (BlendFactor sfactor, BlendFactor dfactor) const Sets the composite operation with custom pixel arithmetic. |
void | globalCompositeBlendFuncSeparate (BlendFactor srcRGB, BlendFactor dstRGB, BlendFactor srcAlpha, BlendFactor dstAlpha) const Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. |
void | save () const Pushes and saves the current render state into a state stack. |
void | restore () const Pops and restores current render state. |
void | reset () const Resets current render state to default values. |
void | shapeAntiAlias (bool enabled) const Sets whether to draw antialias for stroke() and fill(). |
void | strokeColor (const Color & color) const Sets current stroke style to a solid color. |
void | strokePaint (const Paint & paint) const Sets current stroke style to a paint, which can be a one of the gradients or a pattern. |
void | fillColor (const Color & color) const Sets current fill style to a solid color. |
void | fillPaint (const Paint & paint) const Sets current fill style to a paint, which can be a one of the gradients or a pattern. |
void | miterLimit (float limit) const Sets the miter limit of the stroke style. |
void | strokeWidth (float size) const Sets the stroke width of the stroke style. |
void | lineCap (LineCap cap) const Sets how the end of the line (cap) is drawn. |
void | lineJoin (LineJoin join) const Sets how sharp path corners are drawn. |
void | globalAlpha (float alpha) const Sets the transparency applied to all rendered shapes. |
void | resetTransform () const Resets current transform to a identity matrix. |
void | transform (const Mat3x3f & mat) const Premultiplies current coordinate system by specified matrix. |
void | translate (const Vec2f & pos) const Translates current coordinate system. |
void | rotate (float angle) const Rotates current coordinate system in degrees. |
void | rotateRad (float angle) const Rotates current coordinate system in radians. |
void | skewX (float angle) const Skews the current coordinate system along X axis in degrees. |
void | skewXRad (float angle) const Skews the current coordinate system along X axis in radians. |
void | skewY (float angle) const Skews the current coordinate system along Y axis in degrees. |
void | skewYRad (float angle) const Skews the current coordinate system along Y axis in radians. |
void | scale (float x, float y) const Scales the current coordinate system. |
Mat3x3f | getCurrentTransform () const Returns the current transformation matrix. |
void | setTransform (const Mat3x3f & mat) const Sets the current transformation matrix. |
Image | createImage (const GLTexture2D & texture, ImageFlags::Flag imageFlags = 0) const Creates image from raw RGBA pixels. |
Paint | linearGradient (const ffw::Vec2f & start, const ffw::Vec2f & end, const Color & icol, const Color & ocol) const Creates and returns a linear gradient. |
Paint | boxGradient (const ffw::Vec2f & pos, const ffw::Vec2f & size, float r, float f, const Color & icol, const Color & ocol) const Creates and returns a box gradient. |
Paint | radialGradient (const ffw::Vec2f & center, float inr, float outr, const Color & icol, const Color & ocol) const Creates and returns a radial gradient. |
Paint | imagePattern (const Vec2f & start, const Vec2f & end, float angle, const Image & image, float alpha) const Creates and returns an image patter. |
void | scissor (const Vec2f & pos, const Vec2f & size) const Sets the current scissor rectangle. |
void | intersectScissor (const Vec2f & pos, const Vec2f & size) const Intersects current scissor rectangle with the specified rectangle. |
void | resetScissor () const Reset and disables scissoring. |
void | beginPath () const Clears the current path and sub-paths. |
void | moveTo (const Vec2f & pos) const Starts new sub-path with specified point as first point. |
void | lineTo (const Vec2f & pos) const Adds line segment from the last point in the path to the specified point. |
void | bezierTo (const Vec2f & c1, const Vec2f & c2, const Vec2f & pos) const Adds cubic bezier segment from last point in the path via two control points to the specified point. |
void | quadTo (const Vec2f & c, const Vec2f & pos) const Adds quadratic bezier segment from last point in the path via a control point to the specified point. |
void | arcTo (const Vec2f & x1, const Vec2f & x2, float angle) const Adds an arc segment at the corner defined by the last path point, and two specified points. |
void | arcToRad (const Vec2f & x1, const Vec2f & x2, float angle) const Adds an arc segment at the corner defined by the last path point, and two specified points. |
void | closePath () const Closes current sub-path with a line segment. |
void | pathWinding (Winding dir) const Sets the current sub-path winding. |
void | pathWinding (Solidity dir) const Sets the current sub-path winding. |
void | arc (const Vec2f & center, float r, float a0, float a1, Winding dir) const Creates new circle arc shaped sub-path. |
void | arcRad (const Vec2f & center, float r, float a0, float a1, Winding dir) const Creates new circle arc shaped sub-path. |
void | rect (const Vec2f & pos, const Vec2f & size) const Creates new rectangle shaped sub-path. |
void | roundedRect (const Vec2f & pos, const Vec2f & size, float r) const Creates new rounded rectangle shaped sub-path. |
void | roundedRect (const Vec2f & pos, const Vec2f & size, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft) const Creates new rounded rectangle shaped sub-path with varying radii for each corner. |
void | ellipse (const Vec2f & pos, float rx, float ry) const Creates new ellipse shaped sub-path. |
void | circle (const Vec2f & pos, float r) const Creates new circle shaped sub-path. |
void | fill () const Fills the current path with current fill style. |
void | stroke () const Fills the current path with current stroke style. |
Font | createFont (const std::string & filename) const Creates font by loading it from the disk from specified file name. |
Font | createFontMem (unsigned char * data, size_t length) const Creates font by loading it from the specified memory chunk. |
void | addFallbackFontId (Font & baseFont, Font & fallbackFont) const Adds a fallback font by handle. |
void | fontSize (float size) const Sets the font size of current text style. |
void | fontBlur (float blur) const Sets the blur of current text style. |
void | textLetterSpacing (float spacing) const Sets the letter spacing of current text style. |
void | textLineHeight (float lineHeight) const Sets the proportional line height of current text style. The line height is specified as multiple of font size. |
void | textAlign (TextAlign::Flag align) const Sets the text align of current text style. |
void | fontFace (const Font & font) const Sets the font face based on specified id of current text style. |
void | text (const Vec2f & pos, const char * string, const char * end) const Draws text string at specified location. |
void | text (const Vec2f & pos, const std::string & str) const Draws text string at specified location. |
void | textBox (const Vec2f & pos, float breakRowWidth, const char * string, const char * end) const Draws multi-line text string at specified location wrapped at the specified width. |
void | textBox (const Vec2f & pos, float breakRowWidth, const std::string & str) const Draws multi-line text string at specified location wrapped at the specified width. |
float | textBounds (const Vec2f & pos, const char * string, const char * end, Vec4f & bounds) const Measures the specified text string. |
float | textBounds (const Vec2f & pos, const std::string & str, Vec4f & bounds) const Measures the specified text string. |
Vec4f | textBoxBounds (const Vec2f & pos, float breakRowWidth, const char * string, const char * end) const Measures the specified multi-text string. |
Vec4f | textBoxBounds (const Vec2f & pos, float breakRowWidth, const std::string & str) const Measures the specified multi-text string. |
void | textMetrics (float & ascender, float & descender, float & lineh) const Returns the vertical metrics based on the current text style. |
int | textBreakLines (const char * string, const char * end, float width, TextRow * rows, size_t numrows) const Breaks the specified text into lines. If end is specified only the sub-string will be used. |
int | textBreakLines (const std::string & string, float width, TextRow * rows, size_t numrows) const Breaks the specified text into lines. If end is specified only the sub-string will be used. |
int | textGlyphPositions (const Vec2f & pos, const std::string & str, GlyphPosition * positions, size_t numpositions) const Calculates the glyph x positions of the specified text. |
int | textGlyphPositions (const Vec2f & pos, const char * string, const char * end, GlyphPosition * positions, size_t numpositions) const Calculates the glyph x positions of the specified text. |
Detailed Description
Canvas used for drawing simple 2D shapes using nanovg library.
Public Types Documentation
enum API
enum ffw::GLCanvas::API {
AUTO = 0,
GL2,
GL3,
GLES2,
GLES3,
};
enum Mode
enum ffw::GLCanvas::Mode {
FILL,
STROKE,
FILL_AND_STROKE,
};
enum Winding
enum ffw::GLCanvas::Winding {
CCW,
CW,
};
enum Solidity
enum ffw::GLCanvas::Solidity {
SOLID,
HOLE,
};
enum LineCap
enum ffw::GLCanvas::LineCap {
BUTT,
ROUND,
SQUARE,
};
enum LineJoin
enum ffw::GLCanvas::LineJoin {
ROUND,
BEVEL,
MITER,
};
enum BlendFactor
enum ffw::GLCanvas::BlendFactor {
ZERO,
ONE,
SRC_COLOR,
ONE_MINUS_SRC_COLOR,
DST_COLOR,
ONE_MINUS_DST_COLOR,
SRC_ALPHA,
ONE_MINUS_SRC_ALPHA,
DST_ALPHA,
ONE_MINUS_DST_ALPHA,
SRC_ALPHA_SATURATE,
};
enum CompositeOperation
enum ffw::GLCanvas::CompositeOperation {
SOURCE_OVER,
SOURCE_IN,
SOURCE_OUT,
ATOP,
DESTINATION_OVER,
DESTINATION_IN,
DESTINATION_OUT,
DESTINATION_ATOP,
LIGHTER,
COPY,
XOR,
};
Public Attributes Documentation
variable Font (2/2)
friend ffw::GLCanvas::Font;
variable Image
friend ffw::GLCanvas::Image;
Public Functions Documentation
function GLCanvas (1/4)
ffw::GLCanvas::GLCanvas ()
function GLCanvas (2/4)
ffw::GLCanvas::GLCanvas (
const Settings & settings
)
function GLCanvas (3/4)
ffw::GLCanvas::GLCanvas (
const GLCanvas & other
) = delete
function GLCanvas (4/4)
ffw::GLCanvas::GLCanvas (
GLCanvas && other
)
function operator= (1/2)
GLCanvas & ffw::GLCanvas::operator= (
const GLCanvas & other
) = delete
function operator= (2/2)
GLCanvas & ffw::GLCanvas::operator= (
GLCanvas && other
)
function swap
void ffw::GLCanvas::swap (
GLCanvas & other
)
function ~GLCanvas
virtual ffw::GLCanvas::~GLCanvas ()
function destroy
void ffw::GLCanvas::destroy ()
function beginFrame
void ffw::GLCanvas::beginFrame (
const Vec2f & size
) const
Begin drawing a new frame.
Calls to nanovg drawing API should be wrapped in beginFrame() & endFrame() beginFrame() defines the size of the window to render to in relation currently set viewport (i.e. glViewport on GL backends).
function endFrame
void ffw::GLCanvas::endFrame () const
Ends drawing flushing remaining render state.
function cancelFrame
void ffw::GLCanvas::cancelFrame () const
Cancels drawing the current frame.
function globalCompositeOperation
void ffw::GLCanvas::globalCompositeOperation (
CompositeOperation op
) const
Sets the composite operation.
function globalCompositeBlendFunc
void ffw::GLCanvas::globalCompositeBlendFunc (
BlendFactor sfactor,
BlendFactor dfactor
) const
Sets the composite operation with custom pixel arithmetic.
function globalCompositeBlendFuncSeparate
void ffw::GLCanvas::globalCompositeBlendFuncSeparate (
BlendFactor srcRGB,
BlendFactor dstRGB,
BlendFactor srcAlpha,
BlendFactor dstAlpha
) const
Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately.
function save
void ffw::GLCanvas::save () const
Pushes and saves the current render state into a state stack.
Note:
A matching nvgRestore() must be used to restore the state.
function restore
void ffw::GLCanvas::restore () const
Pops and restores current render state.
function reset
void ffw::GLCanvas::reset () const
Resets current render state to default values.
Note:
Does not affect the render state stack.
function shapeAntiAlias
void ffw::GLCanvas::shapeAntiAlias (
bool enabled
) const
Sets whether to draw antialias for stroke() and fill().
It's enabled by default.
function strokeColor
void ffw::GLCanvas::strokeColor (
const Color & color
) const
Sets current stroke style to a solid color.
function strokePaint
void ffw::GLCanvas::strokePaint (
const Paint & paint
) const
Sets current stroke style to a paint, which can be a one of the gradients or a pattern.
function fillColor
void ffw::GLCanvas::fillColor (
const Color & color
) const
Sets current fill style to a solid color.
function fillPaint
void ffw::GLCanvas::fillPaint (
const Paint & paint
) const
Sets current fill style to a paint, which can be a one of the gradients or a pattern.
function miterLimit
void ffw::GLCanvas::miterLimit (
float limit
) const
Sets the miter limit of the stroke style.
Miter limit controls when a sharp corner is beveled
function strokeWidth
void ffw::GLCanvas::strokeWidth (
float size
) const
Sets the stroke width of the stroke style.
function lineCap
void ffw::GLCanvas::lineCap (
LineCap cap
) const
Sets how the end of the line (cap) is drawn.
function lineJoin
void ffw::GLCanvas::lineJoin (
LineJoin join
) const
Sets how sharp path corners are drawn.
function globalAlpha
void ffw::GLCanvas::globalAlpha (
float alpha
) const
Sets the transparency applied to all rendered shapes.
Already transparent paths will get proportionally more transparent as well
function resetTransform
void ffw::GLCanvas::resetTransform () const
Resets current transform to a identity matrix.
function transform
void ffw::GLCanvas::transform (
const Mat3x3f & mat
) const
Premultiplies current coordinate system by specified matrix.
function translate
void ffw::GLCanvas::translate (
const Vec2f & pos
) const
Translates current coordinate system.
function rotate
void ffw::GLCanvas::rotate (
float angle
) const
Rotates current coordinate system in degrees.
function rotateRad
void ffw::GLCanvas::rotateRad (
float angle
) const
Rotates current coordinate system in radians.
function skewX
void ffw::GLCanvas::skewX (
float angle
) const
Skews the current coordinate system along X axis in degrees.
function skewXRad
void ffw::GLCanvas::skewXRad (
float angle
) const
Skews the current coordinate system along X axis in radians.
function skewY
void ffw::GLCanvas::skewY (
float angle
) const
Skews the current coordinate system along Y axis in degrees.
function skewYRad
void ffw::GLCanvas::skewYRad (
float angle
) const
Skews the current coordinate system along Y axis in radians.
function scale
void ffw::GLCanvas::scale (
float x,
float y
) const
Scales the current coordinate system.
function getCurrentTransform
Mat3x3f ffw::GLCanvas::getCurrentTransform () const
Returns the current transformation matrix.
function setTransform
void ffw::GLCanvas::setTransform (
const Mat3x3f & mat
) const
Sets the current transformation matrix.
function createImage
Image ffw::GLCanvas::createImage (
const GLTexture2D & texture,
ImageFlags::Flag imageFlags = 0
) const
Creates image from raw RGBA pixels.
function linearGradient
Paint ffw::GLCanvas::linearGradient (
const ffw::Vec2f & start,
const ffw::Vec2f & end,
const Color & icol,
const Color & ocol
) const
Creates and returns a linear gradient.
Parameters (start)-(end) specify the start and end coordinates of the linear gradient, icol specifies the start color and ocol the end color. The gradient is transformed by the current transform when it is passed to fillPaint() or strokePaint().
function boxGradient
Paint ffw::GLCanvas::boxGradient (
const ffw::Vec2f & pos,
const ffw::Vec2f & size,
float r,
float f,
const Color & icol,
const Color & ocol
) const
Creates and returns a box gradient.
Box gradient is a feathered rounded rectangle, it is useful for rendering drop shadows or highlights for boxes. Parameters (pos) define the top-left corner of the rectangle, (size) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient. The gradient is transformed by the current transform when it is passed to fillPaint() or strokePaint().
function radialGradient
Paint ffw::GLCanvas::radialGradient (
const ffw::Vec2f & center,
float inr,
float outr,
const Color & icol,
const Color & ocol
) const
Creates and returns a radial gradient.
Parameters (center) specify the center, inr and outr specify the inner and outer radius of the gradient, icol specifies the start color and ocol the end color. The gradient is transformed by the current transform when it is passed to fillPaint() or strokePaint().
function imagePattern
Paint ffw::GLCanvas::imagePattern (
const Vec2f & start,
const Vec2f & end,
float angle,
const Image & image,
float alpha
) const
Creates and returns an image patter.
Parameters (start) specify the left-top location of the image pattern, (end) the size of one image, angle (degrees) rotation around the top-left corner, image is handle to the image to render. The gradient is transformed by the current transform when it is passed to fillPaint() or strokePaint().
function scissor
void ffw::GLCanvas::scissor (
const Vec2f & pos,
const Vec2f & size
) const
Sets the current scissor rectangle.
The scissor rectangle is transformed by the current transform.
function intersectScissor
void ffw::GLCanvas::intersectScissor (
const Vec2f & pos,
const Vec2f & size
) const
Intersects current scissor rectangle with the specified rectangle.
The scissor rectangle is transformed by the current transform.
Note:
In case the rotation of previous scissor rect differs from the current one, the intersection will be done between the specified rectangle and the previous scissor rectangle transformed in the current transform space. The resulting shape is always rectangle.
function resetScissor
void ffw::GLCanvas::resetScissor () const
Reset and disables scissoring.
function beginPath
void ffw::GLCanvas::beginPath () const
Clears the current path and sub-paths.
function moveTo
void ffw::GLCanvas::moveTo (
const Vec2f & pos
) const
Starts new sub-path with specified point as first point.
function lineTo
void ffw::GLCanvas::lineTo (
const Vec2f & pos
) const
Adds line segment from the last point in the path to the specified point.
function bezierTo
void ffw::GLCanvas::bezierTo (
const Vec2f & c1,
const Vec2f & c2,
const Vec2f & pos
) const
Adds cubic bezier segment from last point in the path via two control points to the specified point.
function quadTo
void ffw::GLCanvas::quadTo (
const Vec2f & c,
const Vec2f & pos
) const
Adds quadratic bezier segment from last point in the path via a control point to the specified point.
function arcTo
void ffw::GLCanvas::arcTo (
const Vec2f & x1,
const Vec2f & x2,
float angle
) const
Adds an arc segment at the corner defined by the last path point, and two specified points.
function arcToRad
void ffw::GLCanvas::arcToRad (
const Vec2f & x1,
const Vec2f & x2,
float angle
) const
Adds an arc segment at the corner defined by the last path point, and two specified points.
function closePath
void ffw::GLCanvas::closePath () const
Closes current sub-path with a line segment.
function pathWinding (1/2)
void ffw::GLCanvas::pathWinding (
Winding dir
) const
Sets the current sub-path winding.
function pathWinding (2/2)
void ffw::GLCanvas::pathWinding (
Solidity dir
) const
Sets the current sub-path winding.
function arc
void ffw::GLCanvas::arc (
const Vec2f & center,
float r,
float a0,
float a1,
Winding dir
) const
Creates new circle arc shaped sub-path.
The arc center is at cx,cy, the arc radius is r, and the arc is drawn from angle a0 to a1, and swept in direction dir (Winding::CCW, or Winding::CW). Angles are specified in degrees.
function arcRad
void ffw::GLCanvas::arcRad (
const Vec2f & center,
float r,
float a0,
float a1,
Winding dir
) const
Creates new circle arc shaped sub-path.
The arc center is at cx,cy, the arc radius is r, and the arc is drawn from angle a0 to a1, and swept in direction dir (Winding::CCW, or Winding::CW). Angles are specified in radians.
function rect
void ffw::GLCanvas::rect (
const Vec2f & pos,
const Vec2f & size
) const
Creates new rectangle shaped sub-path.
function roundedRect (1/2)
void ffw::GLCanvas::roundedRect (
const Vec2f & pos,
const Vec2f & size,
float r
) const
Creates new rounded rectangle shaped sub-path.
function roundedRect (2/2)
void ffw::GLCanvas::roundedRect (
const Vec2f & pos,
const Vec2f & size,
float radTopLeft,
float radTopRight,
float radBottomRight,
float radBottomLeft
) const
Creates new rounded rectangle shaped sub-path with varying radii for each corner.
function ellipse
void ffw::GLCanvas::ellipse (
const Vec2f & pos,
float rx,
float ry
) const
Creates new ellipse shaped sub-path.
function circle
void ffw::GLCanvas::circle (
const Vec2f & pos,
float r
) const
Creates new circle shaped sub-path.
function fill
void ffw::GLCanvas::fill () const
Fills the current path with current fill style.
function stroke
void ffw::GLCanvas::stroke () const
Fills the current path with current stroke style.
function createFont
Font ffw::GLCanvas::createFont (
const std::string & filename
) const
Creates font by loading it from the disk from specified file name.
function createFontMem
Font ffw::GLCanvas::createFontMem (
unsigned char * data,
size_t length
) const
Creates font by loading it from the specified memory chunk.
function addFallbackFontId
void ffw::GLCanvas::addFallbackFontId (
Font & baseFont,
Font & fallbackFont
) const
Adds a fallback font by handle.
function fontSize
void ffw::GLCanvas::fontSize (
float size
) const
Sets the font size of current text style.
function fontBlur
void ffw::GLCanvas::fontBlur (
float blur
) const
Sets the blur of current text style.
function textLetterSpacing
void ffw::GLCanvas::textLetterSpacing (
float spacing
) const
Sets the letter spacing of current text style.
function textLineHeight
void ffw::GLCanvas::textLineHeight (
float lineHeight
) const
Sets the proportional line height of current text style. The line height is specified as multiple of font size.
function textAlign
void ffw::GLCanvas::textAlign (
TextAlign::Flag align
) const
Sets the text align of current text style.
function fontFace
void ffw::GLCanvas::fontFace (
const Font & font
) const
Sets the font face based on specified id of current text style.
function text (1/2)
void ffw::GLCanvas::text (
const Vec2f & pos,
const char * string,
const char * end
) const
Draws text string at specified location.
If end is specified only the sub-string up to the end is drawn.
function text (2/2)
void ffw::GLCanvas::text (
const Vec2f & pos,
const std::string & str
) const
Draws text string at specified location.
If end is specified only the sub-string up to the end is drawn.
function textBox (1/2)
void ffw::GLCanvas::textBox (
const Vec2f & pos,
float breakRowWidth,
const char * string,
const char * end
) const
Draws multi-line text string at specified location wrapped at the specified width.
If end is specified only the sub-string up to the end is drawn. White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer than the max width are slit at nearest character (i.e. no hyphenation).
function textBox (2/2)
void ffw::GLCanvas::textBox (
const Vec2f & pos,
float breakRowWidth,
const std::string & str
) const
Draws multi-line text string at specified location wrapped at the specified width.
If end is specified only the sub-string up to the end is drawn. White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer than the max width are slit at nearest character (i.e. no hyphenation).
function textBounds (1/2)
float ffw::GLCanvas::textBounds (
const Vec2f & pos,
const char * string,
const char * end,
Vec4f & bounds
) const
Measures the specified text string.
Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Returns the horizontal advance of the measured text (i.e. where the next character should drawn). Measured values are returned in local coordinate space.
function textBounds (2/2)
float ffw::GLCanvas::textBounds (
const Vec2f & pos,
const std::string & str,
Vec4f & bounds
) const
Measures the specified text string.
Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Returns the horizontal advance of the measured text (i.e. where the next character should drawn). Measured values are returned in local coordinate space.
function textBoxBounds (1/2)
Vec4f ffw::GLCanvas::textBoxBounds (
const Vec2f & pos,
float breakRowWidth,
const char * string,
const char * end
) const
Measures the specified multi-text string.
Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Measured values are returned in local coordinate space.
function textBoxBounds (2/2)
Vec4f ffw::GLCanvas::textBoxBounds (
const Vec2f & pos,
float breakRowWidth,
const std::string & str
) const
Measures the specified multi-text string.
Parameter bounds should be a pointer to float[4], if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] Measured values are returned in local coordinate space.
function textMetrics
void ffw::GLCanvas::textMetrics (
float & ascender,
float & descender,
float & lineh
) const
Returns the vertical metrics based on the current text style.
Measured values are returned in local coordinate space.
function textBreakLines (1/2)
int ffw::GLCanvas::textBreakLines (
const char * string,
const char * end,
float width,
TextRow * rows,
size_t numrows
) const
Breaks the specified text into lines. If end is specified only the sub-string will be used.
White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer than the max width are slit at nearest character (i.e. no hyphenation).
function textBreakLines (2/2)
int ffw::GLCanvas::textBreakLines (
const std::string & string,
float width,
TextRow * rows,
size_t numrows
) const
Breaks the specified text into lines. If end is specified only the sub-string will be used.
White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. Words longer than the max width are slit at nearest character (i.e. no hyphenation).
function textGlyphPositions (1/2)
int ffw::GLCanvas::textGlyphPositions (
const Vec2f & pos,
const std::string & str,
GlyphPosition * positions,
size_t numpositions
) const
Calculates the glyph x positions of the specified text.
If end is specified only the sub-string will be used. Measured values are returned in local coordinate space.
function textGlyphPositions (2/2)
int ffw::GLCanvas::textGlyphPositions (
const Vec2f & pos,
const char * string,
const char * end,
GlyphPosition * positions,
size_t numpositions
) const
Calculates the glyph x positions of the specified text.
If end is specified only the sub-string will be used. Measured values are returned in local coordinate space.
The documentation for this class was generated from the following file: include/ffw/graphics/glcanvas.h