17 #ifndef DGL_NANO_WIDGET_HPP_INCLUDED
18 #define DGL_NANO_WIDGET_HPP_INCLUDED
22 #include "SubWidget.hpp"
23 #include "TopLevelWidget.hpp"
24 #include "StandaloneWindow.hpp"
26 #ifndef DGL_NO_SHARED_RESOURCES
27 # define NANOVG_DEJAVU_SANS_TTF "__dpf_dejavusans_ttf__"
61 Handle(NVGcontext* c,
int id) noexcept
110 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoImage)
230 IMAGE_GENERATE_MIPMAPS = 1 << 0,
231 IMAGE_REPEAT_X = 1 << 1,
232 IMAGE_REPEAT_Y = 1 << 2,
233 IMAGE_FLIP_Y = 1 << 3,
234 IMAGE_PREMULTIPLIED = 1 << 4
240 ALIGN_CENTER = 1 << 1,
241 ALIGN_RIGHT = 1 << 2,
244 ALIGN_MIDDLE = 1 << 4,
245 ALIGN_BOTTOM = 1 << 5,
246 ALIGN_BASELINE = 1 << 6
281 Paint(
const NVGpaint&) noexcept;
282 operator NVGpaint()
const noexcept;
331 void beginFrame(
const uint width,
const uint height,
const float scaleFactor = 1.0f);
379 void strokeColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
385 void strokeColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
401 void fillColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
407 void fillColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
429 void lineCap(LineCap cap = BUTT);
435 void lineJoin(LineCap join = MITER);
458 void transform(
float a,
float b,
float c,
float d,
float e,
float f);
473 void skewX(
float angle);
478 void skewY(
float angle);
483 void scale(
float x,
float y);
546 static void transformPoint(
float& dstx,
float& dsty,
const float xform[6],
float srcx,
float srcy);
588 NanoImage::Handle
createImageFromRGBA(uint w, uint h,
const uchar* data, ImageFlags imageFlags);
626 Paint
boxGradient(
float x,
float y,
float w,
float h,
float r,
float f,
const Color& icol,
const Color& ocol);
640 Paint
imagePattern(
float ox,
float oy,
float ex,
float ey,
float angle,
const NanoImage& image,
float alpha);
649 void scissor(
float x,
float y,
float w,
float h);
677 void moveTo(
float x,
float y);
682 void lineTo(
float x,
float y);
687 void bezierTo(
float c1x,
float c1y,
float c2x,
float c2y,
float x,
float y);
692 void quadTo(
float cx,
float cy,
float x,
float y);
697 void arcTo(
float x1,
float y1,
float x2,
float y2,
float radius);
714 void arc(
float cx,
float cy,
float r,
float a0,
float a1, Winding dir);
719 void rect(
float x,
float y,
float w,
float h);
724 void roundedRect(
float x,
float y,
float w,
float h,
float r);
729 void ellipse(
float cx,
float cy,
float rx,
float ry);
734 void circle(
float cx,
float cy,
float r);
811 float text(
float x,
float y,
const char*
string,
const char* end);
819 void textBox(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end =
nullptr);
833 void textBoxBounds(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end,
float bounds[4]);
839 int textGlyphPositions(
float x,
float y,
const char*
string,
const char* end, GlyphPosition& positions,
int maxPositions);
845 void textMetrics(
float* ascender,
float* descender,
float* lineh);
852 int textBreakLines(
const char*
string,
const char* end,
float breakRowWidth, TextRow& rows,
int maxRows);
854 #ifndef DGL_NO_SHARED_RESOURCES
862 NVGcontext*
const fContext;
865 friend class BlendishWidget;
867 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoVG)
880 template <
class BaseW
idget>
926 inline void onDisplay()
override
934 void beginFrame(uint,uint) {}
935 void beginFrame(uint,uint,
float) {}
936 void beginFrame(
Widget*) {}
937 void cancelFrame() {}
947 DISTRHO_DEPRECATED_BY(
"NanoSubWidget")
954 #endif // DGL_NANO_WIDGET_HPP_INCLUDED
@ CREATE_ANTIALIAS
Definition: NanoVG.hpp:215
Paint boxGradient(float x, float y, float w, float h, float r, float f, const Color &icol, const Color &ocol)
GLuint getTextureHandle() const
static float radToDeg(float rad)
static void transformMultiply(float dst[6], const float src[6])
void currentTransform(float xform[6])
@ CREATE_STENCIL_STROKES
Definition: NanoVG.hpp:221
int textGlyphPositions(float x, float y, const char *string, const char *end, GlyphPosition &positions, int maxPositions)
static float degToRad(float deg)
void roundedRect(float x, float y, float w, float h, float r)
void textLineHeight(float lineHeight)
static void transformPremultiply(float dst[6], const float src[6])
static int transformInverse(float dst[6], const float src[6])
Definition: NanoVG.hpp:291
Definition: Window.hpp:50
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)
NanoImage::Handle createImageFromRGBA(uint w, uint h, const uchar *data, ImageFlags imageFlags)
void fillColor(const Color &color)
void scissor(float x, float y, float w, float h)
void fontFaceId(FontId font)
void lineCap(LineCap cap=BUTT)
Definition: Geometry.hpp:30
Definition: Application.hpp:34
void fontSize(float size)
void strokeColor(const Color &color)
virtual bool loadSharedResources()
Definition: NanoVG.hpp:50
void lineJoin(LineCap join=MITER)
void miterLimit(float limit)
void quadTo(float cx, float cy, float x, float y)
void translate(float x, float y)
void scale(float x, float y)
Paint linearGradient(float sx, float sy, float ex, float ey, const Color &icol, const Color &ocol)
static void transformSkewX(float dst[6], float a)
void fontBlur(float blur)
CreateFlags
Definition: NanoVG.hpp:211
void pathWinding(Winding dir)
void transform(float a, float b, float c, float d, float e, float f)
Definition: NanoVG.hpp:285
void fillPaint(const Paint &paint)
NVGcontext * getContext() const noexcept
Definition: NanoVG.hpp:323
static void transformRotate(float dst[6], float a)
void beginFrame(const uint width, const uint height, const float scaleFactor=1.0f)
void strokePaint(const Paint &paint)
NanoImage::Handle createImageFromFile(const char *filename, ImageFlags imageFlags)
Paint imagePattern(float ox, float oy, float ex, float ey, float angle, const NanoImage &image, float alpha)
Definition: NanoVG.hpp:267
float textBounds(float x, float y, const char *string, const char *end, Rectangle< float > &bounds)
void lineTo(float x, float y)
void globalAlpha(float alpha)
static void transformIdentity(float dst[6])
static void transformSkewY(float dst[6], float a)
NanoImage::Handle createImageFromTextureHandle(GLuint textureId, uint w, uint h, ImageFlags imageFlags, bool deleteTexture=false)
NanoImage::Handle createImageFromMemory(uchar *data, uint dataSize, ImageFlags imageFlags)
void textBox(float x, float y, float breakRowWidth, const char *string, const char *end=nullptr)
void fontFace(const char *font)
NanoImage & operator=(const Handle &handle)
static void transformPoint(float &dstx, float &dsty, const float xform[6], float srcx, float srcy)
FontId createFontFromFile(const char *name, const char *filename)
static void transformScale(float dst[6], float sx, float sy)
@ CREATE_DEBUG
Definition: NanoVG.hpp:226
int textBreakLines(const char *string, const char *end, float breakRowWidth, TextRow &rows, int maxRows)
void circle(float cx, float cy, float r)
void arc(float cx, float cy, float r, float a0, float a1, Winding dir)
FontId createFontFromMemory(const char *name, const uchar *data, uint dataSize, bool freeData)
void strokeWidth(float size)
void intersectScissor(float x, float y, float w, float h)
bool isValid() const noexcept
static void transformTranslate(float dst[6], float tx, float ty)
void textBoxBounds(float x, float y, float breakRowWidth, const char *string, const char *end, float bounds[4])
void moveTo(float x, float y)
void ellipse(float cx, float cy, float rx, float ry)
float text(float x, float y, const char *string, const char *end)
void arcTo(float x1, float y1, float x2, float y2, float radius)
Definition: NanoVG.hpp:208
void textLetterSpacing(float spacing)
NanoVG(int flags=CREATE_ANTIALIAS)
FontId findFont(const char *name)
void textMetrics(float *ascender, float *descender, float *lineh)
void textAlign(Align align)
Size< uint > getSize() const noexcept
void bezierTo(float c1x, float c1y, float c2x, float c2y, float x, float y)