anchor.diff:    }
   }
   
  -class _ColorTable {
  +const maxColorBits = 7;
  +const maxColors = 1<<maxColorBits;
  +
  +class _IndexedImage {
  +  final int width;
  +  final int height;
  +  _ColorTable colors;
  +  List<int> pixels;
  +
  +  _IndexedImage(this.width, this.height, List<int> rgba) {   
  +    var builder = new _ColorTableBuilder();
  +    pixels = builder.indexImage(width, height, rgba);    
  +    colors = builder.build();
  +  }
  +
  +  Uint8List encodeGif() {
  +    return new Uint8List.fromList(
  +        _header(width, height, colors.bits)
  +        ..addAll(colors.table)
  +        ..addAll(_startImage(0, 0, width, height))
  +        ..addAll(lzw.compress(pixels, colors.bits))
  +        ..addAll(_trailer()));
  +  }
  +}
  +
  +class _ColorTableBuilder {
     final List<int> table = new List<int>();
     final colorToIndex = new Map<int, int>();
     int bits;
  
positive.code:         this.bits = bits;
          return;
        }
      }
    }
    
    int get numColors {
      return table.length ~/ 3;
    }
  }
  
  List<int> _header(int width, int height, int colorBits) {
  
negative.code:     bytes.addAll(colors.table);
      bytes.addAll(_loop(0));
      
      for (int i = 0; i < _frames.length; i++) {
        var frame = _frames[i];
        bytes
          ..addAll(_delayNext(delay))
          ..addAll(_startImage(0, 0, width, height))
  