read static method

ActorImage read(
  1. ActorArtboard artboard,
  2. StreamReader reader,
  3. ActorImage node
)
override

Implementation

static ActorImage read(
    ActorArtboard artboard, StreamReader reader, ActorImage node) {
  ActorDrawable.read(artboard, reader, node);
  ActorSkinnable.read(artboard, reader, node);

  if (!node.isHidden) {
    node._textureIndex = reader.readUint8('atlas');

    int numVertices = reader.readUint32('numVertices');

    node._vertexCount = numVertices;
    node._vertices =
        reader.readFloat32Array(numVertices * node.vertexStride, 'vertices');

    // In version 24 we started packing the original UV coordinates if the
    // image was marked for dynamic runtime swapping.
    if (artboard.actor.version >= 24) {
      bool isDynamic = reader.readBool('isDynamic');
      if (isDynamic) {
        node._dynamicUV = reader.readFloat32Array(numVertices * 2, 'uv');
      }
    }

    int numTris = reader.readUint32('numTriangles');
    node._triangles = Uint16List(numTris * 3);
    node._triangleCount = numTris;
    node._triangles = reader.readUint16Array(numTris * 3, 'triangles');
  }
  return node;
}