Enum rsvg::paint_server::PaintServer
source · 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<'_>,
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<'_>, 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
source§fn eq(&self, other: &PaintServer) -> bool
fn eq(&self, other: &PaintServer) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for PaintServer
Auto Trait Implementations§
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> 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.