15.3. Raster operations (pixel copy, convert, SIMD gather/scatter)
SIMD-accelerated pixel operations — gather, scatter, copy, channel conversion, and BPC conversion.
15.3.1. Gather
15.3.1.1. gather
- gather(from: int const?; index4: uint4): int4
Warning
This is unsafe operation.
Gather pixels from source using an index array into destination.
- Arguments:
from : int? implicit
index4 : uint4
- gather(from: float const?; index4: uint4): float4
- gather(from: float const?; index4: int4): float4
- gather(from: uint const?; index4: uint4): uint4
- gather(from: uint const?; index4: int4): uint4
- gather(from: int const?; index4: int4): int4
15.3.2. Scatter
15.3.2.1. scatter
- scatter(to: int?; index4: uint4; from: int4)
Warning
This is unsafe operation.
Scatter pixels from source to destination using an index array.
- Arguments:
to : int? implicit
index4 : uint4
from : int4
- scatter(to: float?; index4: uint4; from: float4)
- scatter(to: float?; index4: int4; from: float4)
- scatter(to: uint?; index4: uint4; from: uint4)
- scatter(to: uint?; index4: int4; from: uint4)
- scatter(to: int?; index4: int4; from: int4)
15.3.3. Scatter with mask
scatter_neq_mask (to: int?; index4: uint4; from: int4; mask: int4)
scatter_neq_mask (to: float?; index4: uint4; from: float4; mask: float4)
scatter_neq_mask (to: float?; index4: int4; from: float4; mask: float4)
scatter_neq_mask (to: uint?; index4: uint4; from: uint4; mask: uint4)
scatter_neq_mask (to: uint?; index4: int4; from: uint4; mask: uint4)
scatter_neq_mask (to: int?; index4: int4; from: int4; mask: int4)
15.3.3.1. scatter_neq_mask
- scatter_neq_mask(to: int?; index4: uint4; from: int4; mask: int4)
Warning
This is unsafe operation.
Scatter pixels to destination where mask value differs from pixel value.
- Arguments:
to : int? implicit
index4 : uint4
from : int4
mask : int4
- scatter_neq_mask(to: float?; index4: uint4; from: float4; mask: float4)
- scatter_neq_mask(to: float?; index4: int4; from: float4; mask: float4)
- scatter_neq_mask(to: uint?; index4: uint4; from: uint4; mask: uint4)
- scatter_neq_mask(to: uint?; index4: int4; from: uint4; mask: uint4)
- scatter_neq_mask(to: int?; index4: int4; from: int4; mask: int4)
15.3.4. Store with mask
15.3.4.1. store_neq_mask
- store_neq_mask(to: int4?; from: int4; mask: int4)
Store a single pixel at indexed positions where mask differs.
- Arguments:
to : int4? implicit
from : int4
mask : int4
- store_neq_mask(to: float4?; from: float4; mask: float4)
- store_neq_mask(to: uint4?; from: uint4; mask: uint4)
15.3.5. Gather-scatter
gather_scatter (to: int?; to_index4: uint4; from: int const?; from_index4: uint4)
gather_scatter (to: float?; to_index4: uint4; from: float const?; from_index4: uint4)
gather_scatter (to: float?; to_index4: int4; from: float const?; from_index4: int4)
gather_scatter (to: uint?; to_index4: uint4; from: uint const?; from_index4: uint4)
gather_scatter (to: uint?; to_index4: int4; from: uint const?; from_index4: int4)
gather_scatter (to: int?; to_index4: int4; from: int const?; from_index4: int4)
15.3.5.1. gather_scatter
- gather_scatter(to: int?; to_index4: uint4; from: int const?; from_index4: uint4)
Warning
This is unsafe operation.
Gather pixels from source and scatter to destination using index arrays.
- Arguments:
to : int? implicit
to_index4 : uint4
from : int? implicit
from_index4 : uint4
- gather_scatter(to: float?; to_index4: uint4; from: float const?; from_index4: uint4)
- gather_scatter(to: float?; to_index4: int4; from: float const?; from_index4: int4)
- gather_scatter(to: uint?; to_index4: uint4; from: uint const?; from_index4: uint4)
- gather_scatter(to: uint?; to_index4: int4; from: uint const?; from_index4: int4)
- gather_scatter(to: int?; to_index4: int4; from: int const?; from_index4: int4)
15.3.6. Gather-scatter with mask
15.3.6.1. gather_scatter_neq_mask
- gather_scatter_neq_mask(to: int?; to_index4: uint4; from: int const?; from_index4: uint4; mask: int4)
Warning
This is unsafe operation.
Gather-scatter pixels where mask value differs from gathered pixel.
- Arguments:
to : int? implicit
to_index4 : uint4
from : int? implicit
from_index4 : uint4
mask : int4
- gather_scatter_neq_mask(to: float?; to_index4: uint4; from: float const?; from_index4: uint4; mask: float4)
- gather_scatter_neq_mask(to: float?; to_index4: int4; from: float const?; from_index4: int4; mask: float4)
- gather_scatter_neq_mask(to: uint?; to_index4: uint4; from: uint const?; from_index4: uint4; mask: uint4)
- gather_scatter_neq_mask(to: uint?; to_index4: int4; from: uint const?; from_index4: int4; mask: uint4)
- gather_scatter_neq_mask(to: int?; to_index4: int4; from: int const?; from_index4: int4; mask: int4)
15.3.7. Gather-store with mask
gather_store_neq_mask (to: int4?; from: int const?; from_index4: uint4; mask: int4)
gather_store_neq_mask (to: float4?; from: float const?; from_index4: uint4; mask: float4)
gather_store_neq_mask (to: float4?; from: float const?; from_index4: int4; mask: float4)
gather_store_neq_mask (to: uint4?; from: uint const?; from_index4: uint4; mask: uint4)
gather_store_neq_mask (to: uint4?; from: uint const?; from_index4: int4; mask: uint4)
gather_store_neq_mask (to: int4?; from: int const?; from_index4: int4; mask: int4)
15.3.7.1. gather_store_neq_mask
- gather_store_neq_mask(to: int4?; from: int const?; from_index4: uint4; mask: int4)
Warning
This is unsafe operation.
Gather from source and store where mask differs, using a single value.
- Arguments:
to : int4? implicit
from : int? implicit
from_index4 : uint4
mask : int4
- gather_store_neq_mask(to: float4?; from: float const?; from_index4: uint4; mask: float4)
- gather_store_neq_mask(to: float4?; from: float const?; from_index4: int4; mask: float4)
- gather_store_neq_mask(to: uint4?; from: uint const?; from_index4: uint4; mask: uint4)
- gather_store_neq_mask(to: uint4?; from: uint const?; from_index4: int4; mask: uint4)
- gather_store_neq_mask(to: int4?; from: int const?; from_index4: int4; mask: int4)
15.3.8. Gather-store with stride
gather_store_stride (to: int?; stride: int; from: int const?; from_index4: uint4)
gather_store_stride (to: float?; stride: int; from: float const?; from_index4: uint4)
gather_store_stride (to: float?; stride: int; from: float const?; from_index4: int4)
gather_store_stride (to: uint?; stride: int; from: uint const?; from_index4: uint4)
gather_store_stride (to: uint?; stride: int; from: uint const?; from_index4: int4)
gather_store_stride (to: int?; stride: int; from: int const?; from_index4: int4)
15.3.8.1. gather_store_stride
- gather_store_stride(to: int?; stride: int; from: int const?; from_index4: uint4)
Warning
This is unsafe operation.
Gather pixels with a stride offset between source elements.
- Arguments:
to : int? implicit
stride : int
from : int? implicit
from_index4 : uint4
- gather_store_stride(to: float?; stride: int; from: float const?; from_index4: uint4)
- gather_store_stride(to: float?; stride: int; from: float const?; from_index4: int4)
- gather_store_stride(to: uint?; stride: int; from: uint const?; from_index4: uint4)
- gather_store_stride(to: uint?; stride: int; from: uint const?; from_index4: int4)
- gather_store_stride(to: int?; stride: int; from: int const?; from_index4: int4)
15.3.9. Byte gather-store
15.3.9.1. u8x4_gather_store
- u8x4_gather_store(to: uint8?; from: uint8 const?; from_index4: int4)
Warning
This is unsafe operation.
Gather 4-byte pixels and store to sequential destination.
- Arguments:
to : uint8? implicit
from : uint8? implicit
from_index4 : int4
- u8x4_gather_store(to: uint8?; from: uint8 const?; from_index4: uint4)
15.3.10. Copy reversed
- rast_copy_reversed_1(dst: uint8?; src: uint8 const?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 1-byte pixels.
- Arguments:
dst : uint8? implicit
src : uint8? implicit
count : int
- rast_copy_reversed_12(dst: void?; src: void?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 12-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
count : int
- rast_copy_reversed_16(dst: void?; src: void?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 16-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
count : int
- rast_copy_reversed_2(dst: uint16?; src: uint16 const?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 2-byte pixels.
- Arguments:
dst : uint16? implicit
src : uint16? implicit
count : int
- rast_copy_reversed_3(dst: void?; src: void?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 3-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
count : int
- rast_copy_reversed_4(dst: uint?; src: uint const?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 4-byte pixels.
- Arguments:
dst : uint? implicit
src : uint? implicit
count : int
- rast_copy_reversed_6(dst: void?; src: void?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 6-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
count : int
- rast_copy_reversed_8(dst: uint64?; src: uint64 const?; count: int)
Warning
This is unsafe operation.
Copy pixel rows in reverse order (vertical flip) for 8-byte pixels.
- Arguments:
dst : uint64? implicit
src : uint64? implicit
count : int
15.3.11. Copy rect
- rast_copy_rect_1(dst: uint8?; src: uint8 const?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 1-byte pixels.
- Arguments:
dst : uint8? implicit
src : uint8? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
- rast_copy_rect_12(dst: void?; src: void?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 12-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
- rast_copy_rect_16(dst: void?; src: void?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 16-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
- rast_copy_rect_2(dst: uint16?; src: uint16 const?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 2-byte pixels.
- Arguments:
dst : uint16? implicit
src : uint16? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
- rast_copy_rect_3(dst: void?; src: void?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 3-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
- rast_copy_rect_4(dst: uint?; src: uint const?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 4-byte pixels.
- Arguments:
dst : uint? implicit
src : uint? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
- rast_copy_rect_6(dst: void?; src: void?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 6-byte pixels.
- Arguments:
dst : void? implicit
src : void? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
- rast_copy_rect_8(dst: uint64?; src: uint64 const?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int)
Warning
This is unsafe operation.
Copy a rectangular region between pixel buffers for 8-byte pixels.
- Arguments:
dst : uint64? implicit
src : uint64? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
15.3.12. Channel conversion
- rast_convert_channels_f32(dst: float?; src: float const?; num_pixels: int; src_ch: int; dst_ch: int)
Warning
This is unsafe operation.
Convert between channel counts for float pixel data.
- Arguments:
dst : float? implicit
src : float? implicit
num_pixels : int
src_ch : int
dst_ch : int
- rast_convert_channels_u16(dst: uint16?; src: uint16 const?; num_pixels: int; src_ch: int; dst_ch: int)
Warning
This is unsafe operation.
Convert between channel counts for uint16 pixel data.
- Arguments:
dst : uint16? implicit
src : uint16? implicit
num_pixels : int
src_ch : int
dst_ch : int
- rast_convert_channels_u8(dst: uint8?; src: uint8 const?; num_pixels: int; src_ch: int; dst_ch: int)
Warning
This is unsafe operation.
Convert between channel counts for uint8 pixel data.
- Arguments:
dst : uint8? implicit
src : uint8? implicit
num_pixels : int
src_ch : int
dst_ch : int
15.3.13. BPC conversion
rast_convert_f32_to_u16 (dst: uint16?; src: float const?; count: int)
rast_convert_f32_to_u8 (dst: uint8?; src: float const?; count: int)
rast_convert_u16_to_f32 (dst: float?; src: uint16 const?; count: int)
rast_convert_u16_to_u8 (dst: uint8?; src: uint16 const?; count: int)
rast_convert_u8_to_f32 (dst: float?; src: uint8 const?; count: int)
rast_convert_u8_to_u16 (dst: uint16?; src: uint8 const?; count: int)
- rast_convert_f32_to_u16(dst: uint16?; src: float const?; count: int)
Warning
This is unsafe operation.
Convert pixel data from float (0.0-1.0) to uint16 (0-65535) with clamping.
- Arguments:
dst : uint16? implicit
src : float? implicit
count : int
- rast_convert_f32_to_u8(dst: uint8?; src: float const?; count: int)
Warning
This is unsafe operation.
Convert pixel data from float (0.0-1.0) to uint8 (0-255) with clamping.
- Arguments:
dst : uint8? implicit
src : float? implicit
count : int
- rast_convert_u16_to_f32(dst: float?; src: uint16 const?; count: int)
Warning
This is unsafe operation.
Convert pixel data from uint16 (0-65535) to float (0.0-1.0).
- Arguments:
dst : float? implicit
src : uint16? implicit
count : int
- rast_convert_u16_to_u8(dst: uint8?; src: uint16 const?; count: int)
Warning
This is unsafe operation.
Convert pixel data from uint16 (0-65535) to uint8 (0-255).
- Arguments:
dst : uint8? implicit
src : uint16? implicit
count : int
- rast_convert_u8_to_f32(dst: float?; src: uint8 const?; count: int)
Warning
This is unsafe operation.
Convert pixel data from uint8 (0-255) to float (0.0-1.0).
- Arguments:
dst : float? implicit
src : uint8? implicit
count : int
- rast_convert_u8_to_u16(dst: uint16?; src: uint8 const?; count: int)
Warning
This is unsafe operation.
Convert pixel data from uint8 (0-255) to uint16 (0-65535).
- Arguments:
dst : uint16? implicit
src : uint8? implicit
count : int
15.3.14. Span raster
- rast_hspan_masked_solid_u8(solid: uint8; span: array<uint8>; spanOffset: int; tspan: array<uint8>; tspanOffset: int; uvY: float; dUVY: float; count: int)
Rasterize a horizontal span of solid color with per-pixel mask.
- Arguments:
solid : uint8
span : array<uint8> implicit
spanOffset : int
tspan : array<uint8> implicit
tspanOffset : int
uvY : float
dUVY : float
count : int
- rast_hspan_masked_u8(span: array<uint8>; spanOffset: int; tspan: array<uint8>; tspanOffset: int; uvY: float; dUVY: float; count: int)
Rasterize a horizontal span with per-pixel mask.
- Arguments:
span : array<uint8> implicit
spanOffset : int
tspan : array<uint8> implicit
tspanOffset : int
uvY : float
dUVY : float
count : int
- rast_hspan_u8(span: array<uint8>; spanOffset: int; tspan: array<uint8>; tspanOffset: int; uvY: float; dUVY: float; count: int)
Rasterize a horizontal span of uint8 pixels.
- Arguments:
span : array<uint8> implicit
spanOffset : int
tspan : array<uint8> implicit
tspanOffset : int
uvY : float
dUVY : float
count : int
15.3.15. Fill rect
- rast_fill_rect_1(dst: uint8?; dst_w: int; dx: int; dy: int; w: int; h: int; val: uint8)
Warning
This is unsafe operation.
Fill a rectangle in a 1-channel uint8 image with a solid byte value. Operates on raw pixel data with row width, position, and dimensions.
- Arguments:
dst : uint8? implicit
dst_w : int
dx : int
dy : int
w : int
h : int
val : uint8
- rast_fill_rect_4(dst: uint?; dst_w: int; dx: int; dy: int; w: int; h: int; val: uint)
Warning
This is unsafe operation.
Fill a rectangle in a 4-channel RGBA image with a packed uint32 color value. Operates on raw pixel data with row width, position, and dimensions.
- Arguments:
dst : uint? implicit
dst_w : int
dx : int
dy : int
w : int
h : int
val : uint
15.3.16. Alpha blit
- rast_blit_alpha(dst: uint8?; src: uint8 const?; dst_w: int; src_w: int; sx0: int; sy0: int; dx0: int; dy0: int; w: int; h: int; r: uint8; g: uint8; b: uint8)
Warning
This is unsafe operation.
Alpha-blend a 1-channel source onto a 4-channel RGBA destination using SIMD. Each source pixel is the alpha value for blending the given (r,g,b) color. Uses exact integer division by 255.
- Arguments:
dst : uint8? implicit
src : uint8? implicit
dst_w : int
src_w : int
sx0 : int
sy0 : int
dx0 : int
dy0 : int
w : int
h : int
r : uint8
g : uint8
b : uint8