Pixels class final

An image's pixels: width × height RGBA, 8 bits a channel, alpha not multiplied in, rows top to bottom.

Constructors

Pixels(int width, int height, [Uint8List? rgba])
width × height pixels: rgba when given (its length must be width * height * 4), else all clear black.

Properties

hashCode → int
The hash code for this object.
no setterinherited
height → int
The image's size, in pixels.
final
rgba → Uint8List
The pixels, four bytes each — red, green, blue, alpha — row by row from the top left.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
width → int
The image's size, in pixels.
final

Methods

at(int x, int y, int c) → int
The channel c (0 red … 3 alpha) at x, y.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
png() → Future<Uint8List>
These pixels as a PNG file's bytes.
toString() → String
A string representation of this object.
inherited
writePng(String path) → Future<void>
Writes these pixels to path as a PNG file, whole or not at all (its folder made when missing).

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

decode(Uint8List bytes, {int? width, int? height}) → Future<Pixels>
bytes (PNG, JPEG, …) decoded, scaled to width × height when given.
read(String path, {int? width, int? height}) → Future<Pixels>
The image file at path, its pixels — scaled to width × height when given. Throws when it can't be read as an image.
sizeOf(String path) → Future<(int, int)>
How big the image file at path is, without decoding all of it.