protected override void onDraw (Canvas canvas) { canvas.drawColor (unchecked((int)0xFFCCCCCC)); canvas.concat (mMatrix); canvas.drawBitmapMesh (mBitmap, WIDTH, HEIGHT, mVerts, 0, null, 0, null); }
void drawFit (Canvas canvas, int index, Matrix.ScaleToFit stf) { canvas.save (); setSrcR (index); mMatrix.setRectToRect (mSrcR, mDstR, stf); canvas.concat (mMatrix); drawSrcR (canvas, index); canvas.restore (); canvas.drawRect (mDstR, mHairPaint); }
protected override void onDraw (Canvas canvas) { canvas.drawColor (unchecked((int)0xFFCCCCCC)); canvas.save (); canvas.concat (mMatrix); canvas.drawVertices (Canvas.VertexMode.TRIANGLE_FAN, 10, mVerts, 0, mTexs, 0, null, 0, null, 0, 0, mPaint); canvas.translate (0, 240); canvas.drawVertices (Canvas.VertexMode.TRIANGLE_FAN, 10, mVerts, 0, mTexs, 0, null, 0, mIndices, 0, 6, mPaint); canvas.restore (); }
void doDraw (Canvas canvas, float[] src, float[] dst) { canvas.save (); mMatrix.setPolyToPoly (src, 0, dst, 0, src.Length >> 1); canvas.concat (mMatrix); mPaint.setColor (Color.GRAY); mPaint.setStyle (Paint.Style.STROKE); canvas.drawRect (0, 0, 64, 64, mPaint); canvas.drawLine (0, 0, 64, 64, mPaint); canvas.drawLine (0, 64, 64, 0, mPaint); mPaint.setColor (Color.RED); mPaint.setStyle (Paint.Style.FILL); // how to draw the text center on our square // centering in X is easy... use alignment (and X at midpoint) float x = 64 / 2; // centering in Y, we need to measure ascent/descent first float y = 64 / 2 - (mFontMetrics.ascent + mFontMetrics.descent) / 2; canvas.drawText (src.Length / 2 + "", x, y, mPaint); canvas.restore (); }