View Issue Details

IDProjectCategoryView StatusLast Update
0017214LazarusLCLpublic2010-09-16 15:14
ReporterPatrick ChevalleyAssigned ToJesus Reyes 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0017214: PostScriptCanvas RoundRect problem with resolution change
DescriptionPostScriptCanvas RoundRect only work correctly with a resolution of 72.
Corner arc get bigger with a total figure deformation if the resolution increase.

Easy to reproduce with the PostScriptCanvas example:
Set the X and Y resolution to 300 and then 600 and observe the deformation of the red roundrect at the top of the page.

BTW with svn 27154 I have to comment the last Rectangle and Textrect to compile the example.
TagsNo tags attached.
Fixed in Revision27349
LazTarget0.9.30
WidgetsetGTK 2
Attached Files
  • postscriptcanvas.patch (1,019 bytes)
    Index: lcl/postscriptcanvas.pas
    ===================================================================
    --- lcl/postscriptcanvas.pas	(révision 27154)
    +++ lcl/postscriptcanvas.pas	(copie de travail)
    @@ -1762,6 +1762,7 @@
       ellipsePath : string;
       //fs:TFormatSettings;
       pp1,pp2:TpsPoint;
    +  drx, dry: Single;
     begin
       Changing;
       RequiredState([csHandleValid, csBrushValid, csPenValid]);
    @@ -1789,7 +1790,13 @@
       {choice between newpath and moveto beginning of arc
        go with newpath for precision, does this violate any assumptions in code???
        write(format('%d %d moveto',[x1+rx, y1]),Lst  # this also works}
    +
       WriteB('newpath');
    +  // recalculate rx,ry
    +  PixelsToPoints(rx,ry,drx,dry); // drx,dry - coordinates in points (1/72 in)
    +  rx:=round(drx);
    +  ry:=round(dry);
    +  WriteB('newpath');
       WriteB(Format(ellipsePath,[pp1.fx+rx,pp1.fy-ry,rx,ry,90,180],FFs));
       WriteB(Format(ellipsePath,[pp1.fx+rx,pp2.fy+ry,rx,ry,180,270],FFs));
       WriteB(Format(ellipsePath,[pp2.fx-rx,pp2.fy+ry,rx,ry,270,360],FFs));
    
    postscriptcanvas.patch (1,019 bytes)

Activities

Anton Kavalenka

2010-08-20 12:04

reporter   ~0040313

Last edited: 2010-08-20 12:07

Seems like radiuses (rx,ry) are not scaled according to current resolution

Painting should be implemented in that way
postscriptcanvas.pas line 1792

WriteB('newpath');
// recalculate rx,ry
PixelsToPoints(rx,ry,drx,dry); // drx,dry - coordinates in points (1/72 in)
WriteB(Format(ellipsePath,[pp1.fx+drx,pp1.fy-dry,drx,dry,90,180],FFs));
WriteB(Format(ellipsePath,[pp1.fx+drx,pp2.fy+dry,drx,dry,180,270],FFs));
WriteB(Format(ellipsePath,[pp2.fx-drx,pp2.fy+dry,drx,dry,270,360],FFs));
WriteB(Format(ellipsePath,[pp2.fx-drx,pp1.fy-dry,drx,dry,0,90],FFs));
WriteB('closepath');

2010-08-20 16:19

 

postscriptcanvas.patch (1,019 bytes)
Index: lcl/postscriptcanvas.pas
===================================================================
--- lcl/postscriptcanvas.pas	(révision 27154)
+++ lcl/postscriptcanvas.pas	(copie de travail)
@@ -1762,6 +1762,7 @@
   ellipsePath : string;
   //fs:TFormatSettings;
   pp1,pp2:TpsPoint;
+  drx, dry: Single;
 begin
   Changing;
   RequiredState([csHandleValid, csBrushValid, csPenValid]);
@@ -1789,7 +1790,13 @@
   {choice between newpath and moveto beginning of arc
    go with newpath for precision, does this violate any assumptions in code???
    write(format('%d %d moveto',[x1+rx, y1]),Lst  # this also works}
+
   WriteB('newpath');
+  // recalculate rx,ry
+  PixelsToPoints(rx,ry,drx,dry); // drx,dry - coordinates in points (1/72 in)
+  rx:=round(drx);
+  ry:=round(dry);
+  WriteB('newpath');
   WriteB(Format(ellipsePath,[pp1.fx+rx,pp1.fy-ry,rx,ry,90,180],FFs));
   WriteB(Format(ellipsePath,[pp1.fx+rx,pp2.fy+ry,rx,ry,180,270],FFs));
   WriteB(Format(ellipsePath,[pp2.fx-rx,pp2.fy+ry,rx,ry,270,360],FFs));
postscriptcanvas.patch (1,019 bytes)

Patrick Chevalley

2010-08-20 16:22

reporter   ~0040327

Thank you! this work.

I upload postscriptcanvas.patch that implement that a little differently because of Single - Integer conversion.

Jesus Reyes

2010-09-13 21:25

developer   ~0041038

patch applied with changes
thanks

Issue History

Date Modified Username Field Change
2010-08-20 09:55 Patrick Chevalley New Issue
2010-08-20 09:55 Patrick Chevalley Widgetset => GTK 2
2010-08-20 12:04 Anton Kavalenka Note Added: 0040313
2010-08-20 12:04 Anton Kavalenka Note Edited: 0040313
2010-08-20 12:05 Anton Kavalenka Note Edited: 0040313
2010-08-20 12:07 Anton Kavalenka Note Edited: 0040313
2010-08-20 16:19 Patrick Chevalley File Added: postscriptcanvas.patch
2010-08-20 16:22 Patrick Chevalley Note Added: 0040327
2010-08-21 19:32 Jesus Reyes Status new => assigned
2010-08-21 19:32 Jesus Reyes Assigned To => Jesus Reyes
2010-09-13 21:25 Jesus Reyes Fixed in Revision => 27349
2010-09-13 21:25 Jesus Reyes LazTarget => 0.9.30
2010-09-13 21:25 Jesus Reyes Status assigned => resolved
2010-09-13 21:25 Jesus Reyes Fixed in Version => 0.9.29 (SVN)
2010-09-13 21:25 Jesus Reyes Resolution open => fixed
2010-09-13 21:25 Jesus Reyes Note Added: 0041038
2010-09-13 21:25 Jesus Reyes Target Version => 0.9.30
2010-09-16 15:14 Patrick Chevalley Status resolved => closed