#include <NanoVG.hpp>
Public Member Functions | |
NanoWidget (Window &parent) | |
![]() | |
Widget (Window &parent) | |
virtual | ~Widget () |
bool | isVisible () const noexcept |
void | setVisible (bool yesNo) |
void | show () |
void | hide () |
uint | getWidth () const noexcept |
uint | getHeight () const noexcept |
const Size< uint > & | getSize () const noexcept |
void | setWidth (uint width) noexcept |
void | setHeight (uint height) noexcept |
void | setSize (uint width, uint height) noexcept |
void | setSize (const Size< uint > &size) noexcept |
int | getAbsoluteX () const noexcept |
int | getAbsoluteY () const noexcept |
const Point< int > & | getAbsolutePos () const noexcept |
void | setAbsoluteX (int x) noexcept |
void | setAbsoluteY (int y) noexcept |
void | setAbsolutePos (int x, int y) noexcept |
void | setAbsolutePos (const Point< int > &pos) noexcept |
App & | getParentApp () const noexcept |
Window & | getParentWindow () const noexcept |
bool | contains (int x, int y) const noexcept |
bool | contains (const Point< int > &pos) const noexcept |
void | repaint () noexcept |
uint | getId () const noexcept |
void | setId (uint id) noexcept |
![]() | |
NanoVG () | |
NanoVG (const int textAtlasWidth, const int textAtlasHeight) | |
virtual | ~NanoVG () |
NVGcontext * | getContext () const noexcept |
void | beginFrame (const uint width, const uint height, const float scaleFactor=1.0f, const Alpha alpha=PREMULTIPLIED_ALPHA) |
void | beginFrame (Widget *const widget) |
void | endFrame () |
void | save () |
void | restore () |
void | reset () |
void | strokeColor (const Color &color) |
void | strokeColor (const int red, const int green, const int blue, const int alpha=255) |
void | strokeColor (const float red, const float green, const float blue, const float alpha=1.0f) |
void | strokePaint (const Paint &paint) |
void | fillColor (const Color &color) |
void | fillColor (const int red, const int green, const int blue, const int alpha=255) |
void | fillColor (const float red, const float green, const float blue, const float alpha=1.0f) |
void | fillPaint (const Paint &paint) |
void | miterLimit (float limit) |
void | strokeWidth (float size) |
void | lineCap (LineCap cap=BUTT) |
void | lineJoin (LineCap join=MITER) |
void | resetTransform () |
void | transform (float a, float b, float c, float d, float e, float f) |
void | translate (float x, float y) |
void | rotate (float angle) |
void | skewX (float angle) |
void | skewY (float angle) |
void | scale (float x, float y) |
void | currentTransform (float xform[6]) |
NanoImage * | createImage (const char *filename) |
NanoImage * | createImageMem (uchar *data, int ndata) |
NanoImage * | createImageRGBA (uint w, uint h, const uchar *data) |
Paint | linearGradient (float sx, float sy, float ex, float ey, const Color &icol, const Color &ocol) |
Paint | boxGradient (float x, float y, float w, float h, float r, float f, const Color &icol, const Color &ocol) |
Paint | radialGradient (float cx, float cy, float inr, float outr, const Color &icol, const Color &ocol) |
Paint | imagePattern (float ox, float oy, float ex, float ey, float angle, const NanoImage *image, PatternRepeat repeat) |
void | scissor (float x, float y, float w, float h) |
void | resetScissor () |
void | beginPath () |
void | moveTo (float x, float y) |
void | lineTo (float x, float y) |
void | bezierTo (float c1x, float c1y, float c2x, float c2y, float x, float y) |
void | arcTo (float x1, float y1, float x2, float y2, float radius) |
void | closePath () |
void | pathWinding (Winding dir) |
void | arc (float cx, float cy, float r, float a0, float a1, Winding dir) |
void | rect (float x, float y, float w, float h) |
void | roundedRect (float x, float y, float w, float h, float r) |
void | ellipse (float cx, float cy, float rx, float ry) |
void | circle (float cx, float cy, float r) |
void | fill () |
void | stroke () |
FontId | createFont (const char *name, const char *filename) |
FontId | createFontMem (const char *name, const uchar *data, int ndata, bool freeData) |
FontId | findFont (const char *name) |
void | fontSize (float size) |
void | fontBlur (float blur) |
void | textLetterSpacing (float spacing) |
void | textLineHeight (float lineHeight) |
void | textAlign (Align align) |
void | textAlign (int align) |
void | fontFaceId (FontId font) |
void | fontFace (const char *font) |
float | text (float x, float y, const char *string, const char *end) |
void | textBox (float x, float y, float breakRowWidth, const char *string, const char *end) |
float | textBounds (float x, float y, const char *string, const char *end, Rectangle< float > &bounds) |
void | textBoxBounds (float x, float y, float breakRowWidth, const char *string, const char *end, float *bounds) |
int | textGlyphPositions (float x, float y, const char *string, const char *end, GlyphPosition *positions, int maxPositions) |
void | textMetrics (float *ascender, float *descender, float *lineh) |
int | textBreakLines (const char *string, const char *end, float breakRowWidth, TextRow *rows, int maxRows) |
Protected Member Functions | |
virtual void | onNanoDisplay ()=0 |
![]() | |
virtual bool | onKeyboard (const KeyboardEvent &) |
virtual bool | onSpecial (const SpecialEvent &) |
virtual bool | onMouse (const MouseEvent &) |
virtual bool | onMotion (const MotionEvent &) |
virtual bool | onScroll (const ScrollEvent &) |
virtual void | onResize (const ResizeEvent &) |
void | setNeedsFullViewport (bool yesNo) noexcept |
void | setNeedsScaling (bool yesNo) noexcept |
Additional Inherited Members | |
![]() | |
enum | Align { ALIGN_LEFT = 1 << 0, ALIGN_CENTER = 1 << 1, ALIGN_RIGHT = 1 << 2, ALIGN_TOP = 1 << 3, ALIGN_MIDDLE = 1 << 4, ALIGN_BOTTOM = 1 << 5, ALIGN_BASELINE = 1 << 6 } |
enum | Alpha { STRAIGHT_ALPHA, PREMULTIPLIED_ALPHA } |
enum | LineCap { BUTT, ROUND, SQUARE, BEVEL, MITER } |
enum | PatternRepeat { REPEAT_NONE = 0x0, REPEAT_X = 0x1, REPEAT_Y = 0x2 } |
enum | Solidity { SOLID = 1, HOLE = 2 } |
enum | Winding { CCW = 1, CW = 2 } |
typedef int | FontId |
![]() | |
static void | transformIdentity (float dst[6]) |
static void | transformTranslate (float dst[6], float tx, float ty) |
static void | transformScale (float dst[6], float sx, float sy) |
static void | transformRotate (float dst[6], float a) |
static void | transformSkewX (float dst[6], float a) |
static void | transformSkewY (float dst[6], float a) |
static void | transformMultiply (float dst[6], const float src[6]) |
static void | transformPremultiply (float dst[6], const float src[6]) |
static int | transformInverse (float dst[6], const float src[6]) |
static void | transformPoint (float &dstx, float &dsty, const float xform[6], float srcx, float srcy) |
static float | degToRad (float deg) |
static float | radToDeg (float rad) |
This class implements the NanoVG drawing API inside a DGL Widget. The drawing function onDisplay() is implemented internally but a new onNanoDisplay() needs to be overridden instead.
|
inline |
Constructor.
|
protectedpure virtual |
New virtual onDisplay function.