Since you mention magnification, and it looks like you are using the same mPaint object for both drawText calls, I guess you scale up the contents of "singleUseCanvas" to achive that. That's the reason for the roughness of text.

Make sure you render text into singleUseCanvas at magnified size, so no further scaling is necessary (when drawing mBitmap to the screen).

Also try setting mPaint.setAntiAlias(true)

-- Kostya

25.12.2010 15:37, MichaelF ?????:

Hi,

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

(Also posted here: http://stackoverflow.com/questions/4485587/drawing-text-on-a-bitmap-rather-than-canvas, but with no answer)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to