clipViewerElementFromMap static method

ViewerElement<Rectangle<num>> clipViewerElementFromMap(
  1. Map? clip, [
  2. Color? color
])

Implementation

static ViewerElement<Rectangle<num>> clipViewerElementFromMap(Map? clip,
    [Color? color]) {
  if (clip == null) {
    return clipViewerElement(null, color);
  }

  var x = parseInt(findKeyValue(clip, ['x', 'left'], true))!;
  var y = parseInt(findKeyValue(clip, ['y', 'top'], true))!;
  var w = parseInt(findKeyValue(clip, ['w', 'width'], true))!;
  var h = parseInt(findKeyValue(clip, ['h', 'height'], true))!;

  var rect = Rectangle(x, y, w, h);
  return clipViewerElement(rect, color);
}