17 #ifndef DGL_NANO_WIDGET_HPP_INCLUDED
18 #define DGL_NANO_WIDGET_HPP_INCLUDED
53 Handle(NVGcontext* c,
int id) noexcept
102 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoImage)
222 IMAGE_GENERATE_MIPMAPS = 1 << 0,
223 IMAGE_REPEAT_X = 1 << 1,
224 IMAGE_REPEAT_Y = 1 << 2,
225 IMAGE_FLIP_Y = 1 << 3,
226 IMAGE_PREMULTIPLIED = 1 << 4
232 ALIGN_CENTER = 1 << 1,
233 ALIGN_RIGHT = 1 << 2,
236 ALIGN_MIDDLE = 1 << 4,
237 ALIGN_BOTTOM = 1 << 5,
238 ALIGN_BASELINE = 1 << 6
273 Paint(
const NVGpaint&) noexcept;
274 operator NVGpaint()
const noexcept;
321 void beginFrame(
const uint width,
const uint height,
const float scaleFactor = 1.0f);
369 void strokeColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
375 void strokeColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
391 void fillColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
397 void fillColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
419 void lineCap(LineCap cap = BUTT);
425 void lineJoin(LineCap join = MITER);
448 void transform(
float a,
float b,
float c,
float d,
float e,
float f);
463 void skewX(
float angle);
468 void skewY(
float angle);
473 void scale(
float x,
float y);
536 static void transformPoint(
float& dstx,
float& dsty,
const float xform[6],
float srcx,
float srcy);
578 NanoImage::Handle
createImageFromRGBA(uint w, uint h,
const uchar* data, ImageFlags imageFlags);
616 Paint
boxGradient(
float x,
float y,
float w,
float h,
float r,
float f,
const Color& icol,
const Color& ocol);
630 Paint
imagePattern(
float ox,
float oy,
float ex,
float ey,
float angle,
const NanoImage& image,
float alpha);
639 void scissor(
float x,
float y,
float w,
float h);
667 void moveTo(
float x,
float y);
672 void lineTo(
float x,
float y);
677 void bezierTo(
float c1x,
float c1y,
float c2x,
float c2y,
float x,
float y);
682 void quadTo(
float cx,
float cy,
float x,
float y);
687 void arcTo(
float x1,
float y1,
float x2,
float y2,
float radius);
704 void arc(
float cx,
float cy,
float r,
float a0,
float a1, Winding dir);
709 void rect(
float x,
float y,
float w,
float h);
714 void roundedRect(
float x,
float y,
float w,
float h,
float r);
719 void ellipse(
float cx,
float cy,
float rx,
float ry);
724 void circle(
float cx,
float cy,
float r);
801 float text(
float x,
float y,
const char*
string,
const char* end);
809 void textBox(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end =
nullptr);
823 void textBoxBounds(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end,
float bounds[4]);
829 int textGlyphPositions(
float x,
float y,
const char*
string,
const char* end, GlyphPosition& positions,
int maxPositions);
835 void textMetrics(
float* ascender,
float* descender,
float* lineh);
842 int textBreakLines(
const char*
string,
const char* end,
float breakRowWidth, TextRow& rows,
int maxRows);
845 NVGcontext*
const fContext;
849 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoVG)
896 PrivateData*
const nData;
902 void onDisplay()
override;
905 void beginFrame(uint,uint) {}
906 void beginFrame(uint,uint,
float) {}
907 void beginFrame(
Widget*) {}
908 void cancelFrame() {}
911 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoWidget)
918 #endif // DGL_NANO_WIDGET_HPP_INCLUDED
static void transformPoint(float &dstx, float &dsty, const float xform[6], float srcx, float srcy)
NVGcontext * getContext() const noexcept
Definition: NanoVG.hpp:313
void textAlign(Align align)
Definition: NanoVG.hpp:283
void textBox(float x, float y, float breakRowWidth, const char *string, const char *end=nullptr)
Definition: NanoVG.hpp:42
void lineTo(float x, float y)
void globalAlpha(float alpha)
static void transformScale(float dst[6], float sx, float sy)
NanoImage::Handle createImageFromMemory(uchar *data, uint dataSize, ImageFlags imageFlags)
void currentTransform(float xform[6])
void circle(float cx, float cy, float r)
int textBreakLines(const char *string, const char *end, float breakRowWidth, TextRow &rows, int maxRows)
static void transformMultiply(float dst[6], const float src[6])
void fontSize(float size)
FontId createFontFromMemory(const char *name, const uchar *data, uint dataSize, bool freeData)
void intersectScissor(float x, float y, float w, float h)
void textBoxBounds(float x, float y, float breakRowWidth, const char *string, const char *end, float bounds[4])
int textGlyphPositions(float x, float y, const char *string, const char *end, GlyphPosition &positions, int maxPositions)
void miterLimit(float limit)
Definition: Window.hpp:30
void strokeWidth(float size)
Paint linearGradient(float sx, float sy, float ex, float ey, const Color &icol, const Color &ocol)
void translate(float x, float y)
static void transformPremultiply(float dst[6], const float src[6])
void arcTo(float x1, float y1, float x2, float y2, float radius)
void scale(float x, float y)
static void transformSkewX(float dst[6], float a)
void rect(float x, float y, float w, float h)
Paint radialGradient(float cx, float cy, float inr, float outr, const Color &icol, const Color &ocol)
Definition: NanoVG.hpp:213
void fontBlur(float blur)
void strokePaint(const Paint &paint)
NanoImage::Handle createImageFromFile(const char *filename, ImageFlags imageFlags)
void fontFaceId(FontId font)
void moveTo(float x, float y)
void transform(float a, float b, float c, float d, float e, float f)
void ellipse(float cx, float cy, float rx, float ry)
void bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y)
void fontFace(const char *font)
NanoVG(int flags=CREATE_ANTIALIAS)
Definition: Geometry.hpp:30
Definition: NanoVG.hpp:207
FontId findFont(const char *name)
void beginFrame(const uint width, const uint height, const float scaleFactor=1.0f)
Definition: NanoVG.hpp:259
void pathWinding(Winding dir)
Definition: NanoVG.hpp:200
void textLineHeight(float lineHeight)
static void transformIdentity(float dst[6])
Size< uint > getSize() const noexcept
float textBounds(float x, float y, const char *string, const char *end, Rectangle< float > &bounds)
static float radToDeg(float rad)
Definition: NanoVG.hpp:277
static void transformSkewY(float dst[6], float a)
static int transformInverse(float dst[6], const float src[6])
void roundedRect(float x, float y, float w, float h, float r)
NanoImage::Handle createImageFromRGBA(uint w, uint h, const uchar *data, ImageFlags imageFlags)
FontId createFontFromFile(const char *name, const char *filename)
static float degToRad(float deg)
static void transformTranslate(float dst[6], float tx, float ty)
Definition: NanoVG.hpp:218
void arc(float cx, float cy, float r, float a0, float a1, Winding dir)
void lineCap(LineCap cap=BUTT)
NanoImage & operator=(const Handle &handle)
float text(float x, float y, const char *string, const char *end)
void lineJoin(LineCap join=MITER)
GLuint getTextureHandle() const
void fillColor(const Color &color)
void scissor(float x, float y, float w, float h)
void strokeColor(const Color &color)
void textMetrics(float *ascender, float *descender, float *lineh)
void quadTo(float cx, float cy, float x, float y)
void fillPaint(const Paint &paint)
bool isValid() const noexcept
static void transformRotate(float dst[6], float a)
CreateFlags
Definition: NanoVG.hpp:203
Paint boxGradient(float x, float y, float w, float h, float r, float f, const Color &icol, const Color &ocol)
NanoImage::Handle createImageFromTextureHandle(GLuint textureId, uint w, uint h, ImageFlags imageFlags, bool deleteTexture=false)
void textLetterSpacing(float spacing)
Paint imagePattern(float ox, float oy, float ex, float ey, float angle, const NanoImage &image, float alpha)