2001-05-08 10:21:00 -04:00
|
|
|
#include "xlib.h"
|
2001-07-09 09:39:59 -04:00
|
|
|
#include "scheme48.h"
|
|
|
|
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Free_Pixmap (s48_value Xdisplay, s48_value Xpixmap){
|
|
|
|
XFreePixmap (SCX_EXTRACT_DISPLAY(Xdisplay), SCX_EXTRACT_PIXMAP(Xpixmap));
|
2001-07-16 09:22:50 -04:00
|
|
|
return S48_UNSPECIFIC;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Create_Pixmap (s48_value Xdisplay, s48_value Xdrawable, s48_value w,
|
2001-07-16 09:22:50 -04:00
|
|
|
s48_value h, s48_value depth){
|
2001-07-31 10:51:21 -04:00
|
|
|
Pixmap pm = XCreatePixmap (SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_DRAWABLE(Xdrawable),
|
2001-07-16 09:22:50 -04:00
|
|
|
(int)s48_extract_integer (w),
|
|
|
|
(int)s48_extract_integer (h),
|
|
|
|
(int)s48_extract_integer (depth));
|
2001-07-31 10:51:21 -04:00
|
|
|
return SCX_ENTER_PIXMAP(pm);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Create_Bitmap_From_Data (s48_value Xdisplay, s48_value Xdrawable,
|
2001-07-16 09:22:50 -04:00
|
|
|
s48_value data, s48_value w, s48_value h){
|
2001-07-31 10:51:21 -04:00
|
|
|
Pixmap pm = XCreateBitmapFromData (SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_DRAWABLE(Xdrawable),
|
2001-07-16 09:22:50 -04:00
|
|
|
s48_extract_string(data),
|
|
|
|
s48_extract_integer(w),
|
|
|
|
s48_extract_integer(h));
|
2001-07-31 10:51:21 -04:00
|
|
|
return SCX_ENTER_PIXMAP(pm);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Create_Pixmap_From_Bitmap_Data (s48_value Xdisplay,
|
2001-07-16 09:22:50 -04:00
|
|
|
s48_value Xdrawable, s48_value data,
|
|
|
|
s48_value w,s48_value h, s48_value f,
|
|
|
|
s48_value b, s48_value d){
|
2001-07-31 10:51:21 -04:00
|
|
|
Pixmap pm = XCreatePixmapFromBitmapData (SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_DRAWABLE(Xdrawable),
|
2001-07-16 09:22:50 -04:00
|
|
|
s48_extract_string(data),
|
|
|
|
(int)s48_extract_integer(w),
|
|
|
|
(int)s48_extract_integer(h),
|
|
|
|
s48_extract_integer(f),
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_extract_integer(b),
|
2001-07-16 09:22:50 -04:00
|
|
|
(int)s48_extract_integer(d));
|
2001-07-31 10:51:21 -04:00
|
|
|
return SCX_ENTER_PIXMAP(pm);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Read_Bitmap_File (s48_value Xdisplay, s48_value Xdrawable,
|
|
|
|
s48_value file){
|
2001-07-16 09:22:50 -04:00
|
|
|
unsigned width, height;
|
|
|
|
int res, xhot, yhot;
|
|
|
|
Pixmap bitmap;
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value ret = S48_FALSE;
|
2001-07-16 09:22:50 -04:00
|
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
|
|
// Not used: Disable_Interrupts;
|
2001-08-22 07:56:46 -04:00
|
|
|
res = XReadBitmapFile (SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
SCX_EXTRACT_DRAWABLE(Xdrawable),
|
2001-07-16 09:22:50 -04:00
|
|
|
s48_extract_string(file), &width, &height, &bitmap,
|
|
|
|
&xhot, &yhot);
|
|
|
|
// Not used: Enable_Interrupts;
|
|
|
|
if (res != BitmapSuccess){
|
2001-08-22 07:56:46 -04:00
|
|
|
return Bit_To_Symbol ((unsigned long)ret, Bitmapstatus_Syms);
|
2001-07-16 09:22:50 -04:00
|
|
|
}
|
|
|
|
S48_GC_PROTECT_1 (ret);
|
|
|
|
ret = s48_cons (s48_enter_integer(yhot), S48_NULL);
|
|
|
|
ret = s48_cons (s48_enter_integer(xhot), ret);
|
|
|
|
ret = s48_cons (s48_enter_integer(height), ret);
|
|
|
|
ret = s48_cons (s48_enter_integer(width), ret);
|
2001-07-31 10:51:21 -04:00
|
|
|
ret = s48_cons (SCX_ENTER_PIXMAP(bitmap), ret);
|
2001-07-16 09:22:50 -04:00
|
|
|
S48_GC_UNPROTECT();
|
|
|
|
return ret;
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
s48_value scx_Write_Bitmap_File (s48_value Xdisplay, s48_value file,
|
2001-07-16 09:22:50 -04:00
|
|
|
s48_value Xbitmap, s48_value w, s48_value h,
|
|
|
|
s48_value x, s48_value y){
|
|
|
|
int ret;
|
|
|
|
// Not used: Disable_Interrupts;
|
2001-07-31 10:51:21 -04:00
|
|
|
ret = XWriteBitmapFile (SCX_EXTRACT_DISPLAY(Xdisplay),
|
|
|
|
s48_extract_string(file),
|
|
|
|
SCX_EXTRACT_PIXMAP(Xbitmap),
|
|
|
|
(int)s48_extract_integer(w),
|
2001-07-16 09:22:50 -04:00
|
|
|
(int)s48_extract_integer(h),
|
|
|
|
(int)s48_extract_integer(x),
|
|
|
|
(int)s48_extract_integer(y));
|
|
|
|
// Enable_Interrupts;
|
2001-08-22 07:56:46 -04:00
|
|
|
return Bit_To_Symbol ((unsigned long)ret, Bitmapstatus_Syms);
|
2001-05-08 10:21:00 -04:00
|
|
|
}
|
|
|
|
|
2001-07-09 09:39:59 -04:00
|
|
|
|
2001-07-31 10:51:21 -04:00
|
|
|
void scx_init_pixmap(void) {
|
|
|
|
S48_EXPORT_FUNCTION(scx_Free_Pixmap);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Create_Pixmap);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Create_Bitmap_From_Data);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Create_Pixmap_From_Bitmap_Data);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Read_Bitmap_File);
|
|
|
|
S48_EXPORT_FUNCTION(scx_Write_Bitmap_File);
|
2001-07-09 09:39:59 -04:00
|
|
|
}
|
2001-07-16 09:22:50 -04:00
|
|
|
|