@@ -131,21 +131,30 @@ public void DrawImage(
131131 double destWidth ,
132132 double destHeight ,
133133 double opacity ,
134- bool interpolate )
134+ bool interpolate = false )
135135 {
136136 if ( source == null )
137137 {
138138 return ;
139139 }
140140
141141 var bytes = source . GetData ( ) ;
142- var image = SKBitmap . Decode ( bytes ) ;
142+ var bmp = SKBitmap . Decode ( bytes ) ;
143143
144144 var src = new SKRect ( ( float ) srcX , ( float ) srcY , ( float ) ( srcX + srcWidth ) , ( float ) ( srcY + srcHeight ) ) ;
145145 var dest = new SKRect ( this . Convert ( destX ) , this . Convert ( destY ) , this . Convert ( destX + destWidth ) , this . Convert ( destY + destHeight ) ) ;
146146
147- var paint = this . GetImagePaint ( opacity , interpolate ) ;
148- this . SkCanvas . DrawBitmap ( image , src , dest , paint ) ;
147+ var paint = this . GetImagePaint ( opacity ) ;
148+ if ( interpolate )
149+ {
150+ var sampling = new SKSamplingOptions ( SKFilterMode . Linear , SKMipmapMode . Linear ) ;
151+ var img = SKImage . FromBitmap ( bmp ) ;
152+ this . SkCanvas . DrawImage ( img , src , dest , sampling , paint ) ;
153+ }
154+ else
155+ {
156+ this . SkCanvas . DrawBitmap ( bmp , src , dest , paint ) ;
157+ }
149158 }
150159
151160 /// <inheritdoc/>
@@ -741,12 +750,10 @@ private SKPaint GetFillPaint(OxyColor fillColor, EdgeRenderingMode edgeRendering
741750 /// This modifies and returns the local <see cref="paint"/> instance.
742751 /// </remarks>
743752 /// <param name="opacity">The opacity.</param>
744- /// <param name="interpolate">A value indicating whether interpolation should be used.</param>
745753 /// <returns>The paint.</returns>
746- private SKPaint GetImagePaint ( double opacity , bool interpolate )
754+ private SKPaint GetImagePaint ( double opacity )
747755 {
748756 this . paint . Color = new SKColor ( 0 , 0 , 0 , ( byte ) ( 255 * opacity ) ) ;
749- this . paint . FilterQuality = interpolate ? SKFilterQuality . High : SKFilterQuality . None ;
750757 this . paint . IsAntialias = true ;
751758 return this . paint ;
752759 }
0 commit comments