@@ -1065,6 +1065,7 @@ class Paint {
1065
1065
static const int _kMaskFilterIndex = 12 ;
1066
1066
static const int _kMaskFilterBlurStyleIndex = 13 ;
1067
1067
static const int _kMaskFilterSigmaIndex = 14 ;
1068
+ static const int _kInvertColorIndex = 15 ;
1068
1069
1069
1070
static const int _kIsAntiAliasOffset = _kIsAntiAliasIndex << 2 ;
1070
1071
static const int _kColorOffset = _kColorIndex << 2 ;
@@ -1081,6 +1082,7 @@ class Paint {
1081
1082
static const int _kMaskFilterOffset = _kMaskFilterIndex << 2 ;
1082
1083
static const int _kMaskFilterBlurStyleOffset = _kMaskFilterBlurStyleIndex << 2 ;
1083
1084
static const int _kMaskFilterSigmaOffset = _kMaskFilterSigmaIndex << 2 ;
1085
+ static const int _kInvertColorOffset = _kInvertColorIndex << 2 ;
1084
1086
// If you add more fields, remember to update _kDataByteCount.
1085
1087
static const int _kDataByteCount = 75 ;
1086
1088
@@ -1363,6 +1365,18 @@ class Paint {
1363
1365
}
1364
1366
}
1365
1367
1368
+ /// Whether the colors of the image are inverted when drawn.
1369
+ ///
1370
+ /// inverting the colors of an image applies a new color filter that will
1371
+ /// be composed with any user provided color filters. This is primarily
1372
+ /// used for implementing smart invert on iOS.
1373
+ bool get invertColors {
1374
+ return _data.getInt32 (_kInvertColorOffset, _kFakeHostEndian) == 1 ;
1375
+ }
1376
+ set invertColors (bool value) {
1377
+ _data.setInt32 (_kInvertColorOffset, value ? 1 : 0 , _kFakeHostEndian);
1378
+ }
1379
+
1366
1380
@override
1367
1381
String toString () {
1368
1382
final StringBuffer result = new StringBuffer ();
@@ -1411,8 +1425,12 @@ class Paint {
1411
1425
result.write ('${semicolon }filterQuality: $filterQuality ' );
1412
1426
semicolon = '; ' ;
1413
1427
}
1414
- if (shader != null )
1428
+ if (shader != null ) {
1415
1429
result.write ('${semicolon }shader: $shader ' );
1430
+ semicolon = '; ' ;
1431
+ }
1432
+ if (invertColors)
1433
+ result.write ('${semicolon }invert: $invertColors ' );
1416
1434
result.write (')' );
1417
1435
return result.toString ();
1418
1436
}
0 commit comments