void PaintPlugin::paintTouch() { //TODO do not paint outside the drawing surface //create the paint color ANPPaint* strokePaint = gPaintI.newPaint(); gPaintI.setFlags(strokePaint, gPaintI.getFlags(strokePaint) | kAntiAlias_ANPPaintFlag); gPaintI.setColor(strokePaint, m_activePaintColor); gPaintI.setStyle(strokePaint, kStroke_ANPPaintStyle); gPaintI.setStrokeWidth(strokePaint, 6.0); gPaintI.setStrokeCap(strokePaint, kRound_ANPPaintCap); gPaintI.setStrokeJoin(strokePaint, kRound_ANPPaintJoin); // handle the complex "touch" paint (draw a line) ANPRectF bounds; gPathI.getBounds(m_touchPath, &bounds); // get a canvas that is only locked around the point and draw the path ANPCanvas* canvas = getCanvas(&bounds); gCanvasI.drawPath(canvas, m_touchPath, strokePaint); // clean up releaseCanvas(canvas); gPaintI.deletePaint(strokePaint); }
void PaintPlugin::paintMouse(int x, int y) { //TODO do not paint outside the drawing surface //create the paint color ANPPaint* fillPaint = gPaintI.newPaint(); gPaintI.setFlags(fillPaint, gPaintI.getFlags(fillPaint) | kAntiAlias_ANPPaintFlag); gPaintI.setStyle(fillPaint, kFill_ANPPaintStyle); gPaintI.setColor(fillPaint, m_activePaintColor); // handle the simple "mouse" paint (draw a point) ANPRectF point; point.left = (float) x-3; point.top = (float) y-3; point.right = (float) x+3; point.bottom = (float) y+3; // get a canvas that is only locked around the point and draw it ANPCanvas* canvas = getCanvas(&point); gCanvasI.drawOval(canvas, &point, fillPaint); // clean up releaseCanvas(canvas); gPaintI.deletePaint(fillPaint); }