AbstractCheck if this object has been disposed
Protected_Cleanup function to be implemented by subclasses
The WASM pointer to clean up
Add a color stop to the gradient
Position of the stop (0.0 to 1.0)
RGBA color [r, g, b, a] where each value is 0-255
Clear all pending color stops Use this to reset stops before adding new ones
The Fill instance for method chaining
Replace all color stops with new ones This is a convenience method that clears existing stops and adds new ones in one call
Variable number of [offset, color] tuples
The Fill instance for method chaining
const gradient = new TVG.LinearGradient(0, 0, 200, 0);
gradient.setStops(
[0, [255, 0, 0, 255]], // Red at start
[0.5, [255, 255, 0, 255]], // Yellow at middle
[1, [0, 255, 0, 255]] // Green at end
);
shape.fill(gradient);
// Later, completely replace stops
gradient.setStops(
[0, [0, 0, 255, 255]], // Blue at start
[1, [255, 0, 255, 255]] // Magenta at end
);
shape.fill(gradient); // Re-apply with new stops
Protected_Apply collected color stops to the gradient ColorStop struct: {float offset, uint8_t r, g, b, a} = 8 bytes per stop
Manually dispose of this object and free its WASM memory
Gets the WASM pointer for this object Returns 0 if object has been disposed (error handled by global handler)