Implement svg::Handle::from_memory
Useful if you already have your SVG data in memory.
This commit is contained in:
parent
6e9ab1cd6f
commit
ae009158cc
4 changed files with 76 additions and 28 deletions
|
|
@ -7,4 +7,3 @@ publish = false
|
|||
|
||||
[dependencies]
|
||||
iced = { path = "../..", features = ["svg"] }
|
||||
env_logger = "0.7"
|
||||
|
|
|
|||
|
|
@ -1,19 +1,16 @@
|
|||
use iced::{Column, Container, Element, Length, Sandbox, Settings, Svg};
|
||||
|
||||
pub fn main() {
|
||||
env_logger::init();
|
||||
|
||||
Tiger::run(Settings::default())
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Tiger;
|
||||
|
||||
impl Sandbox for Tiger {
|
||||
type Message = ();
|
||||
|
||||
fn new() -> Self {
|
||||
Self::default()
|
||||
Tiger
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
|
|
@ -24,7 +21,7 @@ impl Sandbox for Tiger {
|
|||
|
||||
fn view(&mut self) -> Element<()> {
|
||||
let content = Column::new().padding(20).push(
|
||||
Svg::new(format!(
|
||||
Svg::from_path(format!(
|
||||
"{}/resources/tiger.svg",
|
||||
env!("CARGO_MANIFEST_DIR")
|
||||
))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue