createImageData method

List<double> createImageData()

Implementation

List<double> createImageData() {
  int width = size;
  int height = size;

  double dataWidth = (width / 2).ceil().toDouble();

  double mirrorWidth = width - dataWidth;

  List<double> data = List.filled(size * size, 0, growable: true);
  ;

  int dataCount = 0;
  for (int y = 0; y < height; y++) {
    List<double> row = List.filled(dataWidth.toInt(), 0, growable: true);

    for (int x = 0; x < dataWidth; x++) {
      row[x] = (rand() * 2.3).floor().toDouble();
    }

    List<double> r =
        row.sublist(0, (javaLongToInt(mirrorWidth) as num).toInt());

    r = r.reversed.toList();

    row = [...row, ...r];

    for (double v in row) {
      data[dataCount] = v.toDouble();
      dataCount++;
    }
  }

  return data;
}