java.lang.Object | |
↳ | com.urbanairship.util.ImageUtils |
A class containing utility methods related to bitmaps.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | ImageUtils.DrawableResult | Drawable result. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static int |
calculateInSampleSize(int width, int height, int reqWidth, int reqHeight)
Calculate the largest inSampleSize value that is a power of 2 and keeps both
height and width larger than the requested height and width.
| ||||||||||
static ImageUtils.Size |
calculateTargetSize(int width, int height, int reqWidth, int reqHeight, int fallbackWidth, int fallbackHeight)
Calculates a target size based on the original image aspect ratio if either the request width
or request height are 0, otherwise returns the request size.
| ||||||||||
static Bitmap |
fetchScaledBitmap(Context context, URL url, int reqWidth, int reqHeight)
Create a scaled bitmap.
| ||||||||||
static Bitmap |
fetchScaledBitmap(Context context, URL url, int reqWidth, int reqHeight, int fallbackWidth, int fallbackHeight)
Create a scaled bitmap.
| ||||||||||
static ImageUtils.DrawableResult |
fetchScaledDrawable(Context context, URL url, int reqWidth, int reqHeight, int fallbackWidth, int fallbackHeight)
Fetches a drawable from an image path, using the supplied fallback dimensions if the
ImageView reports
a width or height of zero. | ||||||||||
static ImageUtils.DrawableResult |
fetchScaledDrawable(Context context, URL url, int reqWidth, int reqHeight)
Fetches a drawable from an image path.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Calculate the largest inSampleSize value that is a power of 2 and keeps both height and width larger than the requested height and width.
Taken from http://developer.android.com/training/displaying-bitmaps/load-bitmap.html.
width | The width of the image. |
---|---|
height | The height of the image. |
reqWidth | The requested width of the image. |
reqHeight | The requested height of the image. |
Calculates a target size based on the original image aspect ratio if either the request width or request height are 0, otherwise returns the request size.
width | The width of the image. |
---|---|
height | The height of the image. |
reqWidth | The requested width of the image. |
reqHeight | The requested height of the image. |
Create a scaled bitmap.
context | The application context. |
---|---|
url | The URL image. |
reqWidth | The requested width of the image. |
reqHeight | The requested height of the image. |
IOException | if file fails to be created. |
---|
Create a scaled bitmap.
context | The application context. |
---|---|
url | The URL image. |
reqWidth | The requested width of the image. |
reqHeight | The requested height of the image. |
fallbackWidth | The width dimension to be used if the ImageView reports a width of zero. |
fallbackHeight | The height dimension to be used if the ImageView reports a height of zero. |
IOException | if file fails to be created. |
---|
Fetches a drawable from an image path, using the supplied fallback dimensions if the ImageView
reports
a width or height of zero. Setting the fallback dimensions to -1
will automatically calculate zero
dimensions based on the aspect ratio of the image.
context | The application context. |
---|---|
url | The URL. |
reqWidth | The requested width of the image. |
reqHeight | The requested height of the image. |
fallbackWidth | The width dimension to be used if the ImageView reports a width of zero. |
fallbackHeight | The height dimension to be used if the ImageView reports a height of zero. |
IOException | if file fails to be created. |
---|
Fetches a drawable from an image path.
context | The application context. |
---|---|
url | The URL. |
reqWidth | The requested width of the image. |
reqHeight | The requested height of the image. |
IOException | if file fails to be created. |
---|