Implement Canvas support for iced_tiny_skia
This commit is contained in:
parent
3f6e28fa9b
commit
5fd5d1cdf8
65 changed files with 1354 additions and 570 deletions
|
|
@ -4,8 +4,8 @@ use iced::widget::canvas::{
|
|||
};
|
||||
use iced::widget::{canvas, container};
|
||||
use iced::{
|
||||
Application, Color, Command, Element, Length, Point, Rectangle, Settings,
|
||||
Subscription, Theme, Vector,
|
||||
Application, Color, Command, Element, Length, Point, Rectangle, Renderer,
|
||||
Settings, Subscription, Theme, Vector,
|
||||
};
|
||||
|
||||
pub fn main() -> iced::Result {
|
||||
|
|
@ -83,17 +83,18 @@ impl Application for Clock {
|
|||
}
|
||||
}
|
||||
|
||||
impl<Message> canvas::Program<Message> for Clock {
|
||||
impl<Message> canvas::Program<Message, Renderer> for Clock {
|
||||
type State = ();
|
||||
|
||||
fn draw(
|
||||
&self,
|
||||
_state: &Self::State,
|
||||
renderer: &Renderer,
|
||||
_theme: &Theme,
|
||||
bounds: Rectangle,
|
||||
_cursor: Cursor,
|
||||
) -> Vec<Geometry> {
|
||||
let clock = self.clock.draw(bounds.size(), |frame| {
|
||||
let clock = self.clock.draw(renderer, bounds.size(), |frame| {
|
||||
let center = frame.center();
|
||||
let radius = frame.width().min(frame.height()) / 2.0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue