fromSIBytes static method

ScalableImage fromSIBytes(
  1. Uint8List bytes, {
  2. bool compact = false,
  3. Color? currentColor,
})

Create an image from the contents of a .si file in a ByteData. Loading a .si file is considerably faster than parsing an SVG or AVD file - about 5-20x faster in informal measurements. A .si file can be created with dart run jovial_svg:svg_to_si or dart run jovial_svg:avd_to_si.

If compact is true, the internal representation will occupy significantly less memory, at the expense of rendering time. See toDag for a discussion of the two representations.

See also ScalableImage.currentColor.

Implementation

static ScalableImage fromSIBytes(Uint8List bytes,
    {bool compact = false, Color? currentColor}) {
  final r = ScalableImageCompact.fromBytes(bytes, currentColor: currentColor);
  if (compact) {
    return r;
  } else {
    return r.toDag();
  }
}