magickConstituteImageFromCharPixel method

Future<bool> magickConstituteImageFromCharPixel({
  1. required int columns,
  2. required int rows,
  3. required String map,
  4. required Uint8List pixels,
})

Adds an image to the wand comprised of the pixel data you supply. The pixel data must be in scanline order top-to-bottom. For example, to create a 640x480 image from unsigned red-green-blue character data, in the C API, you would use

MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);

And the equivalent dart code here would be

wand.MagickConstituteImageFromCharPixel(640,640,'RGB',pixels)

This method runs inside an isolate different from the main isolate.

  • columns: width in pixels of the image.

  • rows: height in pixels of the image.

  • map: This string reflects the expected ordering of the pixel array. It can be any combination or order of R = red, G = green, B = blue, A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad.

  • pixels: A Uint8List of values contain the pixel components as defined by map.

  • See also: magickExportImageCharPixels.

Sending invalid parameters will cause an invalid state and may crash the app, so you should make sure to validate the input to this method.

Implementation

Future<bool> magickConstituteImageFromCharPixel({
  required int columns,
  required int rows,
  required String map,
  required Uint8List pixels,
}) async =>
    await _magickCompute(
      _magickConstituteImage,
      _MagickConstituteImageParams(
        _wandPtr.address,
        columns,
        rows,
        map,
        _StorageType.CharPixel,
        pixels,
      ),
    );