Package icyllis.modernui.graphics.drawable

# Class ScaleDrawable

java.lang.Object
icyllis.modernui.graphics.drawable.Drawable
icyllis.modernui.graphics.drawable.DrawableWrapper
icyllis.modernui.graphics.drawable.ScaleDrawable

All Implemented Interfaces:
  `Drawable.Callback`

public class ScaleDrawable extends DrawableWrapper

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class icyllis.modernui.graphics.drawable.Drawable

  `Drawable.Callback, Drawable.ConstantState`

- ## Field Summary

  ### Fields inherited from class icyllis.modernui.graphics.drawable.Drawable

  `MAX_LEVEL`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ScaleDrawable(Drawable drawable, int gravity, float scaleWidth, float scaleHeight)`
  Creates a new scale drawable with the specified gravity and scale properties.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `draw(Canvas canvas)`
  Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).
  `protected void`
  `onBoundsChange(Rect bounds)`
  Override this in your subclass to change appearance if you vary based on the bounds.
  `protected boolean`
  `onLevelChange(int level)`
  Override this in your subclass to change appearance if you vary based on level.
  `void`
  `setGravity(int gravity)`
  `void`
  `setScaleHeight(float scaleHeight)`
  `void`
  `setScaleWidth(float scaleWidth)`

  ### Methods inherited from class icyllis.modernui.graphics.drawable.DrawableWrapper

  `clearMutated, getAlpha, getConstantState, getDrawable, getHotspotBounds, getIntrinsicHeight, getIntrinsicWidth, getPadding, hasFocusStateSpecified, invalidateDrawable, isStateful, jumpToCurrentState, mutate, onLayoutDirectionChanged, onStateChange, scheduleDrawable, setAlpha, setDrawable, setHotspot, setHotspotBounds, setTintBlendMode, setTintList, setVisible, unscheduleDrawable`

  ### Methods inherited from class icyllis.modernui.graphics.drawable.Drawable

  `applyTheme, canApplyTheme, copyBounds, copyBounds, getBounds, getCallback, getChangingConfigurations, getColorFilter, getCurrent, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getState, invalidateSelf, isAutoMirrored, isVisible, scaleFromDensity, scaleFromDensity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setLayoutDirection, setLevel, setState, setTint, unscheduleSelf`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ScaleDrawable

    public ScaleDrawable(Drawable drawable, int gravity, float scaleWidth, float scaleHeight)
    Creates a new scale drawable with the specified gravity and scale properties.
    Parameters:
      `drawable` - the drawable to scale
      `gravity` - gravity constant (see `Gravity` used to position the scaled drawable within the parent container
      `scaleWidth` - width scaling factor [0...1] to use then the level is at the maximum value, or -1 to not scale width
      `scaleHeight` - height scaling factor [0...1] to use then the level is at the maximum value, or -1 to not scale height

- ## Method Details

  - ### setGravity

    public void setGravity(int gravity)

  - ### setScaleWidth

    public void setScaleWidth(float scaleWidth)

  - ### setScaleHeight

    public void setScaleHeight(float scaleHeight)

  - ### draw

    public void draw(@NonNull Canvas canvas)
    Description copied from class: `Drawable`
    Draw in its bounds (set via setBounds) respecting optional effects such as alpha (set via setAlpha).
    Overrides:
      `draw` in class `DrawableWrapper`
    Parameters:
      `canvas` - The canvas to draw into

  - ### onLevelChange

    protected boolean onLevelChange(int level)
    Description copied from class: `Drawable`
    Override this in your subclass to change appearance if you vary based on level.
    Overrides:
      `onLevelChange` in class `DrawableWrapper`
    Returns:
      Returns true if the level change has caused the appearance of the Drawable to change (that is, it needs to be drawn), else false if it looks the same and there is no need to redraw it since its last level.

  - ### onBoundsChange

    protected void onBoundsChange(@NonNull Rect bounds)
    Description copied from class: `Drawable`
    Override this in your subclass to change appearance if you vary based on the bounds.
    Overrides:
      `onBoundsChange` in class `DrawableWrapper`