Type Alias style::values::specified::image::Image

source ·
pub type Image = Image<Gradient, SpecifiedImageUrl, Color, Percentage, Resolution>;
Expand description

Specified values for an image according to CSS-IMAGES. https://drafts.csswg.org/css-images/#image-values

Aliased Type§

enum Image {
    None,
    Url(CssUrl),
    Gradient(Box<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>>),
    PaintWorklet(PaintWorklet),
    CrossFade(Box<GenericCrossFade<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Color, Percentage>>),
    ImageSet(Box<GenericImageSet<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Resolution>>),
}

Variants§

§

None

none variant.

§

Url(CssUrl)

A <url()> image.

§

Gradient(Box<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>>)

A <gradient> image. Gradients are rather large, and not nearly as common as urls, so we box them here to keep the size of this enum sane.

§

PaintWorklet(PaintWorklet)

§

CrossFade(Box<GenericCrossFade<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Color, Percentage>>)

A <cross-fade()> image. Storing this directly inside of GenericImage increases the size by 8 bytes so we box it here and store images directly inside of cross-fade instead of boxing them there.

§

ImageSet(Box<GenericImageSet<GenericImage<GenericGradient<LineDirection, LengthPercentage, NonNegative<Length>, NonNegative<LengthPercentage>, GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>, Angle, AngleOrPercentage, Color>, CssUrl, Color, Percentage, Resolution>, Resolution>>)

An image-set() function.

Implementations§

source§

impl Image

source

fn parse_with_cors_mode<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, cors_mode: CorsMode, flags: ParseImageFlags ) -> Result<Image, ParseError<'i>>

source§

impl Image

source

pub fn for_cascade(url: Arc<Url>) -> Self

Creates an already specified image value from an already resolved URL for insertion in the cascade.

source

pub fn parse_with_cors_anonymous<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't> ) -> Result<Image, ParseError<'i>>

Provides an alternate method for parsing that associates the URL with anonymous CORS headers.

source

pub fn parse_forbid_none<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't> ) -> Result<Image, ParseError<'i>>

Provides an alternate method for parsing, but forbidding none

source

pub fn parse_only_url<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't> ) -> Result<Image, ParseError<'i>>

Provides an alternate method for parsing, but only for urls.

Trait Implementations§

source§

impl Parse for Image

source§

fn parse<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't> ) -> Result<Image, ParseError<'i>>

Parse a value of this type. Read more