Skip to content

fix: shape wire classes inherit Record (not WithBounds) + bitmap + naming - #5

Merged
ronaldtse merged 1 commit into
mainfrom
feat/bitmap-and-naming-fixes
Jul 24, 2026
Merged

fix: shape wire classes inherit Record (not WithBounds) + bitmap + naming#5
ronaldtse merged 1 commit into
mainfrom
feat/bitmap-and-naming-fixes

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Companion to emfsvg PR #3.

Three distinct fixes:

  1. Rectangle/Ellipse/RoundRect base class fix. These records carry
    only rclBox per MS-EMF 2.3.5, NOT rclBounds. Wrong inheritance from
    WithBounds caused bindata to expect 16 extra bytes; records fell
    through to Raw. ~3500 records affected across the corpus.

  2. StretchDIBits full layout. Declares offBmiSrc/cbBmiSrc/offBitsSrc/
    cbBitsSrc/iUsageSrc/dwRop/cxDest/cyDest. Enables emfsvg to decode
    embedded DIBs.

  3. Class-name / autoload consistency. PolyTextOutA/W and
    ColorMatchToTargetW — class definitions in their files now match
    the autoload symbols.

Round-trip verified: 208/208 byte-identical.

Per MS-EMF 2.3.5, EMR_RECTANGLE/ELLIPSE/ROUNDRECT carry only rclBox
(+ szlCorner for RoundRect). They do NOT carry rclBounds. The earlier
class declarations wrongly inherited from WithBounds, causing bindata
to expect 16 extra bytes per record — when the source bytes ran out
the parser fell through to Raw, hiding ~3500 records from emfsvg.

Also:
- StretchDIBits: full MS-EMF 2.3.1.7 layout (offBmiSrc, cbBmiSrc,
  offBitsSrc, cbBitsSrc, iUsageSrc, dwRop, cxDest, cyDest) instead
  of stubbed rest body. Enables bitmap rendering in emfsvg.
- PolyTextOutA/W: class name fix (PolyTextout -> PolyTextOut) to
  match autoload.
- ColorMatchToTargetW: class name fix to match autoload.

Round-trip verified: 208/208 byte-identical.
@ronaldtse
ronaldtse merged commit 7bda43e into main Jul 24, 2026
@ronaldtse
ronaldtse deleted the feat/bitmap-and-naming-fixes branch July 24, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant