paint static method

Map<String, dynamic>? paint(
  1. Paint? paint
)

Returns a Paint from the specified map.

If the map is absent, returns null.

Otherwise (even if it has no keys), a new Paint is created and its properties are set according to the identically-named properties of the map, as follows:

(Some values are not supported, because there is no way for them to be used currently in RFW contexts.)

Implementation

//  * `imageFilter`: [imageFilter].
//  * `invertColors`: boolean.
///  * `isAntiAlias`: boolean.
///  * `maskFilter`: [maskFilter].
///  * `shader`: [shader].
//  * `strokeCap`: [enumValue] of [StrokeCap].
//  * `strokeJoin`: [enumValue] of [StrokeJoin].
//  * `strokeMiterLimit`: double.
//  * `strokeWidth`: double.
//  * `style`: [enumValue] of [PaintingStyle].
///
/// (Some values are not supported, because there is no way for them to be
/// used currently in RFW contexts.)
static Map<String, dynamic>? paint(Paint? paint) {
  if (paint == null) return null;
  return NotNullMap.from({
    'blendMode': enumValue(paint.blendMode),
    'color': color(paint.color),
    'colorFilter': colorFilter(paint.colorFilter),
    'filterQuality': enumValue(paint.filterQuality),
    // TODO: rfw not support imageFilter
    // 'imageFilter': imageFilter(paint.imageFilter),
    'invertColors': paint.invertColors,
    'isAntiAlias': paint.isAntiAlias,
    'maskFilter': maskFilter(paint.maskFilter),
    'shader': shader(paint.shader),
    'strokeCap': enumValue(paint.strokeCap),
    'strokeJoin': enumValue(paint.strokeJoin),
    'strokeMiterLimit': paint.strokeMiterLimit,
    'strokeWidth': paint.strokeWidth,
    'style': enumValue(paint.style),
  });
}