feat(ext/web): add ImageData Float16Array support#31394
feat(ext/web): add ImageData Float16Array support#31394bartlomieju merged 1 commit intodenoland:mainfrom
ImageData Float16Array support#31394Conversation
WalkthroughThis pull request adds Float16Array support to Deno's ImageData API. It introduces two new public types ( Sequence Diagram(s)sequenceDiagram
participant User
participant Constructor as ImageData<br/>Constructor
participant Validator as Validator
participant Buffer as Buffer<br/>Allocation
User->>Constructor: new ImageData(sw, sh, settings?)
Constructor->>Validator: Validate settings.pixelFormat<br/>(default: rgba-unorm8)
Validator-->>Constructor: pixelFormat: ImageDataPixelFormat
Constructor->>Buffer: Allocate backing array<br/>(Uint8ClampedArray or Float16Array)
Buffer-->>Constructor: data buffer
Constructor-->>User: ImageData instance<br/>with pixelFormat getter
User->>Constructor: new ImageData(data: ImageDataArray, sw, sh?, settings?)
Constructor->>Validator: Validate data type matches<br/>pixelFormat
alt data is Uint8ClampedArray
Validator-->>Constructor: OK (rgba-unorm8)
else data is Float16Array
Validator-->>Constructor: OK (rgba-float16)
end
Constructor->>Buffer: Use provided data buffer
Buffer-->>Constructor: buffer view
Constructor-->>User: ImageData instance<br/>with pixelFormat getter
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧬 Code graph analysis (2)ext/web/16_image_data.js (1)
ext/canvas/01_image.js (1)
🪛 Biome (2.1.2)ext/canvas/01_image.js[error] 18-18: Do not shadow the global "Uint8Array" property. Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. (lint/suspicious/noShadowRestrictedNames) [error] 19-19: Do not shadow the global "Uint8ClampedArray" property. Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global. (lint/suspicious/noShadowRestrictedNames) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
🔇 Additional comments (7)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Comment |
|
Thanks! Do we need to update MDN pages with this change? |
Just the compat data needs updating. |
0a3c932 to
13bd09c
Compare
Implements whatwg/html#11143.