Commit graph

1 commit

Author SHA1 Message Date
jedarden
6ea0b0aa54 feat(pdftract-44f6): implement GraphicsState with 13 fields, Color enum, and matrix ops
Implements the complete graphics state per PDF spec section 8.4:

- Color enum with 5 variants (DeviceGray/RGB/CMYK, Spot, Other)
- Color::to_css_hex() for JSON serialization (returns None for Spot/Other)
- GraphicsState struct with all 13 fields (ctm, text_matrix, text_line_matrix,
  font, font_size, char_spacing, word_spacing, horiz_scaling, leading,
  text_rise, text_rendering_mode, fill_color, stroke_color)
- GraphicsState::initial() returning default state (identity CTM, black colors)
- Matrix operations: scale(), translate(), rotate(), invert()
- Manual Debug impl for GraphicsState (Font doesn't implement Debug)

All acceptance criteria PASS:
- initial() has identity CTM, font_size 0.0, fill_color DeviceGray(0.0)
- Clone produces deep-equal value
- Color::DeviceRGB([1.0, 0.0, 0.0]).to_css_hex() == Some("#ff0000")
- Color::Spot returns None
- Matrix multiply identity*identity within 1e-10

Closes: pdftract-44f6

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 15:49:50 -04:00