RFR: 8332895: Support interpolation for backgrounds and borders [v2]
Michael Strauß
mstrauss at openjdk.org
Tue Jun 4 16:31:49 UTC 2024
> This PR completes the CSS Transitions story (see #870) by adding interpolation support for backgrounds and borders, making them targetable by transitions.
>
> `Background` and `Border` objects are deeply immutable, but not interpolatable. Consider the following `Background`, which describes the background of a `Region`:
>
>
> Background {
> fills = [
> BackgroundFill {
> fill = Color.RED
> }
> ]
> }
>
>
> Since backgrounds are deeply immutable, changing the region's background to another color requires the construction of a new `Background`, containing a new `BackgroundFill`, containing the new `Color`.
>
> Animating the background color using a CSS transition therefore requires the entire Background object graph to be interpolatable in order to generate intermediate backgrounds.
>
> More specifically, the following types will now implement `Interpolatable`.
>
> - `Insets`
> - `Background`
> - `BackgroundFill`
> - `BackgroundImage`
> - `BackgroundPosition`
> - `BackgroundSize`
> - `Border`
> - `BorderImage`
> - `BorderStroke`
> - `BorderWidths`
> - `CornerRadii`
> - `ImagePattern`
> - `LinearGradient`
> - `RadialGradient`
> - `Stop`
>
> Note that this PR also changes the specification of `Interpolatable` to make users aware that they shouldn't assume any particular identity of the object returned from the `interpolate()` method. This allows the implementation to re-use objects and reduce the number of object allocations.
Michael Strauß has updated the pull request incrementally with two additional commits since the last revision:
- clean up imports
- add since tags
-------------
Changes:
- all: https://git.openjdk.org/jfx/pull/1471/files
- new: https://git.openjdk.org/jfx/pull/1471/files/25bcb1df..bb84c57d
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jfx&pr=1471&range=01
- incr: https://webrevs.openjdk.org/?repo=jfx&pr=1471&range=00-01
Stats: 87 lines in 16 files changed: 79 ins; 7 del; 1 mod
Patch: https://git.openjdk.org/jfx/pull/1471.diff
Fetch: git fetch https://git.openjdk.org/jfx.git pull/1471/head:pull/1471
PR: https://git.openjdk.org/jfx/pull/1471
More information about the openjfx-dev
mailing list