Module rsvg::property_defs

source ·
Expand description

Definitions for CSS property types.

Do not import things directly from this module; use the properties module instead, which re-exports things from here.

This module defines most of the CSS property types that librsvg supports. Each property requires a Rust type that will hold its values, and that type should implement a few traits, as follows.

Requirements for a property type

You should call the make_property macro to take care of most of these requirements automatically:

  • A name for the type. For example, the fill property has a Fill type defined in this module.

  • An initial value per the CSS or SVG specs, given through an implementation of the Default trait.

  • Whether the property’s computed value inherits to child elements, given through an implementation of the Property trait and its inherits_automatically method.

  • A way to derive the CSS computed value for the property, given through an implementation of the Property trait and its compute method.

  • The actual underlying type. For example, the make_property macro can generate a field-less enum for properties like the clip-rule property, which just has identifier-based values like nonzero and evenodd. For general-purpose types like Length, the macro can wrap them in a newtype like struct StrokeWidth(Length). For custom types, the macro call can be used just to define the initial/default value and whether the property inherits automatically; you should provide the other required trait implementations separately.

  • An implementation of the Parse trait for the underlying type.

Structs

baseline-shift property.
cx property.
cy attribute.
clip-path property.
color property, the fallback for currentColor values.
fill property.
fill-opacity property.
flood-color property, for feFlood and feDropShadow filter elements.
flood-opacity property, for feFlood and feDropShadow filter elements.
height property.
lighting-color property for feDiffuseLighting and feSpecularLighting filter elements.
marker shorthand property.
marker-end property.
marker-mid property.
marker-start property.
mask shorthand property.
opacity property.
paint-order property.
r property.
rx property.
ry property.
stop-color property for gradient stops.
stop-opacity property for gradient stops.
stroke property.
stroke-dasharray property.
stroke-dashoffset property.
stroke-miterlimit property.
stroke-opacity property.
stroke-width property.
text-decoration shorthand property.
transform property.
width property.
x property.
xml:lang attribute.
y property.

Enums

clip-rule property.
color-interpolation-filters property.
direction property.
display property.
enable-background property.
fill-rule property.
filter property.
font-stretch property.
font-style property.
font-variant property.
isolation property.
mask-type property.
mix-blend-mode property.
overflow shorthand property.
One of the three operations for the paint-order property; see PaintOrder.
shape-rendering property.
stroke-linecap property.
stroke-linejoin property.
text-anchor property.
text-orientation property.
text-rendering property.
unicode-bidi property.
vector-effect property.
visibility property.
writing-mode property.
xml:space attribute.