Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

gradient.wgsl

Constants

PI

#
const PI: f32 = 3.14159265358979323846

TAU

#
const TAU: f32 = 2. * PI

HUE_GUARD

#
const HUE_GUARD: f32 = 0.0001

TEXTURED

#
const TEXTURED: u32 = 1u

RIGHT_VERTEX

#
const RIGHT_VERTEX: u32 = 2u

BOTTOM_VERTEX

#
const BOTTOM_VERTEX: u32 = 4u

RADIAL

#
const RADIAL: u32 = 16u

FILL_START

#
const FILL_START: u32 = 32u

FILL_END

#
const FILL_END: u32 = 64u

CONIC

#
const CONIC: u32 = 128u

BORDER_LEFT

#
const BORDER_LEFT: u32 = 256u

BORDER_TOP

#
const BORDER_TOP: u32 = 512u

BORDER_RIGHT

#
const BORDER_RIGHT: u32 = 1024u

BORDER_BOTTOM

#
const BORDER_BOTTOM: u32 = 2048u

BORDER_ANY

#
const BORDER_ANY: u32 = BORDER_LEFT + BORDER_TOP + BORDER_RIGHT + BORDER_BOTTOM

Bindings

view

#
@group(0)
@binding(0)
var<uniform> view: View

Structures

GradientVertexOutput

#
struct GradientVertexOutput {
@location(0)
uv: vec2<f32> ,
@location(1)
@interpolate(flat)
size: vec2<f32> ,
@location(2)
@interpolate(flat)
flags: u32 ,
@location(3)
@interpolate(flat)
radius: vec4<f32> ,
@location(4)
@interpolate(flat)
border: vec4<f32> ,
@location(5)
point: vec2<f32> ,
@location(6)
@interpolate(flat)
g_start: vec2<f32> ,
@location(7)
@interpolate(flat)
dir: vec2<f32> ,
@location(8)
@interpolate(flat)
start_color: vec4<f32> ,
@location(9)
@interpolate(flat)
start_len: f32 ,
@location(10)
@interpolate(flat)
end_len: f32 ,
@location(11)
@interpolate(flat)
end_color: vec4<f32> ,
@location(12)
@interpolate(flat)
hint: f32 ,
@builtin(position)
position: vec4<f32> ,
}

Functions

enabled

#
fn enabled (
flags: u32
mask: u32
) -> bool

vertex

#
@vertex
Processes each 3D point in a model before it's drawn
fn vertex (
@location(0)
vertex_position: vec3<f32>
@location(1)
vertex_uv: vec2<f32>
@location(2)
flags: u32
@location(3)
radius: vec4<f32>
@location(4)
border: vec4<f32>
@location(5)
size: vec2<f32>
@location(6)
point: vec2<f32>
@location(7)
@interpolate(flat)
g_start: vec2<f32>
@location(8)
@interpolate(flat)
dir: vec2<f32>
@location(9)
@interpolate(flat)
start_color: vec4<f32>
@location(10)
@interpolate(flat)
start_len: f32
@location(11)
@interpolate(flat)
end_len: f32
@location(12)
@interpolate(flat)
end_color: vec4<f32>
@location(13)
@interpolate(flat)
hint: f32
) -> GradientVertexOutput

fragment

#
@fragment
Calculates the final color of each pixel on the screen
fn fragment ( ) ->
@location(0)
vec4<f32>

gamma

#
fn gamma (
value: f32
) -> f32

inverse_gamma

#
fn inverse_gamma (
value: f32
) -> f32

srgb_to_linear_rgb

#
fn srgb_to_linear_rgb ( ) -> vec3<f32>

linear_rgb_to_srgb

#
fn linear_rgb_to_srgb ( ) -> vec3<f32>

oklab_to_linear_rgb

#
fn oklab_to_linear_rgb ( ) -> vec3<f32>

hsl_to_linear_rgb

#
fn hsl_to_linear_rgb ( ) -> vec3<f32>

hsv_to_linear_rgb

#
fn hsv_to_linear_rgb ( ) -> vec3<f32>

oklch_to_linear_rgb

#
fn oklch_to_linear_rgb ( ) -> vec3<f32>

rem_euclid

#
fn rem_euclid ( ) -> f32

linear_distance

#
fn linear_distance (
g_start: vec2<f32>
) -> f32

radial_distance

#
fn radial_distance (
ratio: f32
) -> f32

conic_distance

#
fn conic_distance (
start: f32
) -> f32

mix_oklch

#
fn mix_oklch ( ) -> vec3<f32>

mix_oklch_long

#
fn mix_oklch_long ( ) -> vec3<f32>

mix_hsl

#
fn mix_hsl ( ) -> vec3<f32>

mix_hsl_long

#
fn mix_hsl_long ( ) -> vec3<f32>

mix_hsv

#
fn mix_hsv ( ) -> vec3<f32>

mix_hsv_long

#
fn mix_hsv_long ( ) -> vec3<f32>

interpolate_gradient

#
fn interpolate_gradient (
distance: f32
start_color: vec4<f32>
start_distance: f32
end_color: vec4<f32>
end_distance: f32
hint: f32
flags: u32
) -> vec4<f32>

mix_colors

#

Mix the colors, choosing the appropriate interpolation method for the given color space

fn mix_colors (
start_color: vec3<f32>
end_color: vec3<f32>
) -> vec3<f32>

convert_to_linear_rgba

#

Convert a color from the interpolation color space to linear rgba

fn convert_to_linear_rgba ( ) -> vec4<f32>