public class BitmapEncoder extends Object implements ResourceEncoder<Bitmap>
ResourceEncoder
that writes Bitmap
s
to OutputStream
s.
Bitmap
s that return true from
()
} are written using
Bitmap.CompressFormat.PNG
to preserve alpha and all other bitmaps are written using
Bitmap.CompressFormat.JPEG
.
Modifier and Type | Field and Description |
---|---|
static Option<Bitmap.CompressFormat> |
COMPRESSION_FORMAT
An
Bitmap.CompressFormat option used as the format to encode
the Bitmap . |
static Option<Integer> |
COMPRESSION_QUALITY
An integer option between 0 and 100 that is used as the compression quality.
|
Constructor and Description |
---|
BitmapEncoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
encode(Resource<Bitmap> resource,
File file,
Options options)
Writes the given data to the given output stream and returns True if the write completed
successfully and should be committed.
|
EncodeStrategy |
getEncodeStrategy(Options options) |
public static final Option<Integer> COMPRESSION_QUALITY
Defaults to 90.
public static final Option<Bitmap.CompressFormat> COMPRESSION_FORMAT
Bitmap.CompressFormat
option used as the format to encode
the Bitmap
.
Defaults to Bitmap.CompressFormat.JPEG
for images without alpha
and Bitmap.CompressFormat.PNG
for images with alpha.
public boolean encode(Resource<Bitmap> resource, File file, Options options)
Encoder
public EncodeStrategy getEncodeStrategy(Options options)
getEncodeStrategy
in interface ResourceEncoder<Bitmap>