mORMot2 DailyDaily read of upstream commits

EMF and PDF rendering regain correct transforms, pens and transparency

Five Windows rendering fixes improve EMF conversion through both the GDI+ preview path and the PDF canvas. Teams exporting TeeChart or other GDI metafiles should care: transforms, negative coordinates, extended pens, rounded boxes and colour-keyed bitmaps could previously render at the wrong size, with the wrong pen or without transparency. Delphi and FPC keep the same application-facing API.

TL;DR

  • EMR_MODIFYWORLDTRANSFORM is now applied, so TeeChart lines using 1/16-pixel coordinates are no longer enlarged sixteenfold.
  • World transforms are retained in each GDI+ DC state and reapplied after RestoreDC or window and viewport changes.
  • Extended pens now contribute their colour, width and dash style instead of silently reusing the previously selected pen.
  • Signed 16-bit EMF points preserve negative coordinates during conversion.
  • PDF metafiles preserve colour-key transparency and use device-aware dimensions for GDI boxes and rounded corners.

Upgrade advice

For Windows applications that preview or export EMF content, land on 180e390d5aeb0e1d072e1300645fd0df42ade226, build 2.4.17677, which merges both rendering branches. Retest TeeChart output, nested metafiles, negative-coordinate paths, extended pen styles, transparent blits and anisotropic rounded rectangles. The raw payload records no superseded_by successor.

Commits7
Lines+266 -38
Read2 min

5 of 5 entries · 7 commits upstream

Stories
# Entry Category Units
1 Medium PDF metafiles keep colour-key transparency and GDI box dimensions In mormot.ui.pdf, TPdfDocument.CreateOrGetImage keeps bitmaps with TransparentMode = tmFixed out of the JPEG path so their PDF /Mask remains valid. TPdfCanvas adds DevPixelX, DevPixelY, BoxInclI and BoxExclI to distinguish inclusive Rectangle and Ellipse records from exclusive FillRect boxes. RoundRectI now maps both its bounds and corner radii through the active window and viewport transform. Fixes mormot.ui.pdf d6bd9f39+76-6

Add files via upload

Impact

EMF-to-PDF output no longer loses colour-key transparency under forced JPEG compression, and rectangles, ellipses, fills and rounded corners keep their intended device-pixel extent under anisotropic mappings. Delphi and FPC callers remain source-compatible; only Windows GDI/EMF rendering changes.

koxo · 13:16 UTC · view the commit on GitHub →

2 Medium TeeChart EMF transforms no longer enlarge lines sixteenfold EnumEmfCallback in mormot.lib.gdiplus now handles EMR_MODIFYWORLDTRANSFORM for MWT_IDENTITY, MWT_LEFTMULTIPLY, MWT_RIGHTMULTIP and MWT_SET, then rebuilds the GDI+ matrix through TGdiplusEnum.ScaleMatrix. An FPC-only CombineTransform proxy adapts the pointer and var declaration to the Delphi-style call used by the shared code. Fixes mormot.lib.gdiplus ad185713+28-0

gdiplus: EMR_MODIFYWORLDTRANSFORM support in EMF conversion

Impact

GDI+ previews of TeeChart metafiles now respect the 1/16-pixel transform used for chart lines instead of drawing them sixteen times too large. The FPC backend compiles the same transform logic through its declaration adapter; no application code changes are required.

chowette · 13:47 UTC · view the commit on GitHub →

3 Medium Nested EMF transforms survive DC restores and viewport changes TGdiplusEnumState now stores a TXForm WorldTransform for every saved DC state. EMR_SETWORLDTRANSFORM updates that field, while TGdiplusEnum.ScaleMatrix combines it with the window and viewport matrix whenever RestoreDC or the mapping extents and origins change. Fixes mormot.lib.gdiplus ce97a2ff+15-12

gdiplus: keep the EMF world transform in the DC state

Impact

World transforms are no longer lost when a metafile restores a device context or changes its mapping, including nested metafiles. Delphi and FPC applications do not need source changes, but Windows GDI+ preview output may move or scale to its intended position.

Worth a look

Recheck nested and saved-state EMF samples in the GDI+ preview, especially files that combine world transforms with window or viewport changes.

chowette · 13:42 UTC · view the commit on GitHub →

4 Medium Extended EMF pens no longer inherit the previously selected style EnumEmfCallback now handles EMR_EXTCREATEPEN in mormot.lib.gdiplus. It deletes any object already associated with the pen handle and creates a GDI+ pen from elpColor, elpWidth and PS_STYLE_MASK, using width zero for cosmetic pens. End caps, joins and brush styles remain intentionally unimplemented. Fixes mormot.lib.gdiplus 903d1cd0+13-0

gdiplus: EMR_EXTCREATEPEN support in EMF conversion

Impact

TeeChart and other EMF producers that use extended pens now render the requested colour, width and dash pattern instead of the previous pen. Complex cap, join and brush semantics may still differ from native GDI. Delphi and FPC application code is unchanged.

Worth a look

Compare extended-pen EMF samples with native GDI output, concentrating on colour, width and dash style while allowing for unsupported caps, joins and brush styles.

chowette · 13:38 UTC · view the commit on GitHub →

5 Medium Negative 16-bit EMF coordinates keep their sign during conversion Points16To32 in mormot.lib.gdiplus now casts every source word to smallint before assigning it to the 32-bit point buffer. EMR_POLYGON16, EMR_POLYLINE16 and EMR_POLYBEZIER16 coordinates therefore receive signed extension rather than zero extension. Fixes mormot.lib.gdiplus 9bf01841+1-1

gdiplus: fixed sign extension of 16-bit points in EMF conversion

Impact

A coordinate such as -8 is no longer converted to 65528, so compact polygon, polyline and Bézier records can render on the intended side of the origin. The correction is internal and identical for Delphi and FPC callers.

Worth a look

Retest EMF samples whose POLYGON16, POLYLINE16 or POLYBEZIER16 records cross the origin or use negative coordinates.

chowette · 13:36 UTC · view the commit on GitHub →

Upstream activity commits per day · last 60 days
Commits1007
Active days49/60
Busiest2026-09-30
Peak60
2026-09-30: 60 commits2026-10-01: 26 commits2026-10-02: 30 commits2026-10-03: 32 commits2026-10-04: 15 commits2026-10-05: 1 commit2026-10-06: 26 commits2026-10-07: 37 commits2026-10-08: 27 commits2026-10-09: 35 commits2026-10-10: 12 commits2026-10-11: 2 commits2026-10-12: 40 commits2026-10-13: 31 commits2026-10-14: 23 commits2026-10-15: 16 commits2026-10-16: 27 commits2026-10-17: 0 commits2026-10-18: 0 commits2026-10-19: 0 commits2026-10-20: 0 commits2026-10-21: 0 commits2026-10-22: 3 commits2026-10-23: 6 commits2026-10-24: 29 commits2026-10-25: 7 commits2026-10-26: 25 commits2026-10-27: 4 commits2026-10-28: 8 commits2026-10-29: 17 commits2026-10-30: 20 commits2026-10-31: 0 commits2026-11-01: 0 commits2026-11-02: 16 commits2026-11-03: 32 commits2026-11-04: 15 commits2026-11-05: 32 commits2026-11-06: 26 commits2026-11-07: 19 commits2026-11-08: 2 commits2026-11-09: 29 commits2026-11-10: 17 commits2026-11-11: 8 commits2026-11-12: 38 commits2026-11-13: 39 commits2026-11-14: 9 commits2026-11-15: 6 commits2026-11-16: 21 commits2026-11-17: 30 commits2026-11-18: 37 commits2026-11-19: 28 commits2026-11-20: 31 commits2026-11-21: 0 commits2026-11-22: 0 commits2026-11-23: 1 commit2026-11-24: 6 commits2026-11-25: 3 commits2026-11-26: 3 commits2026-11-27: 0 commits2026-11-28: 0 commits
2026-09-302026-11-28