Buffer<T extends Object?> class abstract base mixin Buffers

A 2-dimensional view of pixel data T in memory.

Buffer is analogous to a (read only) Iterable of pixels, but with a 2-dimensional structure. It is used to represent pixel data in memory without copying it, but also without exposing the raw memory.

In most cases buffers will be used ephemerally; Pixels is an actual representation of pixel data.

Implementers

Constructors

Buffer()

Properties

bounds Rect
Returns the buffer as a bounding rectangle.
no setter
data Iterable<T>
Pixel data in the buffer.
no setter
format PixelFormat<T, void>
Format of the pixel data in the buffer.
no setter
hashCode int
The hash code for this object.
no setterinherited
height int
Height of the buffer in pixels.
no setter
length int
Length of the buffer in pixels.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
Width of the buffer in pixels.
no setter

Methods

compare(Buffer<T> other, {double epsilon = 1e-10}) ComparisonResult<T>
Compares the buffer to another buffer and returns the result.
contains(Pos pos) bool
Returns whether the given position is within the bounds of the buffer.
get(Pos pos) → T
Returns the pixel at the given position.
getRect(Rect rect) Iterable<T>
Returns a lazy iterable of pixels in the rectangle defined by rect.
getRectUnsafe(Rect rect) Iterable<T>
Returns a lazy iterable of pixels in the rectangle defined by rect.
getUnsafe(Pos pos) → T
Returns the pixel at the given position without bounds checking.
map(T convert(T)) Buffer<T>
Returns a lazy buffer buffer that converts pixels with the given function.
mapConvert<R>(PixelFormat<R, void> format) Buffer<R>
Returns a lazy buffer that converts pixels to the given format.
mapIndexed(T convert(Pos, T)) Buffer<T>
Returns a lazy buffer that converts pixels with the given function.
mapRect(Rect bounds) Buffer<T>
Returns a lazy buffer that clips the buffer to the given bounds.
mapScaled(int scale) Buffer<T>
Returns a lazy buffer that scales the buffer by the given factor.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Methods

bufferToLongString<T>(Buffer<T> buffer) String
Converts a Buffer to a string like Buffer.toString.