I have a background bitmap if you will and I'm drawing another bitmap with font into the background bitmap. When just drawn on top of each other and zoomed in the level I'm needing they appear perfectly without artifacting and exactly how I want it. But for my purpose I'm needing to merge the font bitmap into the background bitmap so it essentially becomes one item. I obviously need it to be done at run-time and the solution I'm using is this....
canvas2 = new Canvas(backgroundBitmap);
canvas2.drawBitmap(fontBitmap.getBitmap(), null, rects.get(backgroundRectIndex), null);
invalidate();
Now when I zoom into the level I'm needing the font has artifacting. I'm fairly new to graphics and have read several articles and questions about similar issues and I've tried playing with the dithering in the paint and using it in canvas2.drawBitmap instead of null, but nothing seems to be helping. I came across this...
This does not apply for the case that an application creates an in-memory bitmap internally and draws something on it, for later display on the screen. The platform auto-scales such bitmaps on the fly, at draw time. Other side effects of such a case might be that font开发者_如何学JAVAs drawn in such a bitmap will be scaled at the bitmap level, when the off-screen bitmap is finally rendered to the display, resulting in scaling artifacts.
link text
Which sounds like it might be my issue, but how do I resolve that? Any help would be much appreciated.
If you're scaling the bitmap, make sure to set the filterBitmap flag off.
On the paint it should be:
paint.setFilterBitmap(false);
精彩评论