11//! The CoreGraphics backend for the Piet 2D graphics abstraction.
22
3+ mod text;
4+
35use std:: borrow:: Cow ;
46use std:: sync:: Arc ;
57
@@ -15,9 +17,13 @@ use core_graphics::image::CGImage;
1517use piet:: kurbo:: { Affine , PathEl , Point , QuadBez , Rect , Shape , Size } ;
1618
1719use piet:: {
18- Color , Error , FixedGradient , Font , FontBuilder , HitTestPoint , HitTestTextPosition , ImageFormat ,
19- InterpolationMode , IntoBrush , LineCap , LineJoin , LineMetric , RenderContext , RoundInto ,
20- StrokeStyle , Text , TextLayout , TextLayoutBuilder ,
20+ Color , Error , FixedGradient , ImageFormat , InterpolationMode , IntoBrush , LineCap , LineJoin ,
21+ RenderContext , RoundInto , StrokeStyle ,
22+ } ;
23+
24+ pub use crate :: text:: {
25+ CoreGraphicsFont , CoreGraphicsFontBuilder , CoreGraphicsText , CoreGraphicsTextLayout ,
26+ CoreGraphicsTextLayoutBuilder ,
2127} ;
2228
2329pub struct CoreGraphicsContext < ' a > {
@@ -42,17 +48,6 @@ pub enum Brush {
4248 Gradient ,
4349}
4450
45- pub struct CoreGraphicsFont ;
46-
47- pub struct CoreGraphicsFontBuilder ;
48-
49- #[ derive( Clone ) ]
50- pub struct CoreGraphicsTextLayout ;
51-
52- pub struct CoreGraphicsTextLayoutBuilder { }
53-
54- pub struct CoreGraphicsText ;
55-
5651impl < ' a > RenderContext for CoreGraphicsContext < ' a > {
5752 type Brush = Brush ;
5853 type Text = CoreGraphicsText ;
@@ -226,74 +221,6 @@ impl<'a> RenderContext for CoreGraphicsContext<'a> {
226221 }
227222}
228223
229- impl Text for CoreGraphicsText {
230- type Font = CoreGraphicsFont ;
231- type FontBuilder = CoreGraphicsFontBuilder ;
232- type TextLayout = CoreGraphicsTextLayout ;
233- type TextLayoutBuilder = CoreGraphicsTextLayoutBuilder ;
234-
235- fn new_font_by_name ( & mut self , _name : & str , _size : f64 ) -> Self :: FontBuilder {
236- unimplemented ! ( ) ;
237- }
238-
239- fn new_text_layout (
240- & mut self ,
241- _font : & Self :: Font ,
242- _text : & str ,
243- _width : impl Into < Option < f64 > > ,
244- ) -> Self :: TextLayoutBuilder {
245- unimplemented ! ( ) ;
246- }
247- }
248-
249- impl Font for CoreGraphicsFont { }
250-
251- impl FontBuilder for CoreGraphicsFontBuilder {
252- type Out = CoreGraphicsFont ;
253-
254- fn build ( self ) -> Result < Self :: Out , Error > {
255- unimplemented ! ( ) ;
256- }
257- }
258-
259- impl TextLayoutBuilder for CoreGraphicsTextLayoutBuilder {
260- type Out = CoreGraphicsTextLayout ;
261-
262- fn build ( self ) -> Result < Self :: Out , Error > {
263- unimplemented ! ( )
264- }
265- }
266-
267- impl TextLayout for CoreGraphicsTextLayout {
268- fn width ( & self ) -> f64 {
269- 0.0
270- }
271-
272- fn update_width ( & mut self , _new_width : impl Into < Option < f64 > > ) -> Result < ( ) , Error > {
273- unimplemented ! ( )
274- }
275-
276- fn line_text ( & self , _line_number : usize ) -> Option < & str > {
277- unimplemented ! ( )
278- }
279-
280- fn line_metric ( & self , _line_number : usize ) -> Option < LineMetric > {
281- unimplemented ! ( )
282- }
283-
284- fn line_count ( & self ) -> usize {
285- unimplemented ! ( )
286- }
287-
288- fn hit_test_point ( & self , _point : Point ) -> HitTestPoint {
289- unimplemented ! ( )
290- }
291-
292- fn hit_test_text_position ( & self , _text_position : usize ) -> Option < HitTestTextPosition > {
293- unimplemented ! ( )
294- }
295- }
296-
297224impl < ' a > IntoBrush < CoreGraphicsContext < ' a > > for Brush {
298225 fn make_brush < ' b > (
299226 & ' b self ,
0 commit comments