19#ifdef IGRAPHICS_NANOVG
24BEGIN_IGRAPHICS_NAMESPACE
38#ifdef IGRAPHICS_NANOVG
46 float r0, r1, ax,ay, bx,by, cx,cy, aeps, r;
59 r1 = (w < h ? w : h) * 0.5f - 5.0f;
63 for (i = 0; i < 6; i++) {
64 float a0 = (float)i / 6.0f * NVG_PI * 2.0f - aeps;
65 float a1 = (float)(i+1.0f) / 6.0f * NVG_PI * 2.0f + aeps;
67 nvgArc(vg, cx,cy, r0, a0, a1, NVG_CW);
68 nvgArc(vg, cx,cy, r1, a1, a0, NVG_CCW);
70 ax = cx + cosf(a0) * (r0+r1)*0.5f;
71 ay = cy + sinf(a0) * (r0+r1)*0.5f;
72 bx = cx + cosf(a1) * (r0+r1)*0.5f;
73 by = cy + sinf(a1) * (r0+r1)*0.5f;
74 paint = nvgLinearGradient(vg, ax,ay, bx,by, nvgHSLA(a0/(NVG_PI*2),1.0f,0.55f,255), nvgHSLA(a1/(NVG_PI*2),1.0f,0.55f,255));
75 nvgFillPaint(vg, paint);
80 nvgCircle(vg, cx,cy, r0-0.5f);
81 nvgCircle(vg, cx,cy, r1+0.5f);
82 nvgStrokeColor(vg, nvgRGBA(0,0,0,64));
83 nvgStrokeWidth(vg, 1.0f);
88 nvgTranslate(vg, cx,cy);
89 nvgRotate(vg, hue*NVG_PI*2);
92 nvgStrokeWidth(vg, 2.0f);
94 nvgRect(vg, r0-1,-3,r1-r0+2,6);
95 nvgStrokeColor(vg, nvgRGBA(255,255,255,192));
98 paint = nvgBoxGradient(vg, r0-3,-5,r1-r0+6,10, 2,4, nvgRGBA(0,0,0,128), nvgRGBA(0,0,0,0));
100 nvgRect(vg, r0-2-10,-4-10,r1-r0+4+20,8+20);
101 nvgRect(vg, r0-2,-4,r1-r0+4,8);
102 nvgPathWinding(vg, NVG_HOLE);
103 nvgFillPaint(vg, paint);
108 ax = cosf(120.0f/180.0f*NVG_PI) * r;
109 ay = sinf(120.0f/180.0f*NVG_PI) * r;
110 bx = cosf(-120.0f/180.0f*NVG_PI) * r;
111 by = sinf(-120.0f/180.0f*NVG_PI) * r;
114 nvgLineTo(vg, ax,ay);
115 nvgLineTo(vg, bx,by);
117 paint = nvgLinearGradient(vg, r,0, ax,ay, nvgHSLA(hue,1.0f,0.5f,255), nvgRGBA(255,255,255,255));
118 nvgFillPaint(vg, paint);
120 paint = nvgLinearGradient(vg, (r+ax)*0.5f,(0+ay)*0.5f, bx,by, nvgRGBA(0,0,0,0), nvgRGBA(0,0,0,255));
121 nvgFillPaint(vg, paint);
123 nvgStrokeColor(vg, nvgRGBA(0,0,0,64));
127 ax = cosf(120.0f/180.0f*NVG_PI) * r*0.3f;
128 ay = sinf(120.0f/180.0f*NVG_PI) * r*0.4f;
129 nvgStrokeWidth(vg, 2.0f);
131 nvgCircle(vg, ax,ay,5);
132 nvgStrokeColor(vg, nvgRGBA(255,255,255,192));
135 paint = nvgRadialGradient(vg, ax,ay, 7,9, nvgRGBA(0,0,0,64), nvgRGBA(0,0,0,0));
137 nvgRect(vg, ax-20,ay-20,40,40);
138 nvgCircle(vg, ax,ay,7);
139 nvgPathWinding(vg, NVG_HOLE);
140 nvgFillPaint(vg, paint);
155END_IGRAPHICS_NAMESPACE
This file contains the base IControl implementation, along with some base classes for specific types ...
A control for choosing a color.
void OnMouseDown(float x, float y, const IMouseMod &mod) override
Implement this method to respond to a mouse down event on this control.
void Draw(IGraphics &g) override
Draw the control to the graphics context.
The lowest level base class of an IGraphics control.
The lowest level base class of an IGraphics context.
virtual void * GetDrawContext()=0
Gets a void pointer to underlying drawing context, for the IGraphics backend See draw class implement...
Used to manage mouse modifiers i.e.
Used to manage a rectangular area, independent of draw class/platform.