/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[cfg_attr(feature = "capture", derive(Serialize))] #[cfg_attr(feature = "replay", derive(Deserialize))] #[derive(MallocSizeOf)] pubstruct ConicGradientTemplate { pub common: PrimTemplateCommonData, pub extend_mode: ExtendMode, pub center: LayoutPoint, pub params: ConicGradientParams, /// Per-axis fraction of `common.prim_size` covered by one tile of the /// gradient pattern. Multiply by `common.prim_size` at use to recover the /// absolute stretch_size. pub stretch_ratio: LayoutSize, pub tile_spacing: LayoutSize, pub border_nine_patch: Option<Box<NinePatchDescriptor>>, pub stops_opacity: PrimitiveOpacity, pub stops: Vec<GradientStop>,
}
impl PatternBuilder for ConicGradientTemplate { fn build(
&self,
_sub_rect: Option<DeviceRect>,
offset: LayoutVector2D,
ctx: &PatternBuilderContext,
state: &mut PatternBuilderState,
) -> Pattern { // The scaling parameter is used to compensate for when we reduce the size // of the render task for cached gradients. Here we aren't applying any. let no_scale = DeviceVector2D::one();
// ConicGradientTemplate stores the center point relative to the primitive // origin, but the shader works with start/end points in "proper" layout // coordinates (relative to the primitive's spatial node). let center = self.center + ctx.prim_origin.to_vector() + offset;
impl From<ConicGradientKey> for ConicGradientTemplate { fn from(item: ConicGradientKey) -> Self { let common = PrimTemplateCommonData::with_key_common(item.common);
let (stops, min_alpha) = stops_and_min_alpha(&item.stops);
// Save opacity of the stops for use in // selecting which pass this gradient // should be drawn in. let stops_opacity = PrimitiveOpacity::from_alpha(min_alpha);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.