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"
27 # pragma warning(push)
28 # pragma warning(disable:4661)
31 #ifndef DGL_NO_SHARED_RESOURCES
32 # define NANOVG_DEJAVU_SANS_TTF "__dpf_dejavusans_ttf__"
65 Handle(NVGcontext* c,
int id) noexcept
114 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoImage)
234 IMAGE_GENERATE_MIPMAPS = 1 << 0,
235 IMAGE_REPEAT_X = 1 << 1,
236 IMAGE_REPEAT_Y = 1 << 2,
237 IMAGE_FLIP_Y = 1 << 3,
238 IMAGE_PREMULTIPLIED = 1 << 4
244 ALIGN_CENTER = 1 << 1,
245 ALIGN_RIGHT = 1 << 2,
248 ALIGN_MIDDLE = 1 << 4,
249 ALIGN_BOTTOM = 1 << 5,
250 ALIGN_BASELINE = 1 << 6
285 Paint(
const NVGpaint&) noexcept;
286 operator NVGpaint()
const noexcept;
335 void beginFrame(
const uint width,
const uint height,
const float scaleFactor = 1.0f);
383 void strokeColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
389 void strokeColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
405 void fillColor(
const int red,
const int green,
const int blue,
const int alpha = 255);
411 void fillColor(
const float red,
const float green,
const float blue,
const float alpha = 1.0f);
433 void lineCap(LineCap cap = BUTT);
439 void lineJoin(LineCap join = MITER);
467 void transform(
float a,
float b,
float c,
float d,
float e,
float f);
482 void skewX(
float angle);
487 void skewY(
float angle);
492 void scale(
float x,
float y);
555 static void transformPoint(
float& dstx,
float& dsty,
const float xform[6],
float srcx,
float srcy);
598 ImageFlags imageFlags, ImageFormat format);
606 int imageFlags, ImageFormat format);
611 NanoImage::Handle
createImageFromRGBA(uint w, uint h,
const uchar* data, ImageFlags imageFlags);
649 Paint
boxGradient(
float x,
float y,
float w,
float h,
float r,
float f,
const Color& icol,
const Color& ocol);
663 Paint
imagePattern(
float ox,
float oy,
float ex,
float ey,
float angle,
const NanoImage& image,
float alpha);
672 void scissor(
float x,
float y,
float w,
float h);
700 void moveTo(
float x,
float y);
705 void lineTo(
float x,
float y);
710 void bezierTo(
float c1x,
float c1y,
float c2x,
float c2y,
float x,
float y);
715 void quadTo(
float cx,
float cy,
float x,
float y);
720 void arcTo(
float x1,
float y1,
float x2,
float y2,
float radius);
737 void arc(
float cx,
float cy,
float r,
float a0,
float a1, Winding dir);
742 void rect(
float x,
float y,
float w,
float h);
747 void roundedRect(
float x,
float y,
float w,
float h,
float r);
752 void ellipse(
float cx,
float cy,
float rx,
float ry);
757 void circle(
float cx,
float cy,
float r);
834 float text(
float x,
float y,
const char*
string,
const char* end);
842 void textBox(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end =
nullptr);
856 void textBoxBounds(
float x,
float y,
float breakRowWidth,
const char*
string,
const char* end,
float bounds[4]);
862 int textGlyphPositions(
float x,
float y,
const char*
string,
const char* end, GlyphPosition& positions,
int maxPositions);
868 void textMetrics(
float* ascender,
float* descender,
float* lineh);
875 int textBreakLines(
const char*
string,
const char* end,
float breakRowWidth, TextRow& rows,
int maxRows);
877 #ifndef DGL_NO_SHARED_RESOURCES
885 NVGcontext*
const fContext;
889 DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(
NanoVG)
902 template <
class BaseW
idget>
948 inline void onDisplay()
override
957 void beginFrame(uint,uint) {}
958 void beginFrame(uint,uint,
float) {}
959 void beginFrame(
Widget*) {}
960 void cancelFrame() {}
970 DISTRHO_DEPRECATED_BY(
"NanoSubWidget")
978 # pragma warning(pop)
981 #endif // DGL_NANO_WIDGET_HPP_INCLUDED
@ CREATE_ANTIALIAS
Definition: NanoVG.hpp:219
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])
NanoImage::Handle createImageFromRawMemory(uint w, uint h, const uchar *data, ImageFlags imageFlags, ImageFormat format)
@ CREATE_STENCIL_STROKES
Definition: NanoVG.hpp:225
int textGlyphPositions(float x, float y, const char *string, const char *end, GlyphPosition &positions, int maxPositions)
void globalTint(Color tint)
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:295
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:36
void fontSize(float size)
void strokeColor(const Color &color)
virtual bool loadSharedResources()
Definition: NanoVG.hpp:54
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:215
void pathWinding(Winding dir)
void transform(float a, float b, float c, float d, float e, float f)
Definition: NanoVG.hpp:289
void fillPaint(const Paint &paint)
NVGcontext * getContext() const noexcept
Definition: NanoVG.hpp:327
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:271
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:230
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:212
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)