SamplerOptions class final

How a texture is sampled.

The engine's counterpart to flutter_gpu's SamplerOptions, and it exists for the same reason the enums beside it do: it is reachable from the public API — five fields on Material and the return of samplerOptionsFor — so a consumer that wanted to describe a sampler had to name a flutter_gpu type.

Two deliberate differences from the type underneath, both because this one is a description rather than a handle:

  • It is immutable and const, so linearRepeat and linearClamp can be compile-time constants rather than lazily built statics.
  • It defines == and hashCode, so the translation layer can cache the flutter_gpu object per distinct description instead of allocating one per bind. Nothing in the engine mutates a sampler after building it, so nothing loses by this.

The field set and the defaults are flutter_gpu's, unchanged.

Constructors

SamplerOptions({MinMagFilter minFilter = MinMagFilter.nearest, MinMagFilter magFilter = MinMagFilter.nearest, MipFilter mipFilter = MipFilter.nearest, SamplerAddressMode widthAddressMode = SamplerAddressMode.clampToEdge, SamplerAddressMode heightAddressMode = SamplerAddressMode.clampToEdge, int anisotropy = 1})
const

Properties

anisotropy int
How many taps a sample may spread along the direction a texture is foreshortened in. One — the default — is isotropic filtering, which is every sampler the engine bound before this field existed.
final
hashCode int
The hash code for this object.
no setteroverride
heightAddressMode SamplerAddressMode
final
magFilter MinMagFilter
final
minFilter MinMagFilter
final
mipFilter MipFilter
Which levels of a mip chain are blended. See MipFilter.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
widthAddressMode SamplerAddressMode
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override
withAnisotropy(int anisotropy) SamplerOptions
This sampler with its anisotropy replaced.

Operators

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

Constants

linearClamp → const SamplerOptions
Smooth and clamped: the default for sampling a full-screen buffer, where wrapping would fold the far edge onto the near one.
linearRepeat → const SamplerOptions
Smooth and tiling: the default for material textures.
nearestClamp → const SamplerOptions
Unfiltered and clamped: for a buffer whose texels are data rather than colour.
trilinearRepeat → const SamplerOptions
Smooth and tiling, and blended between mip levels.