The R Project SVN R

Rev

Rev 80542 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80542 Rev 81221
Line 69... Line 69...
69
	metafile_base = new_object(BaseObject, 0, NULL);
69
	metafile_base = new_object(BaseObject, 0, NULL);
70
    return metafile_base;
70
    return metafile_base;
71
}
71
}
72
 
72
 
73
/* width and height are in mm */
73
/* width and height are in mm */
74
metafile newmetafile(const char *name, double width, double height)
74
metafile newmetafile(const char *name, double width, double height,
-
 
75
                     double xpinch, double ypinch)
75
{
76
{
76
    metafile obj;
77
    metafile obj;
77
    HDC hDC;
78
    HDC hDC;
78
    RECT wr;
79
    RECT wr;
79
    static double cppix=-1, ppix, cppiy, ppiy;
80
    static double cppix=-1, ppix, cppiy, ppiy;
80
 
81
 
-
 
82
    /* If user has overridden, do not query Windows for device info */
-
 
83
    if (xpinch > 0.0 && ypinch > 0.0) {
-
 
84
        cppix = xpinch;
-
 
85
        ppix = 100 * xpinch;
-
 
86
        cppiy = ypinch;
-
 
87
        ppiy = 100 * ypinch;
-
 
88
    } else {
81
    /*
89
        /*
82
     * In theory, (cppix=ppix) and (cppiy=ppiy). However, we
90
         * In theory, (cppix=ppix) and (cppiy=ppiy). However, we
83
     * use the ratio to adjust the 'reference dimension'
91
         * use the ratio to adjust the 'reference dimension'
84
     * in case.... ("Importing graph in MsWord" thread)
92
         * in case.... ("Importing graph in MsWord" thread)
85
     */
93
         */
86
    if (cppix < 0) {
94
        if (cppix < 0) {
87
	cppix = 25.40 * devicewidth(NULL) / devicewidthmm(NULL);
95
            cppix = 25.40 * devicewidth(NULL) / devicewidthmm(NULL);
88
	ppix  = 100 * devicepixelsx(NULL);
96
            ppix  = 100 * devicepixelsx(NULL);
89
	cppiy = 25.40 * deviceheight(NULL) / deviceheightmm(NULL);
97
            cppiy = 25.40 * deviceheight(NULL) / deviceheightmm(NULL);
90
	ppiy = 100 * devicepixelsy(NULL);
98
            ppiy = 100 * devicepixelsy(NULL);
-
 
99
        }
91
    }
100
    }
92
    /* This is all very peculiar. We would really like to create
101
    /* This is all very peculiar. We would really like to create
93
       a metafile measured in some sensible units, but it seems
102
       a metafile measured in some sensible units, but it seems
94
       we get it in units of 0.01mm *on the current screen* with
103
       we get it in units of 0.01mm *on the current screen* with
95
       horizontal and vertical resolution set for that screen.
104
       horizontal and vertical resolution set for that screen.