@@ -40,6 +40,7 @@ pub struct BitMapBackend<'a, P: PixelFormat = RGBPixel> {
4040 buffer : Buffer < ' a > ,
4141 /// Flag indicates if the bitmap has been saved
4242 saved : bool ,
43+ use_anti_aliasing : bool ,
4344 _phantomdata : PhantomData < P > ,
4445}
4546
@@ -57,6 +58,7 @@ impl<'a> BitMapBackend<'a, RGBPixel> {
5758 size : ( w, h) ,
5859 buffer : Buffer :: Owned ( vec ! [ 0 ; Self :: PIXEL_SIZE * ( w * h) as usize ] ) ,
5960 saved : false ,
61+ use_anti_aliasing : true ,
6062 _phantomdata : PhantomData ,
6163 }
6264 }
@@ -85,6 +87,7 @@ impl<'a> BitMapBackend<'a, RGBPixel> {
8587 size : ( w, h) ,
8688 buffer : Buffer :: Owned ( vec ! [ 0 ; Self :: PIXEL_SIZE * ( w * h) as usize ] ) ,
8789 saved : false ,
90+ use_anti_aliasing : true ,
8891 _phantomdata : PhantomData ,
8992 } )
9093 }
@@ -128,6 +131,7 @@ impl<'a, P: PixelFormat> BitMapBackend<'a, P> {
128131 size : ( w, h) ,
129132 buffer : Buffer :: Borrowed ( buf) ,
130133 saved : false ,
134+ use_anti_aliasing : true ,
131135 _phantomdata : PhantomData ,
132136 } )
133137 }
@@ -137,6 +141,13 @@ impl<'a, P: PixelFormat> BitMapBackend<'a, P> {
137141 self . buffer . borrow_buffer ( )
138142 }
139143
144+ #[ inline( always) ]
145+ pub fn anti_aliasing ( self , use_anti_aliasing : bool ) -> Self {
146+ let mut s = self ;
147+ s. use_anti_aliasing = use_anti_aliasing;
148+ s
149+ }
150+
140151 /// Split a bitmap backend vertically into several sub drawing area which allows
141152 /// multi-threading rendering.
142153 ///
@@ -334,6 +345,10 @@ impl<'a, P: PixelFormat> DrawingBackend for BitMapBackend<'a, P> {
334345
335346 Ok ( ( ) )
336347 }
348+
349+ fn use_anti_aliasing ( & self ) -> bool {
350+ self . use_anti_aliasing
351+ }
337352}
338353
339354impl < P : PixelFormat > Drop for BitMapBackend < ' _ , P > {
0 commit comments