Skip to content

States & Presets

Pre-configured blend mode descriptors for BeginOptions.blendState:

PresetDescription
BlendState.alphaBlendStandard alpha blending (default)
BlendState.additiveAdditive blending (glow, particles)
BlendState.opaqueNo blending — source overwrites destination
BlendState.premultipliedAlphaFor pre-multiplied alpha textures

Pre-configured texture sampling descriptors for BeginOptions.samplerState:

PresetDescription
SamplerState.linearClampBilinear filtering, clamp to edge (default)
SamplerState.linearWrapBilinear filtering, repeat/wrap
SamplerState.pointClampNearest-neighbor, clamp to edge (pixel art)
SamplerState.pointWrapNearest-neighbor, repeat/wrap

Color presets and factory:

import { Color } from 'webgpu-spritebatch'
Color.white // { r: 1, g: 1, b: 1, a: 1 }
Color.black
Color.transparent
Color.red
Color.green
Color.blue
Color.yellow
Color.cyan
Color.magenta
Color.cornflowerBlue
Color.rgba(0.5, 0.8, 1.0, 0.9) // custom color