Измените цвет вершин и линий, используя canvas.drawVertices - PullRequest
0 голосов
/ 07 февраля 2020

Обычный объект Paint, похоже, не изменяет внешний вид линий, нарисованных с помощью drawVertices. Вот что я попробовал.

// Doesn't do anything
var brush = Paint()..color = Colors.blue..strokeWidth = 4..style = PaintingStyle.stroke;

// The only shaders I've found are UI.Gradient and UI.ImageShader
brush = brush..shader = UI.Gradient.linear(
  Offset(0, 0),
  // absurd numbers
  Offset(10000, 10000),
  [Colors.blue, Colors.blue],
);

canvas.drawVertices(
  UI.Vertices.raw(
    VertexMode.triangleStrip,
    storage,
    // This will change the colors of the faces not the lines
    // colors: _encodeColorList(storageCount.map((_) => Colors.white).toList())
  ),
  BlendMode.dstIn,
  brush,
);


// Copied from dart:ui
Int32List _encodeColorList(List<Color> colors) {
  final int colorCount = colors.length;
  final Int32List result = Int32List(colorCount);
  for (int i = 0; i < colorCount; ++i) result[i] = colors[i].value;

  return result;
}

Цвет линии всегда черный:

enter image description here

РЕДАКТИРОВАТЬ:

Это может быть ошибка в структуре. Вот проблема Github для справки .

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...