1pub use denise::{ClipToken, Clipped, Painter, PainterExt, Pen};
4
5use denise::{Color, Mask, PixelFormat, PixelView, Point, Rect, Size};
6
7use crate::blend::Paint;
8use crate::canvas::Canvas;
9
10impl Painter for Canvas<'_> {
11 #[inline]
12 fn size(&self) -> Size {
13 Canvas::size(self)
14 }
15
16 #[inline]
17 fn format(&self) -> PixelFormat {
18 Canvas::format(self)
19 }
20
21 #[inline]
22 fn clip(&self) -> Rect {
23 Canvas::clip(self)
24 }
25
26 fn push_clip(&mut self, rect: Rect) -> ClipToken {
27 let previous = Canvas::clip(self);
28 self.clip_to(rect);
29 ClipToken::restoring(previous)
30 }
31
32 fn pop_clip(&mut self, token: ClipToken) {
33 self.restore_clip(token.previous());
34 }
35
36 fn clear(&mut self, color: Color) {
37 Canvas::clear(self, color);
38 }
39
40 fn fill_rect(&mut self, rect: Rect, paint: Paint) {
41 Canvas::fill_rect(self, rect, paint);
42 }
43
44 fn fill_rounded_rect(&mut self, rect: Rect, radius: i32, paint: Paint) {
45 Canvas::fill_rounded_rect(self, rect, radius, paint);
46 }
47
48 fn stroke_rounded_rect(&mut self, rect: Rect, radius: i32, thickness: i32, paint: Paint) {
49 Canvas::stroke_rounded_rect(self, rect, radius, thickness, paint);
50 }
51
52 fn fill_circle(&mut self, centre: Point, radius: i32, paint: Paint) {
53 Canvas::fill_circle(self, centre, radius, paint);
54 }
55
56 fn stroke_circle(&mut self, centre: Point, radius: i32, thickness: i32, paint: Paint) {
57 Canvas::stroke_circle(self, centre, radius, thickness, paint);
58 }
59
60 fn stroke_arc(
61 &mut self,
62 centre: Point,
63 radius: i32,
64 thickness: i32,
65 start: i32,
66 sweep: i32,
67 paint: Paint,
68 ) {
69 Canvas::stroke_arc(self, centre, radius, thickness, start, sweep, paint);
70 }
71
72 fn draw_line(&mut self, a: Point, b: Point, paint: Paint) {
73 Canvas::draw_line(self, a, b, paint);
74 }
75
76 fn fill_polygon_fx(&mut self, points: &[(i32, i32)], paint: Paint) {
77 Canvas::fill_polygon_fx(self, points, paint);
78 }
79
80 fn blit_mask(&mut self, at: Point, mask: &Mask<'_>, paint: Paint) {
81 Canvas::blit_mask(self, at, mask, paint);
82 }
83
84 fn blit(&mut self, src: &PixelView<'_>, at: Point) {
85 Canvas::blit(self, src, at);
86 }
87
88 fn blit_scaled(&mut self, src: &PixelView<'_>, dest: Rect) {
89 Canvas::blit_scaled(self, src, dest);
90 }
91
92 fn blit_rounded(&mut self, src: &PixelView<'_>, dest: Rect, shape: Rect, radius: i32) {
93 Canvas::blit_rounded(self, src, dest, shape, radius);
94 }
95
96 fn scroll_rows(&mut self, rect: Rect, dy: i32) -> bool {
97 Canvas::scroll_rows(self, rect, dy)
98 }
99
100 }