Search in sources :

Example 1 with BitmapDrawableTransformation

use of com.bumptech.glide.load.resource.bitmap.BitmapDrawableTransformation 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 BitmapDrawableTransformation

use of com.bumptech.glide.load.resource.bitmap.BitmapDrawableTransformation in project Rocket by mozilla-tw.

the class RequestOptions method optionalTransform.

/**
 * Applies the given {@link Transformation} for
 * {@link Bitmap Bitmaps} to the default types ({@link Bitmap},
 * {@link android.graphics.drawable.BitmapDrawable}, and ignores unknown types.
 *
 * <p>This will override previous calls to {@link #dontTransform()}.
 *
 * @param transformation Any {@link Transformation} for {@link Bitmap}s.
 * @see #transform(Transformation)
 * @see #transform(Class, Transformation)
 */
// Guaranteed to modify the current object by the isAutoCloneEnabledCheck.
@SuppressWarnings("CheckResult")
@CheckResult
public RequestOptions optionalTransform(Transformation<Bitmap> transformation) {
    if (isAutoCloneEnabled) {
        return clone().optionalTransform(transformation);
    }
    optionalTransform(Bitmap.class, transformation);
    // TODO: remove BitmapDrawable decoder and this transformation.
    optionalTransform(BitmapDrawable.class, new BitmapDrawableTransformation(transformation));
    return selfOrThrowIfLocked();
}
Also used : BitmapDrawableTransformation(com.bumptech.glide.load.resource.bitmap.BitmapDrawableTransformation) CheckResult(android.support.annotation.CheckResult)

Aggregations

BitmapDrawableTransformation (com.bumptech.glide.load.resource.bitmap.BitmapDrawableTransformation)2 CheckResult (android.support.annotation.CheckResult)1 GifDrawableTransformation (com.bumptech.glide.load.resource.gif.GifDrawableTransformation)1