Draw Bezier

Bezier.png

A) As displayObject:

bool BezierDraw::Draw(Direct2DContext* ctx, D2D1::Matrix3x2F* mtx) {
    ctx->SetStrokeStyle(1, 0, 0);

    ctx->lineWidth = 2;

    ctx->beginPath();

    ctx->moveTo(0, 0);
    ctx->bezierCurveTo(30, 70, 100, 150, 50, 20);

    ctx->stroke();
return true; }
BezierDraw* bezierDraw = new BezierDraw();
_stage->addChild(bezierDraw);

B) As state object:

    Shape* bezierShape = new Shape();

    bezierShape->graphics.setStrokeStyle(1, 0, 0);

    bezierShape->graphics.setLineWidth(2);

    bezierShape->graphics.beginPath();

    bezierShape->graphics.moveTo(0, 0);
    bezierShape->graphics.bezierCurveTo(30, 70, 100, 150, 50, 20);

    bezierShape->graphics.stroke();
_stage->addChild(bezierShape);

Last edited Mar 27, 2013 at 8:49 PM by TypeOverride, version 4

Comments

No comments yet.