Image.from constructor

Image.from(
  1. Image other,
  2. {bool noAnimation = false,
  3. bool noPixels = false}
)

Creates a copy of the given Image other.

Implementation

Image.from(Image other, {bool noAnimation = false, bool noPixels = false})
    : data = other.data?.clone(noPixels: noPixels),
      _exif = other._exif?.clone(),
      iccProfile = other.iccProfile?.clone(),
      frameType = other.frameType,
      loopCount = other.loopCount,
      backgroundColor = other.backgroundColor?.clone(),
      frameDuration = other.frameDuration,
      frameIndex = other.frameIndex {
  if (other.extraChannels != null) {
    extraChannels = Map<String, ImageData>.from(other.extraChannels!);
  }
  if (other.textData != null) {
    textData = Map<String, String>.from(other.textData!);
  }
  frames.add(this);
  if (!noAnimation && other.hasAnimation) {
    final numFrames = other.numFrames;
    for (var fi = 1; fi < numFrames; ++fi) {
      final frame = other.frames[fi];
      addFrame(Image.from(frame));
    }
  }
}