we (web engine): Experimental web browser project to understand the limits of Claude

Pixel format types and RGBA8 conversion #66

open opened by pierrelf.com

Define common pixel format types and conversion utilities in the image crate.

Requirements#

  • Define Image struct: width, height, pixel data in RGBA8 format (Vec, 4 bytes per pixel)
  • Conversion functions:
    • Grayscale (1 channel) → RGBA8
    • Grayscale + Alpha (2 channels) → RGBA8
    • RGB (3 channels) → RGBA8
    • RGBA (4 channels) → RGBA8 (identity/validation)
    • Indexed color (palette + indices) → RGBA8
  • ImageError enum for decoding failures

Acceptance Criteria#

  • All conversion functions produce correct RGBA8 output
  • Unit tests for each conversion path
  • Edge cases: zero-dimension images, empty pixel data
  • No external dependencies, no unsafe

Context#

Common infrastructure used by PNG, JPEG, and GIF decoders. Should be implemented early so decoders can target a uniform output format.

Phase 7 — Image Decoders

sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:meotu43t6usg4qdwzenk4s2t/sh.tangled.repo.issue/3mgwaqzpjkv2q