2003-03-10 21:47:38 -05:00
|
|
|
;; Copyright (c) 2001-2003 by Norbert Frese, David Frese
|
2001-07-16 09:53:08 -04:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
;; *** create or destroy pixmaps *************************************
|
2001-07-16 09:53:08 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function create-pixmap (display drawable width height depth)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Create_Pixmap")
|
2001-07-16 09:53:08 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function free-pixmap (display pixmap)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Free_Pixmap")
|
|
|
|
|
|
|
|
;; *** manipulate bitmaps ********************************************
|
2002-03-17 10:41:56 -05:00
|
|
|
|
2003-03-10 21:47:38 -05:00
|
|
|
(define (bitmap-error i data) ;; TODO exceptions ?!
|
|
|
|
(case i
|
|
|
|
((0) #t) ;; no error
|
|
|
|
((1) (error "could not open file" data))
|
|
|
|
((2) (error "invalid bitmap data in file" data))
|
|
|
|
((3) (error "not enough memory to create bitmap" data))))
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function %read-bitmap-file (display drawable filename)
|
2003-03-10 21:47:38 -05:00
|
|
|
"scx_Read_Bitmap_File")
|
|
|
|
|
|
|
|
;; returns a list (pixmap width height x-hot y-hot). May raise an error.
|
|
|
|
(define (read-bitmap-file display drawable filename)
|
|
|
|
(let ((res (%read-bitmap-file display drawable filename)))
|
|
|
|
(if (number? res)
|
|
|
|
(bitmap-error res filename)
|
|
|
|
res)))
|
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function %write-bitmap-file
|
2003-03-10 21:47:38 -05:00
|
|
|
(display filename bitmap width height x-hot y-hot)
|
|
|
|
"scx_Write_Bitmap_File")
|
|
|
|
|
|
|
|
(define (write-bitmap-file display filename bitmap width height x-hot y-hot)
|
|
|
|
(bitmap-error (%write-bitmap-file display filename bitmap width height
|
|
|
|
x-hot y-hot)
|
|
|
|
filename))
|
2002-03-17 10:41:56 -05:00
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; create-bitmap-from-data creates a new pixmap, consisting of the
|
|
|
|
;; image found in data, which has to be a string. Such an image can be
|
|
|
|
;; generated with write-bitmap-file. See XCreateBitmapFromData.
|
2001-07-16 09:53:08 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function create-bitmap-from-data (display drawable data w h)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Create_Bitmap_From_Data")
|
2001-07-16 09:53:08 -04:00
|
|
|
|
2001-10-09 11:32:54 -04:00
|
|
|
;; create-pixmap-from-bitmap-data creates a pixmap of the given depth
|
|
|
|
;; and then does a bitmap-format XPutImage of the data into it. See
|
|
|
|
;; XCreatePixmapFromBitmapData.
|
2001-07-16 09:53:08 -04:00
|
|
|
|
2003-05-01 17:05:33 -04:00
|
|
|
(import-xlib-function create-pixmap-from-bitmap-data
|
2003-03-10 21:47:38 -05:00
|
|
|
(display drawable data width height foreground background depth)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Create_Pixmap_From_Bitmap_Data")
|
2001-07-16 09:53:08 -04:00
|
|
|
|