I am drawing some text on a Canvas, and on a Bitmap, respectively:
protected void onDraw(Canvas canvas) {
canvas.drawText("Canvas text", 10, 10, mPaint);
Canvas singleUseCanvas = new Canvas();
singleUseCanvas.setBitmap(mBitmap);
singleUseCanvas.drawText("Bitmap text", 10, 30, mPaint);
}
In the former case, the text renders as you would expect, while in the latter, it appears very rough and ugly. This becomes even more problematic when using e.g.
canvas.drawBitmapMesh(...);
to apply transformations to the bitmap. Am I doing something wrong, or is the quality simply deteriorated when you pass from Canvas to Bitmap?
On a side note, the reason why I'm drawing text on a Bitmap is to obtain a "magnifier" effect on the text in question (like Apple OSX's dock), since I can then apply arbitrary transformations to it using a bitmap mesh. Is there another, perhaps better, way to do this?
Best,
Michael
Edit: Solved. For those interested, the problem seems to occur when using API versions < 4. When using API versions >= 4, everything works.
精彩评论