NotificationHint.imageData constructor

NotificationHint.imageData(
  1. int width,
  2. int height,
  3. Iterable<int> data, {
  4. int rowStride = -1,
  5. bool hasAlpha = false,
  6. int bitsPerSample = 8,
  7. int channels = 3,
})

This notification should show use the supplied raw image data for its icon. data is the raw data for the image. width and height are the width and height of the image in pixels. rowStride is the number of bytes per row in data. hasAlpha is true if the image has an alpha channel. bitsPerSample is the number of bits in each color sample. channels is the number of channels in the image (e.g. 3 for RGB, 4 for RGBA).

Implementation

factory NotificationHint.imageData(int width, int height, Iterable<int> data,
    {int rowStride = -1,
    bool hasAlpha = false,
    int bitsPerSample = 8,
    int channels = 3}) {
  if (rowStride < 0) {
    rowStride = ((width * channels * bitsPerSample) / 8).ceil();
  }
  return NotificationHint(
      'image-data',
      DBusStruct([
        DBusInt32(width),
        DBusInt32(height),
        DBusInt32(rowStride),
        DBusBoolean(hasAlpha),
        DBusInt32(bitsPerSample),
        DBusInt32(channels),
        DBusArray.byte(data)
      ]));
}