material-components / material-components/material-components-android
[MaterialShapeDrawable] Custom shadows with Paint's `setShadowLayer`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
In my project i use `Paint.setShadowLayer(float radius, float dx, float dy, @ColorInt int shadowColor)` inside my custom Drawable, for custom shadows. I want to switch to `MaterialShapeDrawable`, but i can't configure MaterialShapeDrawable's `Paint` with this custom values.
I think it would be great, if there will be function `MaterialShapeDrawable.setPaintShadowLayer(float radius, float dx, float dy, @ColorInt int shadowColor)' which i can use for custom shadow configuration.
Maybe there is a possibility to select by brute force applicable values with `shadowCompatOffset/shadowCompatRotation/shadowCompatRadius` for my case, but in this case `MaterialShapeDrawable` will use bitmap for shadows.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating MaterialShapeDrawable and reviewing how its Paint and shadowCompatOffset, shadowCompatRotation, and shadowCompatRadius values are applied. Compare that behavior with Paint.setShadowLayer and determine the expected API and rendering behavior. Done means custom radius, offsets, and color can be configured without relying on bitmap shadows, with coverage for the resulting behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100