You are not logged in.
Hello *,
After upgrading from SynPDF v1.15 to the latest version v1.18 my PDFs looks different: Some images are no longer flipped (or mirrored) as they used to be in the older version.
In detail:
I'm using QuickReport; and I use TPdfDocumentGDI to render QuickReport's pages (which are Windows EMF) into PDF. Some parts of this Metafiles are images (bitmaps), which need to be mirrored on the vertical axis to create a "left hand" and "right hand" look. I create those mirrored bitmaps by swapping left and right coordinates; which looks OK on display, in the print preview and on printer output (paper).
It also used to be OK with older SynPDF version, but after installing latest v1.18, those images are no longer mirrored in the PDF!
So what has been changed in SynPDF?
Perhaps the better question: How could I create a vertical mirrored bitmap which will look as intended in the PDF?
Screenshots of PDF in Adobe Reader X:
https://dl.dropboxusercontent.com/u/562 … _v1-15.jpg
https://dl.dropboxusercontent.com/u/562 … _v1-18.jpg
TIA
Kalwados.
Last edited by kalwados (2013-04-19 09:15:24)
Offline
A lot of changes did happen between the 1.15 and the 1.18.
Please see the history in the beginning of the unit, or http://synopse.info/fossil/finfo?name=SynPdf.pas
We will need some .emf file to reproduce the problem.
Some fixes were introduced about bitmap rendering, perhaps there is a regression here.
Offline
Hello AB,
I'll will provide some EMF files for testing soon.
Offline
Hello,
I finally found some time to analyze this problem:
In SynPDF V1.18 there was a small code change in function TPdfCanvas.RectI(): The call to NormalizeRect() was moved from top to bottom of that function:
http://synopse.info/fossil/info/2bb4d7686e
Old:
function TPdfCanvas.RectI(Rect: TRect): TPdfRect; TPdfRect;
begin
NormalizeRect(Rect); <<<<<<<<<<
result.Left := I2X(Rect.Left);
result.Right := I2X(Rect.Right);
result.Top := I2Y(Rect.Bottom);
result.Bottom := I2Y(Rect.Top);
end;
New:
function TPdfCanvas.RectI(Rect: TRect): TPdfRect; TPdfRect;
begin
result.Left := I2X(Rect.Left);
result.Right := I2X(Rect.Right);
result.Top := I2Y(Rect.Bottom);
result.Bottom := I2Y(Rect.Top);
NormalizeRect(Rect); <<<<<<<<<<
end;
The call to NormalizeRect() was moved from the first line to the last line of the code, causing my mirrored bitmaps to appear non-mirrored. If I change this function back to the older version, my PDF files look OK again.
But I think there was some very good reason to change the behaviour of TPdfCanvas.RectI(), however I do not know that reason.
Here is a sample EMF file which I used for testing:
https://dl.dropboxusercontent.com/u/562 … bitmap.emf
Is reverting the code of TPdfCanvas.RectI() back to version 1.17 the correct solution?
TIA
Kalwados
Offline
NormalizeRect(Rect) does not make sense, but this is not the new code:
function TPdfCanvas.RectI(Rect: TRect): TPdfRect;
begin
result.Left := I2X(Rect.Left);
result.Right := I2X(Rect.Right);
result.Top := I2Y(Rect.Top);
result.Bottom := I2Y(Rect.Bottom);
NormalizeRect(result);
end;
This code sounds just fine, doesn't it?
Offline
Sorry, copy & paste error :-(
The new code is indeed using
NormalizeRect(result);
but that doesn't explain why the old code works fine, while the new code doesn't.
Any ideas how to solve that problem?
Offline
I suspect this is because the coordinate system is not oriented the same.
We went back to the previous code... until further notice.
See http://synopse.info/fossil/info/2e9c437afd
Thanks for the feedback.
Offline
I've a failing .emf file here from our regression tests...
I was not able to find a solution for both of them.
See http://synopse.info/fossil/info/3246866b44
But with this commit, the mirrored file is not working.
Any idea?
Offline