public class BitmapFactoryUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.HashMap<java.lang.Integer,MemoryFile> |
memoryFileHashMap |
static Bitmap |
NOTING_BITMAP |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkIsJpegResource(int resourceID)
Check if the resource is a jpeg file, by looking at the file_extension
|
static boolean |
checkIsPngResource(int resourceID)
Check if the resource is a jpeg file, by looking at the file_extension
|
static boolean |
checkIsSvgResource(int resourceID)
Check if the raw resource is a svg file, by looking at the file_extension
|
static boolean |
checkIsXMLResource(int resourceID)
Check if the resource is a xml file, by looking at the file_extension
|
static boolean |
checkResourceType(int resourceID,
java.lang.String... suffixs)
Check if the resource is a jpeg file, by looking at the file_extension
|
static Bitmap |
decodeFile(java.lang.String filename,
int minSize,
boolean square)
Decode a image file into a Bitmap.
|
static Bitmap |
decodeFile(java.lang.String filename,
int minSize,
boolean square,
boolean fixRotation)
Decode a image file into a Bitmap.
|
static Bitmap |
decodeResource(Resources res,
int resId)
Decode a drawable or a raw image resource.
|
static Bitmap |
decodeResource(Resources res,
int resId,
int minSize)
Decode a drawable or a raw image resource.
|
static int[] |
decodeSize(java.io.InputStream stream) |
static int[] |
decodeSize(Resources res,
int resId) |
static float[] |
decodeSize(java.lang.String filename) |
static Bitmap |
decodeStream(java.io.InputStream stream,
int minSize)
Decode a drawable or a raw image resource.
|
static Bitmap |
drawResource(Resources res,
int resId)
Draw a XML Drawable resource to a Bitmap because a XML Drawable not can be decoded by #decodeResource
|
static Bitmap |
drawResource(Resources res,
int resId,
int width,
int height)
Draw a XML Drawable resource to a Bitmap because a XML Drawable not can be decoded by #decodeResource
|
static int |
getImageRotation(java.lang.String filename)
Get the orientation of the image file base on the exif information.
|
static void |
preloadResource(Resources res,
int resId) |
public static java.util.HashMap<java.lang.Integer,MemoryFile> memoryFileHashMap
public static final Bitmap NOTING_BITMAP
public static boolean checkIsJpegResource(@DrawableRes @RawRes int resourceID)
resourceID
- resource id.public static boolean checkIsPngResource(@DrawableRes @RawRes int resourceID)
resourceID
- resource id.public static boolean checkIsSvgResource(@DrawableRes @RawRes int resourceID)
resourceID
- resource id.public static boolean checkIsXMLResource(@DrawableRes @RawRes int resourceID)
resourceID
- resource id.public static boolean checkResourceType(@DrawableRes @RawRes int resourceID, java.lang.String... suffixs)
resourceID
- resource id.public static Bitmap decodeFile(java.lang.String filename, int minSize, boolean square)
filename
- image file path.minSize
- minWidth the image must have.square
- width and height of the image should be same.public static Bitmap decodeFile(java.lang.String filename, int minSize, boolean square, boolean fixRotation)
filename
- image file path.minSize
- minWidth the image must have.square
- width and height of the image should be same.fixRotation
- fix image rotation based on the exif orientation information.public static Bitmap decodeResource(Resources res, @DrawableRes @RawRes int resId)
res
- resources @see #PESDK.getAppResource().resId
- resource id.public static Bitmap decodeResource(Resources res, @DrawableRes @RawRes int resId, int minSize)
res
- resources @see #PESDK.getAppResource().resId
- resource id.minSize
- minWidth the image must have.@NonNull public static int[] decodeSize(java.io.InputStream stream)
@NonNull public static int[] decodeSize(Resources res, @DrawableRes @RawRes int resId)
@NonNull public static float[] decodeSize(java.lang.String filename)
public static Bitmap decodeStream(java.io.InputStream stream, int minSize) throws java.io.IOException
stream
- image inputStreamminSize
- minWidth the image must have.java.io.IOException
public static Bitmap drawResource(@NonNull Resources res, @DrawableRes int resId)
res
- Application ResourceresId
- Drawable Resource id.public static Bitmap drawResource(@NonNull Resources res, @DrawableRes int resId, int width, int height)
res
- Application ResourceresId
- Drawable Resource id.width
- destination widthheight
- destination heightpublic static int getImageRotation(java.lang.String filename)
filename
- image file path.public static void preloadResource(Resources res, @DrawableRes @RawRes int resId)