public class

ScaleTypeDrawable

extends ForwardingDrawable
java.lang.Object
   ↳ android.graphics.drawable.Drawable
     ↳ com.facebook.drawee.drawable.ForwardingDrawable
       ↳ com.facebook.drawee.drawable.ScaleTypeDrawable

Class Overview

Drawable that can scale underlying drawable based on specified ScalingUtils.ScaleType options.

Based on android.widget.ImageView.ScaleType.

Summary

[Expand]
Inherited Fields
From class com.facebook.drawee.drawable.ForwardingDrawable
Public Constructors
ScaleTypeDrawable(Drawable drawable, ScalingUtils.ScaleType scaleType)
Creates a new ScaleType drawable with given underlying drawable and scale type.
Public Methods
void draw(Canvas canvas)
PointF getFocusPoint()
Gets the focus point.
ScalingUtils.ScaleType getScaleType()
Gets the current scale type.
void getTransform(Matrix transform)
TransformationCallback method
Drawable setCurrent(Drawable newDelegate)
Sets a new drawable to be the delegate, and returns the old one (or null).
void setFocusPoint(PointF focusPoint)
Sets the focus point.
void setScaleType(ScalingUtils.ScaleType scaleType)
Sets the scale type.
Protected Methods
void onBoundsChange(Rect bounds)
[Expand]
Inherited Methods
From class com.facebook.drawee.drawable.ForwardingDrawable
From class android.graphics.drawable.Drawable
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface com.facebook.drawee.drawable.DrawableParent
From interface com.facebook.drawee.drawable.TransformAwareDrawable
From interface com.facebook.drawee.drawable.TransformCallback

Public Constructors

public ScaleTypeDrawable (Drawable drawable, ScalingUtils.ScaleType scaleType)

Creates a new ScaleType drawable with given underlying drawable and scale type.

Parameters
drawable underlying drawable to apply scale type on
scaleType scale type to be applied

Public Methods

public void draw (Canvas canvas)

public PointF getFocusPoint ()

Gets the focus point.

Returns
  • focus point of the image

public ScalingUtils.ScaleType getScaleType ()

Gets the current scale type.

Returns
  • scale type

public void getTransform (Matrix transform)

TransformationCallback method

Parameters
transform Matrix that is applied to the drawable by the parent drawables.

public Drawable setCurrent (Drawable newDelegate)

Sets a new drawable to be the delegate, and returns the old one (or null).

This method will cause the drawable to be invalidated.

Returns
  • the previous delegate

public void setFocusPoint (PointF focusPoint)

Sets the focus point. If ScaleType.FOCUS_CROP is used, focus point will attempted to be centered within a view. Each coordinate is a real number in [0,1] range, in the coordinate system where top-left corner of the image corresponds to (0, 0) and the bottom-right corner corresponds to (1, 1).

Parameters
focusPoint focus point of the image

public void setScaleType (ScalingUtils.ScaleType scaleType)

Sets the scale type.

Parameters
scaleType scale type to set

Protected Methods

protected void onBoundsChange (Rect bounds)