One background-image layer. More...
#include <view.hpp>
Public Types | |
| enum class | LinearFrom { endpoints , angle , corner } |
| Where a linear gradient's endpoints come from. More... | |
| enum class | RepeatUnit { px , line_fraction } |
| What linear_repeat is measured in. More... | |
| enum class | RadialSize { max_side , farthest_corner , farthest_side , closest_corner , closest_side , explicit_radii } |
| How a radial gradient's radii are sized, per css-images-3. More... | |
Public Attributes | |
| int | type = 0 |
| std::size_t | css_image_layer_index = 0 |
| float | x0 = 0 |
| float | y0 = 0 |
| float | x1 = 0 |
| float | y1 = 1 |
| float | radius = 0.7071f |
| float | angle = 0.0f |
| float | sweep_turns = 1.0f |
| std::vector< Color > | colors |
| std::vector< float > | positions |
| LinearFrom | linear_from = LinearFrom::endpoints |
| float | linear_angle = 0.0f |
| CSS angle in radians, clockwise from "to top". | |
| float | corner_x = 1.0f |
| Signs of the named corner for LinearFrom::corner: x is +1 for right, -1 for left; y is +1 for bottom, -1 for top. | |
| float | corner_y = 1.0f |
| float | linear_repeat = 0.0f |
| The band a repeating-linear-gradient tiles; 0 when the gradient does not repeat. | |
| RepeatUnit | linear_repeat_unit = RepeatUnit::px |
| bool | positions_in_px = false |
| True when positions still hold raw px LENGTHS rather than 0..1 parameters, because every stop named one. | |
| RadialSize | radial_size = RadialSize::max_side |
| bool | radial_circle = false |
| A circle has one radius resolved against the box's diagonal-ish metric; an ellipse gets a separate radius per axis. | |
| float | radial_rx = 0.0f |
| RadialSize::explicit_radii: radii as fractions of width and height, plus an absolute term. | |
| float | radial_ry = 0.0f |
| float | radial_rx_px = 0.0f |
| float | radial_ry_px = 0.0f |
| canvas::GradientInterpolation | interpolation |
| CSS in <space> [<hue> hue]. | |
One background-image layer.
CSS background-image takes a comma-separated LIST and paints the FIRST entry on top, so a view holds a stack of these rather than a single gradient. The single-gradient setters below replace the whole stack with one layer, which is what every caller that predates layering wants.
|
strong |
|
strong |
How a radial gradient's radii are sized, per css-images-3.
max_side is not a CSS keyword — it is the pre-existing radius x max(w,h) circle the explicit setter has always meant, kept so those callers are unaffected.
| Enumerator | |
|---|---|
| max_side | |
| farthest_corner | |
| farthest_side | |
| closest_corner | |
| closest_side | |
| explicit_radii | |
|
strong |
What linear_repeat is measured in.
CSS lets the band be a length (... 1px, 7px — 7 CSS px per tile whatever the box) or a fraction of the gradient line (... 0%, 10%), and the line's length is a function of the laid-out box, so the choice cannot be collapsed before paint.
| Enumerator | |
|---|---|
| px | |
| line_fraction | |
| float pulp::view::View::BackgroundGradient::angle = 0.0f |
| std::vector<Color> pulp::view::View::BackgroundGradient::colors |
| float pulp::view::View::BackgroundGradient::corner_x = 1.0f |
Signs of the named corner for LinearFrom::corner: x is +1 for right, -1 for left; y is +1 for bottom, -1 for top.
| float pulp::view::View::BackgroundGradient::corner_y = 1.0f |
| std::size_t pulp::view::View::BackgroundGradient::css_image_layer_index = 0 |
| canvas::GradientInterpolation pulp::view::View::BackgroundGradient::interpolation |
CSS in <space> [<hue> hue].
| float pulp::view::View::BackgroundGradient::linear_angle = 0.0f |
CSS angle in radians, clockwise from "to top".
Valid for LinearFrom::angle.
| LinearFrom pulp::view::View::BackgroundGradient::linear_from = LinearFrom::endpoints |
| float pulp::view::View::BackgroundGradient::linear_repeat = 0.0f |
The band a repeating-linear-gradient tiles; 0 when the gradient does not repeat.
positions are rescaled ONTO this band — 0..1 across one tile — exactly as a repeating conic's are onto its sweep, so the painter only has to place the band and let the shader tile it.
| RepeatUnit pulp::view::View::BackgroundGradient::linear_repeat_unit = RepeatUnit::px |
| std::vector<float> pulp::view::View::BackgroundGradient::positions |
| bool pulp::view::View::BackgroundGradient::positions_in_px = false |
True when positions still hold raw px LENGTHS rather than 0..1 parameters, because every stop named one.
The divisor is the gradient line (linear) or horizontal radius (radial), each a function of the laid-out box — and of the background-size TILE when the layer is tiled — so the division belongs at paint.
linear-gradient(<colour> 1px, transparent 1px) under background-size: 100% 32px is a scanline every 32px. Read as parameters instead, both stops land at 1.0 — the far end of the ramp — and the layer paints its first colour over the WHOLE box. That is a monotone wash, and it reads as a missing tile rather than as a misread stop, which is why the two halves have to land together.
| bool pulp::view::View::BackgroundGradient::radial_circle = false |
A circle has one radius resolved against the box's diagonal-ish metric; an ellipse gets a separate radius per axis.
CSS defaults to ellipse unless circle is named or a single length is given.
| float pulp::view::View::BackgroundGradient::radial_rx = 0.0f |
RadialSize::explicit_radii: radii as fractions of width and height, plus an absolute term.
A % radius fills the fraction slot and a px radius the absolute one, so both spellings — and a calc() that mixes them — resolve through one expression.
| float pulp::view::View::BackgroundGradient::radial_rx_px = 0.0f |
| float pulp::view::View::BackgroundGradient::radial_ry = 0.0f |
| float pulp::view::View::BackgroundGradient::radial_ry_px = 0.0f |
| RadialSize pulp::view::View::BackgroundGradient::radial_size = RadialSize::max_side |
| float pulp::view::View::BackgroundGradient::radius = 0.7071f |
| float pulp::view::View::BackgroundGradient::sweep_turns = 1.0f |
| int pulp::view::View::BackgroundGradient::type = 0 |
| float pulp::view::View::BackgroundGradient::x0 = 0 |
| float pulp::view::View::BackgroundGradient::x1 = 0 |
| float pulp::view::View::BackgroundGradient::y0 = 0 |
| float pulp::view::View::BackgroundGradient::y1 = 1 |