8
8
9
9
package feathers .controls ;
10
10
11
+ import openfl .display .PixelSnapping ;
11
12
import feathers .core .FeathersControl ;
12
13
import feathers .core .IValidating ;
13
14
import feathers .layout .Measurements ;
@@ -34,11 +35,13 @@ class BitmapImage extends FeathersControl {
34
35
35
36
@since 1.4.0
36
37
**/
37
- public function new (? source : BitmapData ) {
38
+ public function new (? source : BitmapData , pixelSnapping : PixelSnapping = AUTO , smoothing : Bool = false ) {
38
39
initializeBitmapImageTheme ();
39
40
super ();
40
41
41
42
this .source = source ;
43
+ this .pixelSnapping = pixelSnapping ;
44
+ this .smoothing = smoothing ;
42
45
}
43
46
44
47
private var content : Bitmap ;
@@ -187,6 +190,18 @@ class BitmapImage extends FeathersControl {
187
190
return this ._scaleMode ;
188
191
}
189
192
193
+ /**
194
+ @see [`openfl.display.Bitmap.pixelSnapping`](https://api.openfl.org/openfl/display/Bitmap.html#pixelSnapping)
195
+ **/
196
+ @:style
197
+ public var pixelSnapping : PixelSnapping = AUTO ;
198
+
199
+ /**
200
+ @see [`openfl.display.Bitmap.smoothing`](https://api.openfl.org/openfl/display/Bitmap.html#smoothing)
201
+ **/
202
+ @:style
203
+ public var smoothing : Bool = false ;
204
+
190
205
private function initializeBitmapImageTheme (): Void {
191
206
#if !feathersui_disable_default_theme
192
207
feathers.themes.steel.components. SteelBitmapImageStyles .initialize ();
@@ -199,6 +214,16 @@ class BitmapImage extends FeathersControl {
199
214
}
200
215
201
216
override private function update (): Void {
217
+ var dataInvalid = this .isInvalid (DATA );
218
+ var stylesInvalid = this .isInvalid (STYLES );
219
+
220
+ if (dataInvalid || stylesInvalid ) {
221
+ if (this .content != null ) {
222
+ this .content .pixelSnapping = this .pixelSnapping ;
223
+ this .content .smoothing = this .smoothing ;
224
+ }
225
+ }
226
+
202
227
this .measure ();
203
228
this .layoutChildren ();
204
229
}
@@ -354,6 +379,6 @@ class BitmapImage extends FeathersControl {
354
379
}
355
380
356
381
private function createBitmap (bitmapData : BitmapData ): Bitmap {
357
- return new Bitmap (bitmapData );
382
+ return new Bitmap (bitmapData , this . pixelSnapping , this . smoothing );
358
383
}
359
384
}
0 commit comments