pub enum PaintServer {
None,
Iri {
iri: Box<NodeId>,
alternate: Option<Color>,
},
SolidColor(Color),
ContextFill,
ContextStroke,
}Expand description
Unresolved SVG paint server straight from the DOM data.
This is either a solid color (which if currentColor needs to be extracted from the
ComputedValues), or a paint server like a gradient or pattern which is referenced by
a URL that points to a certain document node.
Use PaintServer.resolve to turn this into a PaintSource.
Variants§
None
For example, fill="none".
Iri
For example, fill="url(#some_gradient) fallback_color".
SolidColor(Color)
For example, fill="blue".
ContextFill
For example, fill="context-fill"
ContextStroke
For example, fill="context-stroke"
Implementations§
Source§impl PaintServer
impl PaintServer
Sourcepub fn resolve(
&self,
acquired_nodes: &mut AcquiredNodes<'_>,
referencing_element_name: &str,
opacity: UnitInterval,
current_color: Color,
context_fill: Option<Rc<PaintSource>>,
context_stroke: Option<Rc<PaintSource>>,
session: &Session,
) -> Rc<PaintSource>
pub fn resolve( &self, acquired_nodes: &mut AcquiredNodes<'_>, referencing_element_name: &str, opacity: UnitInterval, current_color: Color, context_fill: Option<Rc<PaintSource>>, context_stroke: Option<Rc<PaintSource>>, session: &Session, ) -> Rc<PaintSource>
Resolves colors, plus node references for gradients and patterns.
opacity depends on strokeOpacity or fillOpacity depending on whether
the paint server is for the stroke or fill properties.
current_color should be the value of ComputedValues.color().
After a paint server is resolved, the resulting PaintSource can be used in
many places: for an actual shape, or for the context-fill of a marker for that
shape. Therefore, this returns an Rc so that the PaintSource may be shared
easily.
Trait Implementations§
Source§impl Clone for PaintServer
impl Clone for PaintServer
Source§fn clone(&self) -> PaintServer
fn clone(&self) -> PaintServer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaintServer
impl Debug for PaintServer
Source§impl Parse for PaintServer
impl Parse for PaintServer
Source§fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<PaintServer, ParseError<'i>>
fn parse<'i>(parser: &mut Parser<'i, '_>) -> Result<PaintServer, ParseError<'i>>
parser. Read moreSource§impl PartialEq for PaintServer
impl PartialEq for PaintServer
impl StructuralPartialEq for PaintServer
Auto Trait Implementations§
impl Freeze for PaintServer
impl RefUnwindSafe for PaintServer
impl Send for PaintServer
impl Sync for PaintServer
impl Unpin for PaintServer
impl UnwindSafe for PaintServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.