# MaterialShapeDrawable

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/shape/MaterialShapeDrawable.java)

*** ** * ** ***


```
public class MaterialShapeDrawable implements Shapeable
```

<br />

Known direct subclasses [ChipDrawable](https://developer.android.com/reference/com/google/android/material/chip/ChipDrawable)

|---|---|
| `https://developer.android.com/reference/com/google/android/material/chip/ChipDrawable` | ChipDrawable contains all the layout and draw logic for `https://developer.android.com/reference/com/google/android/material/chip/Chip`. |

*** ** * ** ***

Base drawable class for Material Shapes that handles shadows, elevation, scale and color for a generated path.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Retention(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.SOURCE) public annotation https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable.CompatibilityShadowMode` Determines when compatibility shadow is drawn vs. native elevation shadows. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#SHADOW_COMPAT_MODE_ALWAYS() = 2` Always draw fake shadows, never draw native elevation shadows. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#SHADOW_COMPAT_MODE_DEFAULT() = 0` Try to draw native elevation shadows if possible, otherwise use fake shadows. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#SHADOW_COMPAT_MODE_NEVER() = 1` Never draw fake shadows. |

| ### Public fields |
|---|---|
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#resolvedTintColor()` |
| `final Region` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#transparentRegion()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#MaterialShapeDrawable()()` |
| `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#MaterialShapeDrawable(com.google.android.material.shape.ShapeAppearanceModel)(https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel shapeAppearanceModel)` |
| `[MaterialShapeDrawable](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#MaterialShapeDrawable(com.google.android.material.shape.ShapePathModel))(https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel shapePathModel)` |
| `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#MaterialShapeDrawable(Context,AttributeSet,int,int)( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes )` |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#createWithElevationOverlay(Context)(Context context)` Returns a `MaterialShapeDrawable` with the elevation overlay functionality initialized, a fill color of `colorSurface`, and an elevation of 0. |
| `static https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#createWithElevationOverlay(Context,float)(Context context, float elevation)` Returns a `MaterialShapeDrawable` with the elevation overlay functionality initialized, a fill color of `colorSurface`, and an elevation of `elevation`. |
| `static https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#createWithElevationOverlay(Context,float,ColorStateList)( Context context, float elevation, ColorStateList backgroundTint )` Returns a `MaterialShapeDrawable` with the elevation overlay functionality initialized, a fill color of `backgroundTint`, and an elevation of `elevation`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#draw(Canvas)(Canvas canvas)` |
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getAlpha()()` |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getBottomLeftCornerResolvedSize()()` Returns the actual size of the bottom left corner for the current bounds. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getBottomRightCornerResolvedSize()()` Returns the actual size of the bottom right corner for the current bounds. |
| `ConstantState` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getConstantState()()` |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getElevation()()` Returns the elevation used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getFillColor()()` Get the color used for the fill. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getInterpolation()()` Get the interpolation of the path, between 0 and 1. |
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getOpacity()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getOutline(Outline)(Outline outline)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getPadding(Rect)(Rect padding)` |
| `Style` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getPaintStyle()()` Get the current style used by the shape's paint. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getParentAbsoluteElevation()()` Returns the parent absolute elevation. |
| `void` | `[getPathForSize](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getPathForSize(int,int,Path))(int width, int height, Path path)` **This method is deprecated.** see `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearancePathProvider` <br /> |
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getResolvedTintColor()()` Get the tint color factoring in any other runtime modifications such as elevation overlays. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getScale()()` Get the scale of the rendered path. |
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowCompatRotation()()` Returns the rotation offset applied to the fake shadow which is drawn when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true. |
| `int` | `@https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable.CompatibilityShadowMode https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowCompatibilityMode()()` |
| `int` | `[getShadowElevation](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowElevation())()` **This method is deprecated.** use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getElevation()` instead. <br /> |
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowOffsetX()()` Returns the X offset of the shadow from the bounds of the shape. |
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowOffsetY()()` Returns the Y offset of the shadow from the bounds of the shape. |
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowRadius()()` Get the shadow radius rendered by the path in pixels. |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShapeAppearanceModel()()` Get the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` containing the path that will be rendered in this drawable. |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel` | `[getShapedViewModel](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShapedViewModel())()` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShapeAppearanceModel()` instead. <br /> |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getStrokeColor()()` Get the color used for the stroke. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getStrokeTintList()()` Get the stroke's current ColorStateList. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getStrokeWidth()()` Get the stroke width used by the shape's paint. |
| `ColorStateList` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getTintList()()` Get the tint list used by the shape's paint. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getTopLeftCornerResolvedSize()()` Returns the actual size of the top left corner for the current bounds. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getTopRightCornerResolvedSize()()` Returns the actual size of the top right corner for the current bounds. |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getTranslationZ()()` Returns the translationZ used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. |
| `Region` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getTransparentRegion()()` |
| `float` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getZ()()` Returns the visual z position of this drawable, in pixels. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#initializeElevationOverlay(Context)(Context context)` Initializes the elevation overlay functionality for this drawable. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#invalidateSelf()()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#isElevationOverlayEnabled()()` Returns whether the elevation overlay functionality is initialized and enabled in this drawable's theme context. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#isElevationOverlayInitialized()()` Returns whether the elevation overlay functionality has been initialized for this drawable. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#isPointInTransparentRegion(int,int)(int x, int y)` Determines whether a point is contained within the transparent region of the Drawable. |
| `boolean` | `[isShadowEnabled](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#isShadowEnabled())()` **This method is deprecated.** use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowCompatibilityMode()` instead <br /> |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#isStateful()()` |
| `Drawable` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#mutate()()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()()` Returns true if compat shadows should be drawn. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setAlpha(int)(int alpha)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setColorFilter(ColorFilter)(ColorFilter colorFilter)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setCornerSize(com.google.android.material.shape.CornerSize)(https://developer.android.com/reference/com/google/android/material/shape/CornerSize cornerSize)` Updates the corners for the given `https://developer.android.com/reference/com/google/android/material/shape/CornerSize`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setCornerSize(float)(float cornerSize)` Updates the corners for the given `https://developer.android.com/reference/com/google/android/material/shape/CornerSize`. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setEdgeIntersectionCheckEnable(boolean)(boolean enable)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setElevation(float)(float elevation)` Sets the elevation used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setFillColor(ColorStateList)(ColorStateList fillColor)` Set the color used for the fill. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setInterpolation(float)(float interpolation)` Set the interpolation of the path, between 0 and 1. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setPadding(int,int,int,int)(int left, int top, int right, int bottom)` Configure the padding of the shape |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setPaintStyle(Style)(Style paintStyle)` Set the style used by the shape's paint. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setParentAbsoluteElevation(float)(float parentAbsoluteElevation)` Sets the parent absolute elevation, which is used to render elevation overlays. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setScale(float)(float scale)` Set the scale of the rendered path. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowBitmapDrawingEnable(boolean)(boolean enable)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowColor(int)(int shadowColor)` Set the color of fake shadow rendered behind the shape. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowCompatRotation(int)(int shadowRotation)` Set the rotation offset applied to the fake shadow which is drawn when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowCompatibilityMode(int)( @https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable.CompatibilityShadowMode int mode )` Set the shadow compatibility mode. |
| `void` | `[setShadowElevation](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowElevation(int))(int shadowElevation)` **This method is deprecated.** use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setElevation(float)` instead. <br /> |
| `void` | `[setShadowEnabled](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowEnabled(boolean))(boolean shadowEnabled)` **This method is deprecated.** use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowCompatibilityMode(int)` instead. <br /> |
| `void` | `[setShadowRadius](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowRadius(int))(int shadowRadius)` **This method is deprecated.** use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setElevation(float)` instead. <br /> |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)(https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel shapeAppearanceModel)` Set the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` containing the path that will be rendered in this drawable. |
| `void` | `[setShapedViewModel](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShapedViewModel(com.google.android.material.shape.ShapePathModel))(https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel shapedViewModel)` **This method is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)` instead. <br /> |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setStroke(float,ColorStateList)(float strokeWidth, ColorStateList strokeColor)` Set the shape's stroke width and stroke color using a ColorStateList. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setStroke(float,int)(float strokeWidth, int strokeColor)` Set the shape's stroke width and stroke color. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setStrokeColor(ColorStateList)(ColorStateList strokeColor)` Set the color used for the stroke. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setStrokeTint(int)(int tintColor)` Set the shape's stroke color. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setStrokeTint(ColorStateList)(ColorStateList tintList)` Set the shape's stroke ColorStateList |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setStrokeWidth(float)(float strokeWidth)` Set the stroke width used by the shape's paint. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setTint(int)(int tintColor)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setTintList(ColorStateList)(ColorStateList tintList)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setTintMode(PorterDuff.Mode)(Mode tintMode)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setTranslationZ(float)(float translationZ)` Sets the translationZ used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setUseTintColorForShadow(boolean)(boolean useTintColorForShadow)` Set whether fake shadow color should match next set tint color. |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setZ(float)(float z)` Sets the visual z position of this view, in pixels. |

| ### Protected methods |
|---|---|
| `int` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#compositeElevationOverlayIfNeeded(int)(int backgroundColor)` |
| `RectF` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getBoundsAsRectF()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#onBoundsChange(Rect)(Rect bounds)` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#onStateChange(int[])(int[] state)` |

## Constants

### SHADOW_COMPAT_MODE_ALWAYS

```
public static final int SHADOW_COMPAT_MODE_ALWAYS = 2
```

Always draw fake shadows, never draw native elevation shadows. If a path could be concave, this will prevent the shadow from suddenly being rendered natively.

### SHADOW_COMPAT_MODE_DEFAULT

```
public static final int SHADOW_COMPAT_MODE_DEFAULT = 0
```

Try to draw native elevation shadows if possible, otherwise use fake shadows. This is best for paths which will always be convex. If the path might change to be concave, you should consider using `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#SHADOW_COMPAT_MODE_ALWAYS()` otherwise the shadows could suddenly switch from native to fake in the middle of an animation.

### SHADOW_COMPAT_MODE_NEVER

```
public static final int SHADOW_COMPAT_MODE_NEVER = 1
```

Never draw fake shadows. You may want to enable this if backwards compatibility for shadows isn't as important as performance. Native shadow elevation shadows will still be drawn if possible.

## Public fields

### resolvedTintColor

```
public int resolvedTintColor
```

### transparentRegion

```
public final Region transparentRegion
```

## Public constructors

### MaterialShapeDrawable

```
public MaterialShapeDrawable()
```

### MaterialShapeDrawable

```
public MaterialShapeDrawable(ShapeAppearanceModel shapeAppearanceModel)
```

### MaterialShapeDrawable

```
public [MaterialShapeDrawable](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#MaterialShapeDrawable(com.google.android.material.shape.ShapePathModel))(ShapePathModel shapePathModel)
```

### MaterialShapeDrawable

```
public MaterialShapeDrawable(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)
```

## Public methods

### createWithElevationOverlay

```
public static MaterialShapeDrawable createWithElevationOverlay(Context context)
```

Returns a `MaterialShapeDrawable` with the elevation overlay functionality initialized, a fill color of `colorSurface`, and an elevation of 0.

See `https://developer.android.com/reference/com/google/android/material/elevation/ElevationOverlayProvider#compositeOverlayIfNeeded(int,float)` for information on when the overlay will be active.

### createWithElevationOverlay

```
public static MaterialShapeDrawable createWithElevationOverlay(Context context, float elevation)
```

Returns a `MaterialShapeDrawable` with the elevation overlay functionality initialized, a fill color of `colorSurface`, and an elevation of `elevation`.

See `https://developer.android.com/reference/com/google/android/material/elevation/ElevationOverlayProvider#compositeOverlayIfNeeded(int,float)` for information on when the overlay will be active.

### createWithElevationOverlay

```
public static MaterialShapeDrawable createWithElevationOverlay(
    Context context,
    float elevation,
    ColorStateList backgroundTint
)
```

Returns a `MaterialShapeDrawable` with the elevation overlay functionality initialized, a fill color of `backgroundTint`, and an elevation of `elevation`. When `
backgroundTint` is `null`, `colorSurface` will be used as default.

See `https://developer.android.com/reference/com/google/android/material/elevation/ElevationOverlayProvider#compositeOverlayIfNeeded(int,float)` for information on when the overlay will be active.

### draw

```
public void draw(Canvas canvas)
```

### getAlpha

```
public int getAlpha()
```

### getBottomLeftCornerResolvedSize

```
public float getBottomLeftCornerResolvedSize()
```

Returns the actual size of the bottom left corner for the current bounds.

### getBottomRightCornerResolvedSize

```
public float getBottomRightCornerResolvedSize()
```

Returns the actual size of the bottom right corner for the current bounds.

### getConstantState

```
public ConstantState getConstantState()
```

### getElevation

```
public float getElevation()
```

Returns the elevation used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. This value is the same as the native elevation that would be used to render shadows on API 21 and up.

### getFillColor

```
public ColorStateList getFillColor()
```

Get the color used for the fill.

| Returns |
|---|---|
| `ColorStateList` | the color set on the Paint object responsible for the fill. |

### getInterpolation

```
public float getInterpolation()
```

Get the interpolation of the path, between 0 and 1. Ranges between 0 (none) and 1 (fully) interpolated.

| Returns |
|---|---|
| `float` | the interpolation of the path. |

### getOpacity

```
public int getOpacity()
```

### getOutline

```
public void getOutline(Outline outline)
```

### getPadding

```
public boolean getPadding(Rect padding)
```

### getPaintStyle

```
public Style getPaintStyle()
```

Get the current style used by the shape's paint.

| Returns |
|---|---|
| `Style` | current used paint style. |

### getParentAbsoluteElevation

```
public float getParentAbsoluteElevation()
```

Returns the parent absolute elevation.

### getPathForSize

```
public void [getPathForSize](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getPathForSize(int,int,Path))(int width, int height, Path path)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> see `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearancePathProvider`

### getResolvedTintColor

```
public int getResolvedTintColor()
```

Get the tint color factoring in any other runtime modifications such as elevation overlays.

### getScale

```
public float getScale()
```

Get the scale of the rendered path. A value of 1 renders it at 100% size.

| Returns |
|---|---|
| `float` | the scale of the path. |

### getShadowCompatRotation

```
public int getShadowCompatRotation()
```

Returns the rotation offset applied to the fake shadow which is drawn when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true.

### getShadowCompatibilityMode

```
@MaterialShapeDrawable.CompatibilityShadowMode
public int getShadowCompatibilityMode()
```

### getShadowElevation

```
public int [getShadowElevation](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowElevation())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getElevation()` instead.

Get the shadow elevation rendered by the path.

### getShadowOffsetX

```
public int getShadowOffsetX()
```

Returns the X offset of the shadow from the bounds of the shape.

### getShadowOffsetY

```
public int getShadowOffsetY()
```

Returns the Y offset of the shadow from the bounds of the shape.

### getShadowRadius

```
public int getShadowRadius()
```

Get the shadow radius rendered by the path in pixels. This method should be used only when the actual size of the shadow is required. Usually `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getElevation()` should be used instead to get the actual elevation of this view as it might be different.

### getShapeAppearanceModel

```
public ShapeAppearanceModel getShapeAppearanceModel()
```

Get the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` containing the path that will be rendered in this drawable.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | the current model. |

### getShapedViewModel

```
public ShapePathModel [getShapedViewModel](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShapedViewModel())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShapeAppearanceModel()` instead.

Get the `https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel` containing the path that will be rendered in this drawable.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel` | the current model. |

### getStrokeColor

```
public ColorStateList getStrokeColor()
```

Get the color used for the stroke.

| Returns |
|---|---|
| `ColorStateList` | the color set on the Paint object responsible for the stroke. |

### getStrokeTintList

```
public ColorStateList getStrokeTintList()
```

Get the stroke's current ColorStateList.

| Returns |
|---|---|
| `ColorStateList` | the stroke's current ColorStateList. |

### getStrokeWidth

```
public float getStrokeWidth()
```

Get the stroke width used by the shape's paint.

| Returns |
|---|---|
| `float` | the stroke's current width. |

### getTintList

```
public ColorStateList getTintList()
```

Get the tint list used by the shape's paint.

### getTopLeftCornerResolvedSize

```
public float getTopLeftCornerResolvedSize()
```

Returns the actual size of the top left corner for the current bounds.

### getTopRightCornerResolvedSize

```
public float getTopRightCornerResolvedSize()
```

Returns the actual size of the top right corner for the current bounds.

### getTranslationZ

```
public float getTranslationZ()
```

Returns the translationZ used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. This value is the same as the native translationZ that would be used to render shadows on API 21 and up.

### getTransparentRegion

```
public Region getTransparentRegion()
```

### getZ

```
public float getZ()
```

Returns the visual z position of this drawable, in pixels. This is equivalent to the `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getTranslationZ()` property plus the current `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getElevation()` property.

### initializeElevationOverlay

```
public void initializeElevationOverlay(Context context)
```

Initializes the elevation overlay functionality for this drawable.

See `https://developer.android.com/reference/com/google/android/material/elevation/ElevationOverlayProvider#compositeOverlayIfNeeded(int,float)` for information on when the overlay will be active.

### invalidateSelf

```
public void invalidateSelf()
```

### isElevationOverlayEnabled

```
public boolean isElevationOverlayEnabled()
```

Returns whether the elevation overlay functionality is initialized and enabled in this drawable's theme context.

### isElevationOverlayInitialized

```
public boolean isElevationOverlayInitialized()
```

Returns whether the elevation overlay functionality has been initialized for this drawable.

### isPointInTransparentRegion

```
public boolean isPointInTransparentRegion(int x, int y)
```

Determines whether a point is contained within the transparent region of the Drawable. A return value of true generally suggests that the touched view should not process a touch event at that point.

| Parameters |
|---|---|
| `int x` | The X coordinate of the point. |
| `int y` | The Y coordinate of the point. |

| Returns |
|---|---|
| `boolean` | true iff the point is contained in the transparent region of the Drawable. |

### isShadowEnabled

```
public boolean [isShadowEnabled](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#isShadowEnabled())()
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getShadowCompatibilityMode()` instead

Get shadow rendering status for shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true.

| Returns |
|---|---|
| `boolean` | true if fake shadows should be drawn, false otherwise. |

### isStateful

```
public boolean isStateful()
```

### mutate

```
public Drawable mutate()
```

### requiresCompatShadow

```
public boolean requiresCompatShadow()
```

Returns true if compat shadows should be drawn. Native elevation shadows can't be drawn for concave paths on API \<29.

### setAlpha

```
public void setAlpha(int alpha)
```

### setColorFilter

```
public void setColorFilter(ColorFilter colorFilter)
```

### setCornerSize

```
public void setCornerSize(CornerSize cornerSize)
```

Updates the corners for the given `https://developer.android.com/reference/com/google/android/material/shape/CornerSize`.

### setCornerSize

```
public void setCornerSize(float cornerSize)
```

Updates the corners for the given `https://developer.android.com/reference/com/google/android/material/shape/CornerSize`.

### setEdgeIntersectionCheckEnable

```
public void setEdgeIntersectionCheckEnable(boolean enable)
```

### setElevation

```
public void setElevation(float elevation)
```

Sets the elevation used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. This value is the same as the native elevation that would be used to render shadows on API 21 and up.

### setFillColor

```
public void setFillColor(ColorStateList fillColor)
```

Set the color used for the fill.

| Parameters |
|---|---|
| `ColorStateList fillColor` | the color set on the Paint object responsible for the fill. |

### setInterpolation

```
public void setInterpolation(float interpolation)
```

Set the interpolation of the path, between 0 and 1. Ranges between 0 (none) and 1 (fully) interpolated. An interpolation of 1 generally indicates a fully rendered path, while an interpolation of 0 generally indicates a fully healed path, which is usually a rectangle.

| Parameters |
|---|---|
| `float interpolation` | the desired interpolation. |

### setPadding

```
public void setPadding(int left, int top, int right, int bottom)
```

Configure the padding of the shape

| Parameters |
|---|---|
| `int left` | Left padding of the shape |
| `int top` | Top padding of the shape |
| `int right` | Right padding of the shape |
| `int bottom` | Bottom padding of the shape |

### setPaintStyle

```
public void setPaintStyle(Style paintStyle)
```

Set the style used by the shape's paint.

| Parameters |
|---|---|
| `Style paintStyle` | the desired style. |

### setParentAbsoluteElevation

```
public void setParentAbsoluteElevation(float parentAbsoluteElevation)
```

Sets the parent absolute elevation, which is used to render elevation overlays.

### setScale

```
public void setScale(float scale)
```

Set the scale of the rendered path. A value of 1 renders it at 100% size.

| Parameters |
|---|---|
| `float scale` | the desired scale. |

### setShadowBitmapDrawingEnable

```
public void setShadowBitmapDrawingEnable(boolean enable)
```

### setShadowColor

```
public void setShadowColor(int shadowColor)
```

Set the color of fake shadow rendered behind the shape. This will only be drawn when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true, otherwise native elevation shadows will be drawn which don't support colored shadows.

Setting a shadow color will prevent the tint color from being used.

| Parameters |
|---|---|
| `int shadowColor` | desired color. |

### setShadowCompatRotation

```
public void setShadowCompatRotation(int shadowRotation)
```

Set the rotation offset applied to the fake shadow which is drawn when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true. 0 degrees will draw the shadow below the shape.

This allows for the Drawable to be wrapped in a android.graphics.drawable.RotateDrawable, or rotated in a view while still having the fake shadow to appear to be drawn from the bottom.

### setShadowCompatibilityMode

```
public void setShadowCompatibilityMode(
    @MaterialShapeDrawable.CompatibilityShadowMode int mode
)
```

Set the shadow compatibility mode. This allows control over when fake shadows should drawn instead of native elevation shadows.

Note: To prevent clipping of fake shadow for views on API levels above lollipop, the parent view must disable clipping of children by calling setClipChildren, or by setting \`android:clipChildren="false"\` in xml. \`clipToPadding\` may also need to be false if there is any padding on the parent that could intersect the shadow.

### setShadowElevation

```
public void [setShadowElevation](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowElevation(int))(int shadowElevation)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setElevation(float)` instead.

Set the shadow elevation rendered by the path.

| Parameters |
|---|---|
| `int shadowElevation` | the desired elevation. |

### setShadowEnabled

```
public void [setShadowEnabled](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowEnabled(boolean))(boolean shadowEnabled)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowCompatibilityMode(int)` instead.

Set shadow rendering to be enabled or disabled when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true. Setting this to false could provide some performance benefits on older devices if you don't mind no shadows being drawn.

Note: native elevation shadows will still be drawn on API 21 and up if the shape is convex and the view with this background has elevation.

| Parameters |
|---|---|
| `boolean shadowEnabled` | true if fake shadows should be drawn; false if not. |

### setShadowRadius

```
public void [setShadowRadius](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShadowRadius(int))(int shadowRadius)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setElevation(float)` instead.

Set the shadow radius rendered by the path.

| Parameters |
|---|---|
| `int shadowRadius` | the desired shadow radius. |

### setShapeAppearanceModel

```
public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel)
```

Set the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` containing the path that will be rendered in this drawable.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel shapeAppearanceModel` | the desired model. |

### setShapedViewModel

```
public void [setShapedViewModel](https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShapedViewModel(com.google.android.material.shape.ShapePathModel))(ShapePathModel shapedViewModel)
```

> [!CAUTION]
> **This method is deprecated.**   
>
> Use `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)` instead.

Set the `https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel` containing the path that will be rendered in this drawable.

| Parameters |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel shapedViewModel` | the desired model. |

### setStroke

```
public void setStroke(float strokeWidth, ColorStateList strokeColor)
```

Set the shape's stroke width and stroke color using a ColorStateList.

| Parameters |
|---|---|
| `float strokeWidth` | a float for the width of the stroke. |
| `ColorStateList strokeColor` | the ColorStateList for the shape's stroke. |

### setStroke

```
public void setStroke(float strokeWidth, int strokeColor)
```

Set the shape's stroke width and stroke color.

| Parameters |
|---|---|
| `float strokeWidth` | a float for the width of the stroke. |
| `int strokeColor` | an int representing the Color to use for the shape's stroke. |

### setStrokeColor

```
public void setStrokeColor(ColorStateList strokeColor)
```

Set the color used for the stroke.

| Parameters |
|---|---|
| `ColorStateList strokeColor` | the color set on the Paint object responsible for the stroke. |

### setStrokeTint

```
public void setStrokeTint(int tintColor)
```

Set the shape's stroke color.

| Parameters |
|---|---|
| `int tintColor` | an int representing the Color to use for the shape's stroke. |

### setStrokeTint

```
public void setStrokeTint(ColorStateList tintList)
```

Set the shape's stroke ColorStateList

| Parameters |
|---|---|
| `ColorStateList tintList` | the ColorStateList for the shape's stroke. |

### setStrokeWidth

```
public void setStrokeWidth(float strokeWidth)
```

Set the stroke width used by the shape's paint.

| Parameters |
|---|---|
| `float strokeWidth` | desired stroke width. |

### setTint

```
public void setTint(int tintColor)
```

### setTintList

```
public void setTintList(ColorStateList tintList)
```

### setTintMode

```
public void setTintMode(Mode tintMode)
```

### setTranslationZ

```
public void setTranslationZ(float translationZ)
```

Sets the translationZ used to render both fake shadows when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true and elevation overlays. This value is the same as the native translationZ that would be used to render shadows on API 21 and up.

### setUseTintColorForShadow

```
public void setUseTintColorForShadow(boolean useTintColorForShadow)
```

Set whether fake shadow color should match next set tint color. This will only be drawn when `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#requiresCompatShadow()` is true, otherwise native elevation shadows will be drawn which don't support colored shadows.

| Parameters |
|---|---|
| `boolean useTintColorForShadow` | true if color should match; false otherwise. |

### setZ

```
public void setZ(float z)
```

Sets the visual z position of this view, in pixels. This is equivalent to setting the `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setTranslationZ(float)` property to be the difference between the z value passed in and the current `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#getElevation()` property.

## Protected methods

### compositeElevationOverlayIfNeeded

```
protected int compositeElevationOverlayIfNeeded(int backgroundColor)
```

### getBoundsAsRectF

```
protected RectF getBoundsAsRectF()
```

### onBoundsChange

```
protected void onBoundsChange(Rect bounds)
```

### onStateChange

```
protected boolean onStateChange(int[] state)
```