How can I scale a Bitmap in Android while maintaining the proportions? -


i want draw human body using bitmap each body part (because apply different color filters , effects each part).

so drew body in photoshop, divided parts , saved each 1 separate file background transparent , of them same dimensions. therefore if draw 1 one in view on each other final result should be whole body before cutting parts out.

but not know how manage possible scaling of view layout make maintaining relative position of each body part , achieve perfect representation of human body.

if want scale bitmap can use function:

        bitmap scaledbmp = bitmap.createscaledbitmap(originalbmp, int finalwidth, int finalheight, false); 

this function scale "originalbmp" finalwidth , finalheight. if want keep propotions replace finalwidth "originalbmp.getwidth()*0.8", make bitmap 20% smaller (also height).


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -