Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.88 KB

File metadata and controls

50 lines (36 loc) · 1.88 KB

ImageDataSettings

Namespace: SpawnDev.SpawnJS.JSObjects
Source: JSObjects/ImageDataSettings.cs
MDN Reference: ImageDataSettings on MDN

Settings used when creating an ImageData instance https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData#settings

Properties

Property Type Access Description
ImageDataSettings class get Settings used when creating an ImageData instance https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData#settings
PixelFormat string? get

Examples

SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:

  • Properties and methods use PascalCase (e.g., readyState becomes ReadyState)
  • Events use ActionEvent with +=/-= (e.g., addEventListener("click", fn) becomes OnClick += handler)
  • Async methods return Task<T> instead of Promise<T>
  • Objects should be disposed with using statements
  • Access via JS.Get<ImageDataSettings>(...) or constructor new ImageDataSettings(...)

Creating a blank ImageData object

let imageData = new ImageData(200, 100);
// ImageData { width: 200, height: 100, data: Uint8ClampedArray[80000] }

ImageData using the display-p3 color space

let imageData = new ImageData(200, 100, { colorSpace: "display-p3" });

Floating-point pixel data for wide gamuts and high dynamic range (HDR)

let floatArray = new Float16Array(4 * 200 * 200);
let imageData = new ImageData(floatArray, 200, 200, {
  pixelFormat: "rgba-float16",
});
console.log(imageData.pixelFormat); // "rgba-float16"

See full example on MDN