patch from Alex

svn: r575
This commit is contained in:
Eli Barzilay 2005-08-09 20:18:37 +00:00
parent fab4b76258
commit 9bfbc7dcb6
3 changed files with 31 additions and 29 deletions

View File

@ -37,8 +37,8 @@
(define* pl-setup-page (define* pl-setup-page
(get-ffi-obj "c_plspage" libplplot (get-ffi-obj "c_plspage" libplplot
(_fun (xp : _plint = 0) (_fun (xp : _plflt = 0.0)
(yp : _plint = 0) (yp : _plflt = 0.0)
(xleng : _plint) (xleng : _plint)
(yleng : _plint) (yleng : _plint)
(xoff : _plint = 0) (xoff : _plint = 0)

View File

@ -65,6 +65,7 @@
(fields-with-accessors (fields-with-accessors
(height 300) (height 300)
(width 400) (width 400)
(out-file #f) ;; if file is not #f, keep the file
(x-min -5) (x-min -5)
(x-max 5) (x-max 5)
(y-min -5) (y-min -5)
@ -75,8 +76,7 @@
(device 'png) (device 'png)
(fgcolor '( 0 0 0)) (fgcolor '( 0 0 0))
(bgcolor '(255 255 255)) (bgcolor '(255 255 255))
(lncolor '(255 0 0 )) (lncolor '(255 0 0 )))
)
(define bitmap #f) (define bitmap #f)
(define x-size 400) (define x-size 400)
@ -126,18 +126,20 @@
(define (start-plot) (define (start-plot)
(cond (cond
[(eq? device 'png) [(eq? device 'png)
(set! bitmap (make-temporary-file)) (set! bitmap (if out-file
(build-path out-file)
(make-temporary-file)))
(init-colors) (init-colors)
(pl-setup-page width height) (pl-setup-page width height)
(pl-set-device "png") (pl-set-device "png")
(pl-set-output-file (path->string bitmap)) (pl-set-output-file (path->string bitmap))
(pl-init-plot)] (pl-init-plot)]
; [(eq? device 'mem) ; [(eq? device 'mem)
; (init-colors) ; (init-colors)
; (set! bitmap (make-u8vector (* x-size y-size 4) 255)) ; (set! bitmap (make-u8vector (* x-size y-size 4) 255))
; (pl-setup-memory x-size y-size bitmap) ; (pl-setup-memory x-size y-size bitmap)
; (pl-set-device "mem") ; (pl-set-device "mem")
; (pl-init-plot)] ; (pl-init-plot)]
[else [else
(error "Incorrect device specified")])) (error "Incorrect device specified")]))
@ -147,7 +149,7 @@
[(eq? device 'png) [(eq? device 'png)
(pl-finish-plot) (pl-finish-plot)
(load-file bitmap) (load-file bitmap)
(delete-file bitmap)] (or out-file (delete-file bitmap))]
; [(eq? device 'mem) ; [(eq? device 'mem)
; (pl-finish-plot) ; (pl-finish-plot)
; (set-bitmap (bits->bitmap-dc% bitmap))] ; (set-bitmap (bits->bitmap-dc% bitmap))]