Using GDI or integer-based method on the PdfCanvas
is causing a lot of precision problems for PDFs and printing.
To make PDF and printing more robust, the Canvas
class will now be separated into two subclasses, ToPixelCanvas
and VectorCanvas
.
In the future, PdfVectorCanvas
will be used instead, and it subclasses from VectorCanvas
where the methods will be floating-point based.
The PixelDevice
dc
field on Canvas
will be moved to ToPixelCanvas
.
Since VectorCanvas
will not use GDI, it's device context or dc
field will not be the PixelDevice
type, but VectorDevice
instead.
The VectorDevice
will support floating-point based methods instead.
// cm/core/graph/gAdvImage.cm, Class: GAdvImage Old: final public mrgn combinedClipRgn(Canvas gd, mrgn oldRgn) New: final public mrgn combinedClipRgn(ToPixelCanvas gd, mrgn oldRgn) // cm/core/windowView.cm, Class: WindowView Old: public Canvas canvas New: public ToPixelCanvas canvas // cm/draw/canvas.cm, Class Canvas Old: public constructor(PixelDevice c) New: public constructor() Removed: public PixelDevice dc // cm/draw/canvas.cm, new global function to make things compile easily rather than casting the Canvas to ToPixelCanvas New: public PixelDevice getCanvasDC(Canvas c) // cm/draw/gdiCanvas.cm Old: public class GdiCanvas extends Canvas New: public class GdiCanvas extends ToPixelCanvas // cm/std/print/photoLayoutSnapshot.cm, Class PhotoLayoutSnapshot Old: extend public void draw(Canvas canvas, rectI targetRect) : abstract New: extend public void draw(ToPixelCanvas canvas, rectI targetRect) : abstract // cm/std/print/photoLayoutSnapshot.cm, Class PhotoLayoutREDSnapshot Old: public void draw(Canvas canvas, rectI targetRect) New: public void draw(ToPixelCanvas canvas, rectI targetRect)
Canvas
implementations that subclass Canvas
directly, instead of a more specific implementation like GdiCanvas
will find many things not working, since many methods have been moved to ToPixelCanvas
. Try subclassing GdiCanvas
or ToPixelCanvas
instead.
See https://git.configura.com/cet/external/base/-/merge_requests/29409