Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does createScaledBitmap() use px or dp?

Tags:

android

When specifying the width and height of your scaled Bitmap, is the method asking for pixels or density-independent pixels?

I have a 240dp device and when scaling an image to 240x240, the image is barely half the screen size. I was expecting it to be full screen. Does this mean the method uses pixels?

like image 954
Jake Wilson Avatar asked Oct 04 '11 16:10

Jake Wilson


People also ask

How do I know if a bitmap is empty Android?

You can do a check when you want to return the BitMap look to see if the ArrayList of Paths is bigger than 0 and return the BitMap if so, or else return null.

What is bitmap image in Android Studio?

A bitmap (or raster graphic) is a digital image composed of a matrix of dots. When viewed at 100%, each dot corresponds to an individual pixel on a display. In a standard bitmap image, each dot can be assigned a different color. In this instance we will simply create a Bitmap directly: Bitmap b = Bitmap.

What is a bitmap Java?

A bitmap is a mapping from one system such as integers to bits. It is also known as bitmap index or a bit array. The memory is divided into units for bitmap. These units may range from a few bytes to several kilobytes. Each memory unit is associated with a bit in the bitmap.


1 Answers

Yes, it uses px. You can obtain the size of the screen, and call createScaledBitmap(screenWidth ... )

like image 113
Matt Avatar answered Oct 19 '22 12:10

Matt