Package com.pspdfkit.document.image
Class BitmapUtils
-
- All Implemented Interfaces:
public class BitmapUtils
Extension to android.graphics.BitmapFactory that allows decoding bitmaps from content provider Uris.
-
-
Constructor Summary
Constructors Constructor Description BitmapUtils()
-
Method Summary
Modifier and Type Method Description static Single<Bitmap>
decodeBitmapAsync(@NonNull() Context context, @NonNull() Uri imageUri)
Decode bitmap from an imageUri
asynchronously.static Bitmap
decodeBitmap(@NonNull() Context context, @NonNull() Uri imageUri)
Read bitmap from an imageUri
.static Bitmap
fromDrawable(Context context, int drawableResource)
Generate a bitmap from an drawableResource
XML drawable-
-
Method Detail
-
decodeBitmapAsync
@NonNull() static Single<Bitmap> decodeBitmapAsync(@NonNull() Context context, @NonNull() Uri imageUri)
Decode bitmap from an
imageUri
asynchronously. Accepts URI schemes accepted by openInputStream:- content (SCHEME_CONTENT)
- android.resource (SCHEME_ANDROID_RESOURCE)
- file (SCHEME_FILE)
- Parameters:
context
- The context to use.imageUri
- Uri from which to read the bitmap.- Returns:
Single observable returning decoded bitmap data.
-
decodeBitmap
@NonNull() static Bitmap decodeBitmap(@NonNull() Context context, @NonNull() Uri imageUri)
Read bitmap from an
imageUri
. Accepts URI schemes accepted by openInputStream:- content (SCHEME_CONTENT)
- android.resource (SCHEME_ANDROID_RESOURCE)
- file (SCHEME_FILE)
- Parameters:
context
- The context to use.imageUri
- Uri from which to read the bitmap.- Returns:
decoded bitmap data.
-
fromDrawable
static Bitmap fromDrawable(Context context, int drawableResource)
Generate a bitmap from an
drawableResource
XML drawable- Parameters:
context
- The context to usedrawableResource
- drawable resource to generate a bitmap from- Returns:
generated bitmap
-
-
-
-