Hi,

The latest version of ps.c does not compile when using Microsoft Visual Studio 
2008 express edition. 

The problem is that (in Standard C) the declaration of pxlx and pxly has to 
come before the newly added code. 

The attached patch fixes the problem.

Kind regards

Terrence



----- Original Message ----
From: Andrew Ross <[EMAIL PROTECTED]>
To: Davide Cesari <[EMAIL PROTECTED]>
Cc: plplot-devel@lists.sourceforge.net
Sent: Thursday, 4 December, 2008 10:45:27
Subject: Re: [Plplot-devel] Setting arbitrary plot size in postscript


Davide,

Thanks for the patch. As you say, the default behaviour is unchanged so
I can see no reason not to apply your patch. I have committed it to svn.

Andrew

On Tue, Dec 02, 2008 at 01:45:03PM +0100, Davide Cesari wrote:
> Dear plplot maintainers,
>     I need to make big sized postscript plots with many details, and it is 
> not satisfactory just to zoom a small plot because many features (line 
> width, font sizes, etc.) have a default absolute size and look bad when 
> zoomed. On the other side I noticed that the ps driver has an hardcoded 
> physical page size (XSIZE, YSIZE in ps.h) which cannot be changed by the 
> user, as far as I know.
>     If this is true, then I propose a patch which could give the chance to 
> change the postscript page size with plspag through a combination of the 
> (xp,xleng) and (yp,yleng) parameters, currently unused for ps, so that 
> the page size in postscript points would be xleng*xp/72,yleng*yp/72. The 
> patch leaves the default behavior unchanged  and does not change the 
> API, so I think its implementation would not break any existing 
> application and would have also the positive side effect to set xleng 
> and yleng for postscript (I remember the "Undistorted circles" thread 
> where these values were used to get the physical aspect ratio, see 
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg00424.html
> ).
>     If you think there is something wrong, or the same result could be 
> achieved in a different way, please do it as you feel correct, but I 
> would really be interested to see such a feature in a future version of 
> plplot.
>     The patch applies to ps and psttf drivers, maybe other drivers could 
> benefit from such an approach?
>     I inline the patch since it is quite simple:
> 
> --- plplot-5.9.0/include/ps.h~  2007-11-18 21:04:07.000000000 +0100
> +++ plplot-5.9.0/include/ps.h   2008-12-02 12:29:02.000000000 +0100
> @@ -10,8 +10,8 @@
> 
>   #define LINELENGTH      78
>   #define COPIES          1
> -#define XSIZE           540            /* 7.5 x 10 [inches]    */
> -#define YSIZE           720            /* (72 points = 1 inch) */
> +#define XSIZE           (int) (pls->xlength*(pls->xdpi/72.))
> +#define YSIZE           (int) (pls->ylength*(pls->ydpi/72.))
>   #define ENLARGE         5
>   #define XPSSIZE         ENLARGE*XSIZE
>   #define YPSSIZE         ENLARGE*YSIZE
> --- plplot-5.9.0/drivers/ps.c~  2007-11-18 21:04:11.000000000 +0100
> +++ plplot-5.9.0/drivers/ps.c   2008-12-02 13:21:14.000000000 +0100
> @@ -156,6 +156,14 @@
>   {
>       PSDev *dev;
> 
> +/* Set default values */
> +    if (pls->xlength <= 0 || pls->ylength <=0) {
> +      pls->xlength = 540;
> +      pls->ylength = 720;
> +    }
> +    if (pls->xdpi <= 0) pls->xdpi = 72.;
> +    if (pls->ydpi <= 0) pls->ydpi = 72.;
> +
>       PLFLT pxlx = YPSSIZE/LPAGE_X;
>       PLFLT pxly = XPSSIZE/LPAGE_Y;
> 
> --- plplot-5.9.0/drivers/psttf.cc~      2007-11-18 21:04:10.000000000 +0100
> +++ plplot-5.9.0/drivers/psttf.cc       2008-12-02 13:20:59.000000000 +0100
> @@ -195,6 +195,14 @@
>       PSDev *dev;
>       PostscriptDocument *doc;
> 
> +/* Set default values */
> +    if (pls->xlength <= 0 || pls->ylength <=0) {
> +      pls->xlength = 540;
> +      pls->ylength = 720;
> +    }
> +    if (pls->xdpi <= 0) pls->xdpi = 72.;
> +    if (pls->ydpi <= 0) pls->ydpi = 72.;
> +
>       PLFLT pxlx = YPSSIZE/LPAGE_X;
>       PLFLT pxly = XPSSIZE/LPAGE_Y;
> 
> 
> thank you and best regards, Davide
> 
> 
> -- 
> ============================= Davide Cesari ============================
> Servizio IdroMeteorologico ARPA Emilia Romagna
> Area Modellistica Numerica e Radarmeteorologia
>   Phone/Fax: +39 051525926/+39 0516497501
>   E-mail:    [EMAIL PROTECTED]
>   Home page: http://www.webalice.it/o.drofa/davide/
>   Address:   ARPA-SIM, Viale Silvani 6, 40122 Bologna, Italy
> ========================================================================
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Plplot-devel mailing list
> Plplot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plplot-devel
> 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel



      

Attachment: ps.c.patch
Description: Binary data

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to