#include "xlib.h" #include "scheme48.h" s48_value Free_Pixmap (s48_value Xdisplay, s48_value Xpixmap){ XFreePixmap (EXTRACT_DISPLAY(Xdisplay), EXTRACT_PIXMAP(Xpixmap)); return S48_UNSPECIFIC; } s48_value Create_Pixmap (s48_value Xdisplay, s48_value Xdrawable, s48_value w, s48_value h, s48_value depth){ Pixmap pm = XCreatePixmap (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable), (int)s48_extract_integer (w), (int)s48_extract_integer (h), (int)s48_extract_integer (depth)); return S48_ENTER_PIXMAP(pm); } s48_value Create_Bitmap_From_Data (s48_value Xdisplay, s48_value Xdrawable, s48_value data, s48_value w, s48_value h){ Pixmap pm = XCreateBitmapFromData (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable), s48_extract_string(data), s48_extract_integer(w), s48_extract_integer(h)); return S48_ENTER_PIXMAP(pm); } s48_value Create_Pixmap_From_Bitmap_Data (s48_value Xdisplay, s48_value Xdrawable, s48_value data, s48_value w,s48_value h, s48_value f, s48_value b, s48_value d){ Pixmap pm = XCreatePixmapFromBitmapData (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable), s48_extract_string(data), (int)s48_extract_integer(w), (int)s48_extract_integer(h), s48_extract_integer(f), s48_extract_intgeger(b), (int)s48_extract_integer(d)); return S48_ENTER_PIXMAP(pm); } s48_value Read_Bitmap_File (s48_value Xdisplay, s48_value Xdrawable, s48_value file){ unsigned width, height; int res, xhot, yhot; Pixmap bitmap; s48_value ret; S48_DECLARE_GC_PROTECT(1); // Not used: Disable_Interrupts; res = XReadBitmapFile (EXTRACT_DISPLAY(Xdisplay), EXTRACT_DRAWABLE(Xdrawable), s48_extract_string(file), &width, &height, &bitmap, &xhot, &yhot); // Not used: Enable_Interrupts; if (res != BitmapSuccess){ return Bits_To_Symbols ((unsigned long)ret, Bitmapstatus_Syms); } 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); ret = s48_cons (S48_ENTER_PIXMAP(bitmap), ret); S48_GC_UNPROTECT(); return ret; } s48_value Write_Bitmap_File (s48_value Xdisplay, s48_value file, s48_value Xbitmap, s48_value w, s48_value h, s48_value x, s48_value y){ int ret; // Not used: Disable_Interrupts; ret = XWriteBitmapFile (EXTRACT_DISPLAY(Xdisplay), s48_extract_string(file), EXTRACT_PIXMAP(Xbitmap), (int)s48_extract_integer(w), (int)s48_extract_integer(h), (int)s48_extract_integer(x), (int)s48_extract_integer(y)); // Enable_Interrupts; return Bits_To_Symbols ((unsigned long)ret, Bitmapstatus_Syms); } void s48_init_pixmap(void) { S48_EXPORT_FUNCTION(Free_Pixmap); S48_EXPORT_FUNCTION(Create_Pixmap); S48_EXPORT_FUNCTION(Create_Bitmap_From_Data); S48_EXPORT_FUNCTION(Create_Pixmap_From_Bitmap_Data); S48_EXPORT_FUNCTION(Read_Bitmap_File); S48_EXPORT_FUNCTION(Write_Bitmap_File); }