what canvas.drawBitmap unit(DIP, PX, ...???) want for x and y parameter and also what unit will return when call Bitmap.getWidth() is it in DIP OR PIX OR ....???

i want to create backgammonboard game, when i create board, i am re size original image, and i check original image and re sized image and check percentage, and draw dices, but my problem still it is not work properly in all device, just work fine in my device that programmed in...

i think i confused DIP and PX and Bitmap.getWidth() has diffrent unit that canvas.drawBitmap wants...

UPDATE i put backgammonboard image in drawable-mdpi it has 858Px but when i use ((BitmapDrawable) this.getResources().getDrawable(R.drawable.backgammonboard)).getBitmap().getWidt‌​h() it will rerutn 1287Px why??

有帮助吗?

解决方案

Canvas, Bitmaps and such are in Pixels.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top