Java Code Examples for com.bumptech.glide.load.Options#get()
The following examples show how to use
com.bumptech.glide.load.Options#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EncryptedBitmapResourceEncoder.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@SuppressWarnings("EmptyCatchBlock") @Override public boolean encode(@NonNull Resource<Bitmap> data, @NonNull File file, @NonNull Options options) { Log.i(TAG, "Encrypted resource encoder running: " + file.toString()); Bitmap bitmap = data.get(); Bitmap.CompressFormat format = getFormat(bitmap, options); int quality = options.get(BitmapEncoder.COMPRESSION_QUALITY); try (OutputStream os = createEncryptedOutputStream(secret, file)) { bitmap.compress(format, quality, os); os.close(); return true; } catch (IOException e) { Log.w(TAG, e); return false; } }
Example 2
Source File: SvgBitmapDrawableTranscoder.java From SvgGlidePlugins with Apache License 2.0 | 6 votes |
@NonNull private Bitmap.Config getDecodeFormat(@Nullable Options options) { DecodeFormat decodeFormat = options == null ? null : options.get(GifOptions.DECODE_FORMAT); if (decodeFormat == null) { return Bitmap.Config.ARGB_8888; } switch (decodeFormat) { case PREFER_RGB_565: return Bitmap.Config.RGB_565; case PREFER_ARGB_8888: default: return Bitmap.Config.ARGB_8888; } }
Example 3
Source File: SvgBitmapDrawableTranscoder.java From SvgGlidePlugins with Apache License 2.0 | 6 votes |
private void prepareSvg(@NonNull Resource<SVG> toTranscode, @Nullable Options options) { if (!(toTranscode instanceof SvgResource)) { return; } DownsampleStrategy strategy = options == null ? null : options.get(DownsampleStrategy.OPTION); if (strategy != null) { float scaleFactor = strategy.getScaleFactor( Math.round(toTranscode.get().getDocumentWidth()), Math.round(toTranscode.get().getDocumentHeight()), ((SvgResource) toTranscode).getWidth(), ((SvgResource) toTranscode).getHeight() ); SvgUtils.scaleDocumentSize(toTranscode.get(), scaleFactor); } }
Example 4
Source File: EncryptedBitmapResourceEncoder.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
private Bitmap.CompressFormat getFormat(Bitmap bitmap, Options options) { Bitmap.CompressFormat format = options.get(BitmapEncoder.COMPRESSION_FORMAT); if (format != null) { return format; } else if (bitmap.hasAlpha()) { return Bitmap.CompressFormat.PNG; } else { return Bitmap.CompressFormat.JPEG; } }
Example 5
Source File: ByteBufferAnimationDecoder.java From APNG4Android with Apache License 2.0 | 4 votes |
@Override public boolean handles(@NonNull ByteBuffer source, @NonNull Options options) { return (!options.get(AnimationDecoderOption.DISABLE_ANIMATION_WEBP_DECODER) && WebPParser.isAWebP(new ByteBufferReader(source))) || (!options.get(AnimationDecoderOption.DISABLE_ANIMATION_APNG_DECODER) && APNGParser.isAPNG(new ByteBufferReader(source))) || (!options.get(AnimationDecoderOption.DISABLE_ANIMATION_GIF_DECODER) && GifParser.isGif(new ByteBufferReader(source))); }
Example 6
Source File: StreamAnimationDecoder.java From APNG4Android with Apache License 2.0 | 4 votes |
@Override public boolean handles(@NonNull InputStream source, @NonNull Options options) { return (!options.get(AnimationDecoderOption.DISABLE_ANIMATION_WEBP_DECODER) && WebPParser.isAWebP(new StreamReader(source))) || (!options.get(AnimationDecoderOption.DISABLE_ANIMATION_APNG_DECODER) && APNGParser.isAPNG(new StreamReader(source))) || (!options.get(AnimationDecoderOption.DISABLE_ANIMATION_GIF_DECODER) && GifParser.isGif(new StreamReader(source))); }