|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bumptech.glide.load.resource.bitmap.Downsampler
public abstract class Downsampler
A base class with methods for loading and decoding images from InputStreams.
Field Summary | |
---|---|
static Downsampler |
AT_LEAST
Load and scale the image uniformly (maintaining the image's aspect ratio) so that the dimensions of the image will be greater than or equal to the given width and height. |
static Downsampler |
AT_MOST
Load and scale the image uniformly (maintaining the image's aspect ratio) so that the dimensions of the image will be less than or equal to the given width and height. |
static Downsampler |
NONE
Load the image at its original size. |
Constructor Summary | |
---|---|
Downsampler()
|
Method Summary | |
---|---|
Bitmap |
decode(InputStream is,
BitmapPool pool,
int outWidth,
int outHeight,
DecodeFormat decodeFormat)
Load the image for the given InputStream. |
protected Bitmap |
downsampleWithSize(RecyclableBufferedInputStream bis,
BitmapFactory.Options options,
BitmapPool pool,
int inWidth,
int inHeight,
int sampleSize,
DecodeFormat decodeFormat)
|
int[] |
getDimensions(RecyclableBufferedInputStream bis,
BitmapFactory.Options options)
A method for getting the dimensions of an image from the given InputStream. |
protected abstract int |
getSampleSize(int inWidth,
int inHeight,
int outWidth,
int outHeight)
Determine the amount of downsampling to use for a load given the dimensions of the image to be downsampled and the dimensions of the view/target the image will be displayed in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.bumptech.glide.load.resource.bitmap.BitmapDecoder |
---|
getId |
Field Detail |
---|
public static final Downsampler AT_LEAST
public static final Downsampler AT_MOST
public static final Downsampler NONE
Constructor Detail |
---|
public Downsampler()
Method Detail |
---|
public Bitmap decode(InputStream is, BitmapPool pool, int outWidth, int outHeight, DecodeFormat decodeFormat)
Note - this method will throw an exception of a Bitmap with dimensions not matching those of the image for the given InputStream is provided.
decode
in interface BitmapDecoder<InputStream>
is
- An InputStream
to the data for the imagepool
- A pool of recycled bitmapsoutWidth
- The width the final image should be close tooutHeight
- The height the final image should be close todecodeFormat
- The desired configuration for the returned bitmap.
protected Bitmap downsampleWithSize(RecyclableBufferedInputStream bis, BitmapFactory.Options options, BitmapPool pool, int inWidth, int inHeight, int sampleSize, DecodeFormat decodeFormat)
protected abstract int getSampleSize(int inWidth, int inHeight, int outWidth, int outHeight)
inWidth
- The width of the image to be downsampled.inHeight
- The height of the image to be downsampled.outWidth
- The width of the view/target the image will be displayed in.outHeight
- The height of the view/target the imag will be displayed in.
BitmapFactory.decodeStream(java.io.InputStream, android.graphics.Rect,
android.graphics.BitmapFactory.Options)
.BitmapFactory.Options.inSampleSize
public int[] getDimensions(RecyclableBufferedInputStream bis, BitmapFactory.Options options)
bis
- The InputStream representing the image.options
- The options to pass to
BitmapFactory.decodeStream(java.io.InputStream, android.graphics.Rect,
android.graphics.BitmapFactory.Options)
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |