mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add a way to convert a FillOrStrokeStyle to a raqote Source
For now most of it unimplemented but it'll allow for some more testing
This commit is contained in:
parent
7005c24e40
commit
cbe385c7d7
1 changed files with 22 additions and 0 deletions
|
@ -398,3 +398,25 @@ impl Clone for Pattern<'_> {
|
|||
unimplemented!();
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ToRaqoteSource<'a> {
|
||||
fn to_raqote_source(self) -> Option<raqote::Source<'a>>;
|
||||
}
|
||||
|
||||
impl<'a> ToRaqoteSource<'a> for FillOrStrokeStyle {
|
||||
fn to_raqote_source(self) -> Option<raqote::Source<'a>> {
|
||||
use canvas_traits::canvas::FillOrStrokeStyle::*;
|
||||
|
||||
match self {
|
||||
Color(rgba) => Some(raqote::Source::Solid(raqote::SolidSource {
|
||||
r: rgba.red,
|
||||
g: rgba.green,
|
||||
b: rgba.blue,
|
||||
a: rgba.alpha,
|
||||
})),
|
||||
LinearGradient(_) => unimplemented!(),
|
||||
RadialGradient(_) => unimplemented!(),
|
||||
Surface(_) => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue