diff options
author | scuri <scuri> | 2010-06-16 21:09:54 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-06-16 21:09:54 +0000 |
commit | 483f59d3a55720c8c140aef863f4d34a0d90cca8 (patch) | |
tree | 914494291b1870c2b50e7c252c156c91133e9a62 /test/simple/simple.c | |
parent | 72857b1207600b10bd73e9b1fee479438aae3ac9 (diff) |
*** empty log message ***
Diffstat (limited to 'test/simple/simple.c')
-rw-r--r-- | test/simple/simple.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/test/simple/simple.c b/test/simple/simple.c index 5f21d18..45cb8d3 100644 --- a/test/simple/simple.c +++ b/test/simple/simple.c @@ -223,10 +223,17 @@ int SimpleDrawWindow(void) void DrawCanvasDriver(cdContext* ctx, char* StrData) { cdCanvas* tmpCanvas = cdCreateCanvas(ctx, StrData); - if (tmpCanvas == NULL) return; + if (tmpCanvas == NULL) + { + printf("CreateCanvas(%s) - Failed!\n", StrData); + return; + } + printf("CreateCanvas(%s)\n", StrData); cdActivate(tmpCanvas); SimpleDraw(); cdKillCanvas(tmpCanvas); + printf("KillCanvas()\n"); + cdActivate(curCanvas); } @@ -237,10 +244,12 @@ void DrawCanvasDriverSize(cdContext* ctx, char* name, int pixels) double w_mm, h_mm; cdActivate(curCanvas); cdGetCanvasSize(&w, &h, &w_mm, &h_mm); - if (pixels) + if (pixels == 1) sprintf(StrData, "%s %dx%d", name, w, h); + else if (pixels == 2) + sprintf(StrData, "%s -w%g -h%g -s%g", name, w_mm, h_mm, ((double)w/w_mm)*25.4); else - sprintf(StrData, "%s %gx%g", name, w_mm, h_mm); + sprintf(StrData, "%s %gx%g %g", name, w_mm, h_mm, (double)w/w_mm); DrawCanvasDriver(ctx, StrData); } @@ -262,7 +271,7 @@ int SimpleDrawDebug(void) int SimpleDrawCGMText(void) { - DrawCanvasDriverSize(CD_CGM, "simple_t.cgm - t", 0); + DrawCanvasDriverSize(CD_CGM, "simple_t.cgm -t", 0); return 0; } @@ -300,7 +309,7 @@ int SimpleDrawMetafile(void) int SimpleDrawPS(void) { - DrawCanvasDriver(CD_PS, "simple.ps"); + DrawCanvasDriverSize(CD_PS, "simple.ps -l0 -r0 -t0 -b0", 2); return 0; } @@ -312,13 +321,13 @@ int SimpleDrawSVG(void) int SimpleDrawPDF(void) { - DrawCanvasDriver(CD_PDF, "simple.pdf"); + DrawCanvasDriverSize(CD_PDF, "simple.pdf", 2); return 0; } int SimpleDrawEPS(void) { - DrawCanvasDriver(CD_PS, "simple.eps -e"); + DrawCanvasDriverSize(CD_PS, "simple.eps -e", 2); return 0; } @@ -339,7 +348,7 @@ int SimpleDrawPrint(void) int SimpleDrawPrintDialog(void) { if (gdpiplus) cdUseContextPlus(1); - DrawCanvasDriver(CD_PRINTER, "simple -d"); + DrawCanvasDriver(CD_PRINTER, "simple -d"); /* show dialog */ if (gdpiplus) cdUseContextPlus(0); return 0; } |