2001-07-16 09:53:08 -04:00
|
|
|
;; author -> Norbert Freudemann
|
|
|
|
;; creation date : 16/07/2001
|
|
|
|
;; last change : 16/07/2001
|
|
|
|
|
|
|
|
; ---
|
|
|
|
|
|
|
|
(define (create-pixmap drawable width height depth)
|
2001-07-30 10:43:22 -04:00
|
|
|
(let* ((display (drawable-display drawable))
|
|
|
|
(pixmap (%create-pixmap (display-Xdisplay display)
|
|
|
|
(drawable-Xobject drawable)
|
|
|
|
width height depth)))
|
|
|
|
(make-pixmap pixmap display #t)))
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %create-pixmap (Xdisplay Xdrawable w h depth)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Create_Pixmap")
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
; ---
|
|
|
|
|
|
|
|
(define (create-bitmap-from-data window data width height)
|
2001-07-30 10:43:22 -04:00
|
|
|
(let* ((display (window-display window))
|
|
|
|
(Xpixmap (%create-bitmap-from-data (display-Xdisplay display)
|
|
|
|
(window-Xwindow window)
|
|
|
|
data width height)))
|
2001-07-19 11:19:07 -04:00
|
|
|
(make-pixmap Xpixmap display #t)))
|
2001-07-16 09:53:08 -04:00
|
|
|
|
2001-07-18 11:45:54 -04:00
|
|
|
(import-lambda-definition %create-bitmap-from-data (Xdisplay Xdrawable data w h)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Create_Bitmap_From_Data")
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
; ---
|
|
|
|
|
|
|
|
(define (create-pixmap-from-bitmap-data win data widht height
|
|
|
|
foregrnd backgrnd depth)
|
2001-07-30 10:43:22 -04:00
|
|
|
(let* ((display (window-display window))
|
|
|
|
(pixmap (create-pixmap-from-bitmap-data (display-Xdisplay display)
|
|
|
|
(window-Xwindow window)
|
|
|
|
data widht height foregrnd
|
|
|
|
backgrd depth)))
|
2001-07-19 11:19:07 -04:00
|
|
|
(make-pixmap pixmap display #t)))
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
(import-lambda-definition %create-pixmap-from-bitmap-data
|
|
|
|
(Xdisplay Xdrawabel data w h f b depth)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Create_Pixmap_From_Bitmap_Data")
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
; Returns a list of five elements: (pixmap widht heigth x y)
|
|
|
|
|
|
|
|
(define (read-bitmap-file drawable filename)
|
|
|
|
(let ((res (%read-bitmap-file (display-Xdisplay (drawable-display drawable))
|
|
|
|
(drawable-Xobject drawable)
|
|
|
|
filename)))
|
2001-08-21 10:57:08 -04:00
|
|
|
(if (pair? res)
|
|
|
|
(set-car! res (make-pixmap (car res) (drawable-display drawable) #t))
|
|
|
|
res)))
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
(import-lambda-definition %read-bitmap-file (Xdisplay Xdrawable file)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Read_Bitmap_File")
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
; --- coord is optional. It should be the empty list or (x-hot y-hot)
|
|
|
|
|
|
|
|
(define (write-bitmap-file filename pixmap width height . coord)
|
|
|
|
(let ((dpy (display-Xdisplay (pixmap-display pixmap)))
|
|
|
|
(xy-hot (cond
|
|
|
|
((null? coord) (list -1 -1))
|
|
|
|
((null? (cdr coord))
|
|
|
|
(error "zero or both coordinates must be defined"))
|
|
|
|
(else coord))))
|
2001-07-30 10:43:22 -04:00
|
|
|
(%write-bitmap-file dpy filename pixmap widht height
|
|
|
|
(car xy-hot) (cadr xy-hot))))
|
2001-07-16 09:53:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
(import-lambda-definition %write-bitmap-file (Xdisplay file Xpixmap w h x y)
|
2001-07-31 10:54:53 -04:00
|
|
|
"scx_Write_Bitmap_File")
|