summaryrefslogtreecommitdiffstats
path: root/examples/svg/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/svg/src/main.rs')
-rw-r--r--examples/svg/src/main.rs37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/svg/src/main.rs b/examples/svg/src/main.rs
new file mode 100644
index 00000000..57358e24
--- /dev/null
+++ b/examples/svg/src/main.rs
@@ -0,0 +1,37 @@
+use iced::{Column, Container, Element, Length, Sandbox, Settings, Svg};
+
+pub fn main() {
+ Tiger::run(Settings::default())
+}
+
+#[derive(Default)]
+struct Tiger;
+
+impl Sandbox for Tiger {
+ type Message = ();
+
+ fn new() -> Self {
+ Self::default()
+ }
+
+ fn title(&self) -> String {
+ String::from("SVG - Iced")
+ }
+
+ fn update(&mut self, _message: ()) {}
+
+ fn view(&mut self) -> Element<()> {
+ let content = Column::new().padding(20).push(
+ Svg::new(format!("{}/tiger.svg", env!("CARGO_MANIFEST_DIR")))
+ .width(Length::Fill)
+ .height(Length::Fill),
+ );
+
+ Container::new(content)
+ .width(Length::Fill)
+ .height(Length::Fill)
+ .center_x()
+ .center_y()
+ .into()
+ }
+}