void t2Image::drawInEllipse(int x, int y, int rx, int ry, int angle /*= 0*/, int alpha /*= 255*/, bool bFill /*= true*/) { NVGpaint imgPaint = nvgImagePattern(t2GetContext(), x, y, width, height, angle / 255.0f, img, alpha / 255.0f); nvgBeginPath(t2GetContext()); nvgEllipse(t2GetContext(), x, y, rx, ry); if(bFill) { nvgFillPaint(t2GetContext(), imgPaint); nvgFill(t2GetContext()); } else { nvgStrokePaint(t2GetContext(), imgPaint); nvgStroke(t2GetContext()); } }
void NanoVG::ellipse( float cx, float cy, float rx, float ry ) { nvgEllipse( m_context(), cx, cy, rx, ry ); }
void NVGRenderer::ellipse(float x, float y, float rx, float ry) { nvgEllipse(m_context, x, y, rx, ry); }
void drawEyes(struct NVGcontext* vg, float x, float y, float w, float h, float mx, float my, float t) { struct NVGpaint gloss, bg; float ex = w *0.23f; float ey = h * 0.5f; float lx = x + ex; float ly = y + ey; float rx = x + w - ex; float ry = y + ey; float dx,dy,d; float br = (ex < ey ? ex : ey) * 0.5f; float blink = 1 - powf(sinf(t*0.5f),200)*0.8f; bg = nvgLinearGradient(vg, x,y+h*0.5f,x+w*0.1f,y+h, nvgRGBA(0,0,0,32), nvgRGBA(0,0,0,16) ); nvgBeginPath(vg); nvgEllipse(vg, lx+3.0f,ly+16.0f, ex,ey); nvgEllipse(vg, rx+3.0f,ry+16.0f, ex,ey); nvgFillPaint(vg, bg); nvgFill(vg); bg = nvgLinearGradient(vg, x,y+h*0.25f,x+w*0.1f,y+h, nvgRGBA(220,220,220,255), nvgRGBA(128,128,128,255) ); nvgBeginPath(vg); nvgEllipse(vg, lx,ly, ex,ey); nvgEllipse(vg, rx,ry, ex,ey); nvgFillPaint(vg, bg); nvgFill(vg); dx = (mx - rx) / (ex * 10); dy = (my - ry) / (ey * 10); d = sqrtf(dx*dx+dy*dy); if (d > 1.0f) { dx /= d; dy /= d; } dx *= ex*0.4f; dy *= ey*0.5f; nvgBeginPath(vg); nvgEllipse(vg, lx+dx,ly+dy+ey*0.25f*(1-blink), br,br*blink); nvgFillColor(vg, nvgRGBA(32,32,32,255) ); nvgFill(vg); dx = (mx - rx) / (ex * 10); dy = (my - ry) / (ey * 10); d = sqrtf(dx*dx+dy*dy); if (d > 1.0f) { dx /= d; dy /= d; } dx *= ex*0.4f; dy *= ey*0.5f; nvgBeginPath(vg); nvgEllipse(vg, rx+dx,ry+dy+ey*0.25f*(1-blink), br,br*blink); nvgFillColor(vg, nvgRGBA(32,32,32,255) ); nvgFill(vg); gloss = nvgRadialGradient(vg, lx-ex*0.25f,ly-ey*0.5f, ex*0.1f,ex*0.75f, nvgRGBA(255,255,255,128), nvgRGBA(255,255,255,0) ); nvgBeginPath(vg); nvgEllipse(vg, lx,ly, ex,ey); nvgFillPaint(vg, gloss); nvgFill(vg); gloss = nvgRadialGradient(vg, rx-ex*0.25f,ry-ey*0.5f, ex*0.1f,ex*0.75f, nvgRGBA(255,255,255,128), nvgRGBA(255,255,255,0) ); nvgBeginPath(vg); nvgEllipse(vg, rx,ry, ex,ey); nvgFillPaint(vg, gloss); nvgFill(vg); }
void QNanoPainter::ellipse(float centerX, float centerY, float radiusX, float radiusY) { _checkAlignPixelsAdjust(¢erX, ¢erX); _checkAlignPixels(&radiusX, &radiusY); nvgEllipse(nvgCtx(), centerX, centerY, radiusX, radiusY); }
void Shape::render(NVGcontext& nanoVgContext) const { switch(mType) { case Type::ARC: { const ArcInfo& info = mArcInfo; const Point& position = info.position; nvgArc(&nanoVgContext, position.getX(), position.getY(), info.radius, info.startAngle, info.endAngle, info.clockWise ? NVG_CW : NVG_CCW); } break; case Type::TRIANGLE: { const TriangleInfo& info = mTriangleInfo; nvgMoveTo(&nanoVgContext, info.firstVertex.getX(), info.firstVertex.getY()); nvgLineTo(&nanoVgContext, info.secondVertex.getX(), info.secondVertex.getY()); nvgLineTo(&nanoVgContext, info.thirdVertex.getX(), info.thirdVertex.getY()); nvgClosePath(&nanoVgContext); } break; case Type::RECT: { const RectInfo& info = mRectInfo; const Rect& rect = info.rect; if(info.rounded) { nvgRoundedRect(&nanoVgContext, rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), info.cornerRadius); } else { nvgRect(&nanoVgContext, rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()); } } break; case Type::ELLIPSE: { const EllipseInfo& info = mEllipseInfo; const Point& position = info.position; nvgEllipse(&nanoVgContext, position.getX(), position.getY(), info.horizontalRadius, info.verticalRadius); } break; case Type::MOVE_TO: { const MoveToInfo& info = mMoveToInfo; const Point& position = info.position; nvgMoveTo(&nanoVgContext, position.getX(), position.getY()); } break; case Type::LINE_TO: { const LineToInfo& info = mLineToInfo; const Point& position = info.position; nvgLineTo(&nanoVgContext, position.getX(), position.getY()); } break; case Type::BEZIER_TO: { const BezierToInfo& info = mBezierToInfo; const Point& control1 = info.controlPosition1; const Point& control2 = info.controlPosition2; const Point& position = info.position; nvgBezierTo(&nanoVgContext, control1.getX(), control1.getY(), control2.getX(), control2.getY(), position.getX(), position.getY()); } break; case Type::QUAD_TO: { const QuadToInfo& info = mQuadToInfo; const Point& control = info.controlPosition; const Point& position = info.position; nvgQuadTo(&nanoVgContext, control.getX(), control.getY(), position.getX(), position.getY()); } break; case Type::CLOSE_PATH: { nvgClosePath(&nanoVgContext); } break; default: return; } }
JNIEXPORT void JNICALL Java_firststep_internal_NVG_ellipse (JNIEnv *e, jclass c, jlong ctx, jfloat cx, jfloat cy, jfloat rx, jfloat ry) { nvgEllipse((NVGcontext*)ctx, cx, cy, rx, ry); }
void VectorRenderer::ellipse(float x, float y, float width, float height) { nvgEllipse(nvg, x, y, width, height); }