use of com.bumptech.glide.load.resource.gif.GifDrawableTransformation in project glide by bumptech.
the class BaseRequestOptions method optionalTransform.
/**
* Applies the given {@link com.bumptech.glide.load.Transformation} for
* {@link android.graphics.Bitmap Bitmaps} to the default types ({@link android.graphics.Bitmap},
* {@link android.graphics.drawable.BitmapDrawable}, and
* {@link com.bumptech.glide.load.resource.gif.GifDrawable}) and ignores unknown types.
*
* <p>This will override previous calls to {@link #dontTransform()}.
*
* @param context Any {@link android.content.Context}.
* @param transformation Any {@link com.bumptech.glide.load.Transformation} for
* {@link android.graphics.Bitmap}s.
* @see #transform(android.content.Context, com.bumptech.glide.load.Transformation)
* @see #transform(Class, com.bumptech.glide.load.Transformation)
*/
public CHILD optionalTransform(Context context, Transformation<Bitmap> transformation) {
if (isAutoCloneEnabled) {
return clone().optionalTransform(context, transformation);
}
optionalTransform(Bitmap.class, transformation);
// TODO: remove BitmapDrawable decoder and this transformation.
optionalTransform(BitmapDrawable.class, new BitmapDrawableTransformation(context, transformation));
optionalTransform(GifDrawable.class, new GifDrawableTransformation(context, transformation));
return selfOrThrowIfLocked();
}
use of com.bumptech.glide.load.resource.gif.GifDrawableTransformation in project WeexErosFramework by bmfe.
the class DefaultWXImageAdapter method showAndCropGif.
private void showAndCropGif(String url, WXImageView view, WXImageStrategy mStrategy) {
BMRadiusTransfer radiusTransfer = new BMRadiusTransfer(WXEnvironment.getApplication(), view);
BitmapPool bitmapPool = Glide.get(WXEnvironment.getApplication()).getBitmapPool();
BMHookGlide.load(WXEnvironment.getApplication(), url).asGif().transform(new GifDrawableTransformation(radiusTransfer, bitmapPool)).into(view);
if (mStrategy != null && mStrategy.getImageListener() != null) {
mStrategy.getImageListener().onImageFinish(url, view, true, null);
}
}
use of com.bumptech.glide.load.resource.gif.GifDrawableTransformation in project glide by bumptech.
the class RequestOptions method transform.
@NonNull
private RequestOptions transform(@NonNull Transformation<Bitmap> transformation, boolean isRequired) {
if (isAutoCloneEnabled) {
return clone().transform(transformation, isRequired);
}
DrawableTransformation drawableTransformation = new DrawableTransformation(transformation, isRequired);
transform(Bitmap.class, transformation, isRequired);
transform(Drawable.class, drawableTransformation, isRequired);
// TODO: remove BitmapDrawable decoder and this transformation.
// Registering as BitmapDrawable is simply an optimization to avoid some iteration and
// isAssignableFrom checks when obtaining the transformation later on. It can be removed without
// affecting the functionality.
transform(BitmapDrawable.class, drawableTransformation.asBitmapDrawable(), isRequired);
transform(GifDrawable.class, new GifDrawableTransformation(transformation), isRequired);
return selfOrThrowIfLocked();
}
Aggregations