Worth a looka fix or feature you may want
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.
5 of 5 entries · 7 commits upstream
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.
Upgrade recommended
Upgrade if EMF content is exported to PDF, then compare transparent blits, Rectangle, Ellipse, FillRect and anisotropic RoundRect output against the source metafile.
Units
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.
Upgrade recommended
Upgrade GDI+ preview code that consumes TeeChart or other EMF files using EMR_MODIFYWORLDTRANSFORM, then compare line geometry at several zoom levels under Delphi and FPC.
Units
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.
Units
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.
Units
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.