Search in sources :

Example 1 with GifDrawableTransformation

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();
}
Also used : BitmapDrawableTransformation(com.bumptech.glide.load.resource.bitmap.BitmapDrawableTransformation) GifDrawableTransformation(com.bumptech.glide.load.resource.gif.GifDrawableTransformation)

Example 2 with GifDrawableTransformation

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);
    }
}
Also used : GifDrawableTransformation(com.bumptech.glide.load.resource.gif.GifDrawableTransformation) BitmapPool(com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool)

Example 3 with GifDrawableTransformation

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();
}
Also used : GifDrawableTransformation(com.bumptech.glide.load.resource.gif.GifDrawableTransformation) DrawableTransformation(com.bumptech.glide.load.resource.bitmap.DrawableTransformation) GifDrawableTransformation(com.bumptech.glide.load.resource.gif.GifDrawableTransformation) NonNull(android.support.annotation.NonNull)

Aggregations

GifDrawableTransformation (com.bumptech.glide.load.resource.gif.GifDrawableTransformation)3 NonNull (android.support.annotation.NonNull)1 BitmapPool (com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool)1 BitmapDrawableTransformation (com.bumptech.glide.load.resource.bitmap.BitmapDrawableTransformation)1 DrawableTransformation (com.bumptech.glide.load.resource.bitmap.DrawableTransformation)1