:) On Tuesday, January 29, 2013 2:18:12 PM UTC+2, cosminr wrote: > > Thank you all for your replies. > > It seems the following declaration in the manifest solves the problem: > > <supports-screens android:anyDensity="false"/> > > On Monday, January 28, 2013 5:59:29 PM UTC+2, Piren wrote: >> >> you can also set the density on the canvas >> >> see this: >> >> http://stackoverflow.com/questions/5014882/drawing-a-bitmap-on-a-canvas-got-scaled >> >> On Monday, January 28, 2013 5:18:21 PM UTC+2, cosminr wrote: >>> >>> Unfortunately, the createBitmap() method which accepts DisplayMetrics >>> was added in API level 17 and I need to support a much lower API level. I >>> tried to set the density by passing the DisplayMetrics.densityDpi to >>> Bitmap.setDensity(int) and the problem still persists. >>> >>> On Monday, January 28, 2013 4:38:16 PM UTC+2, Piren wrote: >>>> >>>> I think its actually the Bitmap's fault... Bitmap.CreateBitmap can also >>>> get DisplayMatrics as a variable, try that with your device's >>>> DisplayMatrics (I'm guessing it's High, while the default is something >>>> lower, thus causing the fuzziness) >>>> >>>> On Monday, January 28, 2013 12:48:21 PM UTC+2, cosminr wrote: >>>>> >>>>> Hi, I am writing a custom view and for optimization purposes, I draw >>>>> some static part of the view in a Bitmap. Unfortunately, the quality of >>>>> the >>>>> rendering when using an offscreen bitmap is noticeably less compared to >>>>> rendering into the view's canvas bitmap. Here are two screenshots showing >>>>> the difference >>>>> >>>>> Rendering into view's Canvas: >>>>> >>>>> >>>>> <https://lh5.googleusercontent.com/-wSjtLmhUgz8/UQZV96LTo6I/AAAAAAAAAEM/r9saff_8dlM/s1600/01_view_canvas.png> >>>>> Rendering into a Bitmap Canvas >>>>> >>>>> >>>>> <https://lh3.googleusercontent.com/-jVuFcXhAf7g/UQZWK7NBNfI/AAAAAAAAAEU/0AfCGfQMudU/s1600/02_bitmap_canvas.png> >>>>> The difference is most noticeable at the horizontal black line. >>>>> The anti-aliasing algorithm seems to affect more pixels (is wider). >>>>> >>>>> The drawing code is the same in both cases, and the offscreen canvas >>>>> is created like this >>>>> >>>>> final Bitmap tempBitmap = Bitmap.createBitmap(getWidth(), >>>>> getHeight(), Bitmap.Config.ARGB_8888); >>>>> final Canvas tempCanvas = new Canvas(tempBitmap); >>>>> >>>>> Any ideas on how to get the same rendering in the offscreen canvas as >>>>> in the view's ? >>>>> >>>>> Thank you >>>>> >>>>
-- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

