android - Bitmap is not being scaled correctly because of density -
i loading bitmap stored in drawable-hdpi folder (with other images).
options.inscaled = false; bitmap rawbmp = bitmapfactory.decoderesource(res, resid, options); bitmap finalbmp = bitmap.createscaledbitmap(rawbmp, reqwidth, reqheight, true); the original bitmap 512x512, thats size of rawbmp if set inscaled false. final bitmap works on device less 512 (my s2 480). on devices higher res final bmp size reported should be, visible part of image original size. createscaledbitmap creating big bitmap not scale original upwards.
if set inscaled true, receive rawbmp less original size final bitmap seems work can imagine quality suffers more doubles in size.
on galaxy 10 tablet :
inscaled true : 512 original, 341 rawbmp, final 800 (density 160) final image visible across entire screen (height)
inscaled false: 510 original, 512 rawbmp, final 800 (density 240) final image visible part still 512, rest filled transparent, there absolutely no scaling here.
i dont understand behaviour. if have bmp 512 pixels , want scale 800 pixels , draw pixels screen 1:1
edit
for arguments sake lets need bitmap scaled way, code bit more snippet
android bitmap
No comments:
Post a Comment