Back to index

plt-scheme  4.2.1
wxs_bmap.cxx
Go to the documentation of this file.
00001 /* DO NOT EDIT THIS FILE. */
00002 /* This file was generated by xctocc from "wxs_bmap.xc". */
00003 
00004 
00005 #if defined(_MSC_VER)
00006 # include "wx.h"
00007 #endif
00008 #if defined(OS_X)
00009 # include "common.h"
00010 #endif
00011 
00012 #include "wx_gdi.h"
00013 
00014 
00015 
00016 
00017 #ifdef wx_x
00018 # define BM_SELECTED(map) ((map)->selectedTo)
00019 #endif
00020 #if defined(wx_mac) || defined(wx_msw)
00021 # define BM_SELECTED(map) ((map)->selectedInto)
00022 #endif
00023 # define BM_IN_USE(map) ((map)->selectedIntoDC)
00024 
00025 
00026 
00027 
00028 #define ESCAPE_NO_RET_VAL /*empty*/
00029 
00030 
00031 #include "wxscheme.h"
00032 #include "wxs_bmap.h"
00033 
00034 #ifdef MZ_PRECISE_GC
00035 START_XFORM_SKIP;
00036 #endif
00037 
00038 
00039 #ifndef wx_mac
00040 # define wxBITMAP_TYPE_PICT 101
00041 #endif
00042 
00043 #define wxBITMAP_TYPE_UNKNOWN 0
00044 #define wxBITMAP_TYPE_GIF_MASK (wxBITMAP_TYPE_GIF | wxBITMAP_TYPE_MASK)
00045 #define wxBITMAP_TYPE_PNG_MASK (wxBITMAP_TYPE_PNG | wxBITMAP_TYPE_MASK)
00046 
00047 static Scheme_Object *bitmapType_wxBITMAP_TYPE_BMP_sym = NULL;
00048 static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_sym = NULL;
00049 static Scheme_Object *bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = NULL;
00050 static Scheme_Object *bitmapType_wxBITMAP_TYPE_XBM_sym = NULL;
00051 static Scheme_Object *bitmapType_wxBITMAP_TYPE_XPM_sym = NULL;
00052 static Scheme_Object *bitmapType_wxBITMAP_TYPE_PICT_sym = NULL;
00053 static Scheme_Object *bitmapType_wxBITMAP_TYPE_JPEG_sym = NULL;
00054 static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_sym = NULL;
00055 static Scheme_Object *bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = NULL;
00056 static Scheme_Object *bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = NULL;
00057 static Scheme_Object *bitmapType_wxBITMAP_TYPE_MASK_sym = NULL;
00058 
00059 static void init_symset_bitmapType(void) {
00060   REMEMBER_VAR_STACK();
00061   wxREGGLOB(bitmapType_wxBITMAP_TYPE_BMP_sym);
00062   bitmapType_wxBITMAP_TYPE_BMP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bmp"));
00063   wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_sym);
00064   bitmapType_wxBITMAP_TYPE_GIF_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif"));
00065   wxREGGLOB(bitmapType_wxBITMAP_TYPE_GIF_MASK_sym);
00066   bitmapType_wxBITMAP_TYPE_GIF_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("gif/mask"));
00067   wxREGGLOB(bitmapType_wxBITMAP_TYPE_XBM_sym);
00068   bitmapType_wxBITMAP_TYPE_XBM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xbm"));
00069   wxREGGLOB(bitmapType_wxBITMAP_TYPE_XPM_sym);
00070   bitmapType_wxBITMAP_TYPE_XPM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xpm"));
00071   wxREGGLOB(bitmapType_wxBITMAP_TYPE_PICT_sym);
00072   bitmapType_wxBITMAP_TYPE_PICT_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("pict"));
00073   wxREGGLOB(bitmapType_wxBITMAP_TYPE_JPEG_sym);
00074   bitmapType_wxBITMAP_TYPE_JPEG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("jpeg"));
00075   wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_sym);
00076   bitmapType_wxBITMAP_TYPE_PNG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png"));
00077   wxREGGLOB(bitmapType_wxBITMAP_TYPE_PNG_MASK_sym);
00078   bitmapType_wxBITMAP_TYPE_PNG_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png/mask"));
00079   wxREGGLOB(bitmapType_wxBITMAP_TYPE_UNKNOWN_sym);
00080   bitmapType_wxBITMAP_TYPE_UNKNOWN_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown"));
00081   wxREGGLOB(bitmapType_wxBITMAP_TYPE_MASK_sym);
00082   bitmapType_wxBITMAP_TYPE_MASK_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("unknown/mask"));
00083 }
00084 
00085 static int unbundle_symset_bitmapType(Scheme_Object *v, const char *where) {
00086   SETUP_VAR_STACK(1);
00087   VAR_STACK_PUSH(0, v);
00088   if (!bitmapType_wxBITMAP_TYPE_MASK_sym) WITH_VAR_STACK(init_symset_bitmapType());
00089   if (0) { }
00090   else if (v == bitmapType_wxBITMAP_TYPE_BMP_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_BMP; }
00091   else if (v == bitmapType_wxBITMAP_TYPE_GIF_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF; }
00092   else if (v == bitmapType_wxBITMAP_TYPE_GIF_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_GIF_MASK; }
00093   else if (v == bitmapType_wxBITMAP_TYPE_XBM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XBM; }
00094   else if (v == bitmapType_wxBITMAP_TYPE_XPM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XPM; }
00095   else if (v == bitmapType_wxBITMAP_TYPE_PICT_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PICT; }
00096   else if (v == bitmapType_wxBITMAP_TYPE_JPEG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_JPEG; }
00097   else if (v == bitmapType_wxBITMAP_TYPE_PNG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG; }
00098   else if (v == bitmapType_wxBITMAP_TYPE_PNG_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG_MASK; }
00099   else if (v == bitmapType_wxBITMAP_TYPE_UNKNOWN_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_UNKNOWN; }
00100   else if (v == bitmapType_wxBITMAP_TYPE_MASK_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_MASK; }
00101   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "bitmapType symbol", -1, 0, &v));
00102   READY_TO_RETURN;
00103   return 0;
00104 }
00105 
00106 static Scheme_Object *bundle_symset_bitmapType(int v) {
00107   if (!bitmapType_wxBITMAP_TYPE_MASK_sym) init_symset_bitmapType();
00108   switch (v) {
00109   case wxBITMAP_TYPE_BMP: return bitmapType_wxBITMAP_TYPE_BMP_sym;
00110   case wxBITMAP_TYPE_GIF: return bitmapType_wxBITMAP_TYPE_GIF_sym;
00111   case wxBITMAP_TYPE_GIF_MASK: return bitmapType_wxBITMAP_TYPE_GIF_MASK_sym;
00112   case wxBITMAP_TYPE_XBM: return bitmapType_wxBITMAP_TYPE_XBM_sym;
00113   case wxBITMAP_TYPE_XPM: return bitmapType_wxBITMAP_TYPE_XPM_sym;
00114   case wxBITMAP_TYPE_PICT: return bitmapType_wxBITMAP_TYPE_PICT_sym;
00115   case wxBITMAP_TYPE_JPEG: return bitmapType_wxBITMAP_TYPE_JPEG_sym;
00116   case wxBITMAP_TYPE_PNG: return bitmapType_wxBITMAP_TYPE_PNG_sym;
00117   case wxBITMAP_TYPE_PNG_MASK: return bitmapType_wxBITMAP_TYPE_PNG_MASK_sym;
00118   case wxBITMAP_TYPE_UNKNOWN: return bitmapType_wxBITMAP_TYPE_UNKNOWN_sym;
00119   case wxBITMAP_TYPE_MASK: return bitmapType_wxBITMAP_TYPE_MASK_sym;
00120   default: return NULL;
00121   }
00122 }
00123 
00124 
00125 
00126 static Scheme_Object *saveBitmapType_wxBITMAP_TYPE_BMP_sym = NULL;
00127 static Scheme_Object *saveBitmapType_wxBITMAP_TYPE_XBM_sym = NULL;
00128 static Scheme_Object *saveBitmapType_wxBITMAP_TYPE_XPM_sym = NULL;
00129 static Scheme_Object *saveBitmapType_wxBITMAP_TYPE_JPEG_sym = NULL;
00130 static Scheme_Object *saveBitmapType_wxBITMAP_TYPE_PNG_sym = NULL;
00131 
00132 static void init_symset_saveBitmapType(void) {
00133   REMEMBER_VAR_STACK();
00134   wxREGGLOB(saveBitmapType_wxBITMAP_TYPE_BMP_sym);
00135   saveBitmapType_wxBITMAP_TYPE_BMP_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("bmp"));
00136   wxREGGLOB(saveBitmapType_wxBITMAP_TYPE_XBM_sym);
00137   saveBitmapType_wxBITMAP_TYPE_XBM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xbm"));
00138   wxREGGLOB(saveBitmapType_wxBITMAP_TYPE_XPM_sym);
00139   saveBitmapType_wxBITMAP_TYPE_XPM_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("xpm"));
00140   wxREGGLOB(saveBitmapType_wxBITMAP_TYPE_JPEG_sym);
00141   saveBitmapType_wxBITMAP_TYPE_JPEG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("jpeg"));
00142   wxREGGLOB(saveBitmapType_wxBITMAP_TYPE_PNG_sym);
00143   saveBitmapType_wxBITMAP_TYPE_PNG_sym = WITH_REMEMBERED_STACK(scheme_intern_symbol("png"));
00144 }
00145 
00146 static int unbundle_symset_saveBitmapType(Scheme_Object *v, const char *where) {
00147   SETUP_VAR_STACK(1);
00148   VAR_STACK_PUSH(0, v);
00149   if (!saveBitmapType_wxBITMAP_TYPE_PNG_sym) WITH_VAR_STACK(init_symset_saveBitmapType());
00150   if (0) { }
00151   else if (v == saveBitmapType_wxBITMAP_TYPE_BMP_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_BMP; }
00152   else if (v == saveBitmapType_wxBITMAP_TYPE_XBM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XBM; }
00153   else if (v == saveBitmapType_wxBITMAP_TYPE_XPM_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_XPM; }
00154   else if (v == saveBitmapType_wxBITMAP_TYPE_JPEG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_JPEG; }
00155   else if (v == saveBitmapType_wxBITMAP_TYPE_PNG_sym) { READY_TO_RETURN; return wxBITMAP_TYPE_PNG; }
00156   if (where) WITH_VAR_STACK(scheme_wrong_type(where, "saveBitmapType symbol", -1, 0, &v));
00157   READY_TO_RETURN;
00158   return 0;
00159 }
00160 
00161 
00162 static Bool IsColor(wxBitmap *bm)
00163 {
00164   return (bm->GetDepth() != 1);
00165 }
00166 
00167 extern void wxGetARGBPixels(wxBitmap *bm, double x, double y, int w, int h, char *s, Bool get_alpha);
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 class os_wxBitmap : public wxBitmap {
00182  public:
00183 
00184   os_wxBitmap CONSTRUCTOR_ARGS((bstring x0, int x1, int x2));
00185 #ifndef MZ_PRECISE_GC
00186   os_wxBitmap CONSTRUCTOR_ARGS((int x0, int x1, Bool x2 = 0));
00187 #endif
00188 #ifndef MZ_PRECISE_GC
00189   os_wxBitmap CONSTRUCTOR_ARGS((pathname x0, int x1 = 0, class wxColour* x2 = NULL));
00190 #endif
00191   ~os_wxBitmap();
00192 #ifdef MZ_PRECISE_GC
00193   void gcMark();
00194   void gcFixup();
00195 #endif
00196 };
00197 
00198 #ifdef MZ_PRECISE_GC
00199 void os_wxBitmap::gcMark() {
00200   wxBitmap::gcMark();
00201 }
00202 void os_wxBitmap::gcFixup() {
00203   wxBitmap::gcFixup();
00204 }
00205 #endif
00206 
00207 static Scheme_Object *os_wxBitmap_class;
00208 
00209 os_wxBitmap::os_wxBitmap CONSTRUCTOR_ARGS((bstring x0, int x1, int x2))
00210 CONSTRUCTOR_INIT(: wxBitmap(x0, x1, x2))
00211 {
00212 }
00213 
00214 #ifndef MZ_PRECISE_GC
00215 os_wxBitmap::os_wxBitmap CONSTRUCTOR_ARGS((int x0, int x1, Bool x2))
00216 CONSTRUCTOR_INIT(: wxBitmap(x0, x1, x2))
00217 {
00218 }
00219 #endif
00220 
00221 #ifndef MZ_PRECISE_GC
00222 os_wxBitmap::os_wxBitmap CONSTRUCTOR_ARGS((pathname x0, int x1, class wxColour* x2))
00223 CONSTRUCTOR_INIT(: wxBitmap(x0, x1, x2))
00224 {
00225 }
00226 #endif
00227 
00228 os_wxBitmap::~os_wxBitmap()
00229 {
00230     objscheme_destroy(this, (Scheme_Object *) __gc_external);
00231 }
00232 
00233 static Scheme_Object *os_wxBitmapwxGetARGBPixels(int n,  Scheme_Object *p[])
00234 {
00235   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00236   REMEMBER_VAR_STACK();
00237   objscheme_check_valid(os_wxBitmap_class, "get-argb-pixels in bitmap%", n, p);
00238   double x0;
00239   double x1;
00240   int x2;
00241   int x3;
00242   wbstring x4 INIT_NULLED_OUT;
00243   Bool x5;
00244 
00245   SETUP_VAR_STACK_REMEMBERED(2);
00246   VAR_STACK_PUSH(0, p);
00247   VAR_STACK_PUSH(1, x4);
00248 
00249   
00250   x0 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+0], "get-argb-pixels in bitmap%"));
00251   x1 = WITH_VAR_STACK(objscheme_unbundle_double(p[POFFSET+1], "get-argb-pixels in bitmap%"));
00252   x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], 0, 10000, "get-argb-pixels in bitmap%"));
00253   x3 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+3], 0, 10000, "get-argb-pixels in bitmap%"));
00254   x4 = (wbstring)WITH_VAR_STACK(objscheme_unbundle_mutable_bstring(p[POFFSET+4], "get-argb-pixels in bitmap%"));
00255   if (n > (POFFSET+5)) {
00256     x5 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+5], "get-argb-pixels in bitmap%"));
00257   } else
00258     x5 = FALSE;
00259 
00260   { if (!((wxBitmap *)((Scheme_Class_Object *)THEOBJ)->primdata)->Ok()) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap%","get-argb-pixels"), "bad bitmap: ", THEOBJ)); }if (SCHEME_BYTE_STRTAG_VAL(p[4+POFFSET]) < (x2 * x3 * 4)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap%","get-argb-pixels"), "byte string too short: ", p[4+POFFSET]));
00261   WITH_VAR_STACK(wxGetARGBPixels(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata), x0, x1, x2, x3, x4, x5));
00262 
00263   
00264   
00265   READY_TO_RETURN;
00266   return scheme_void;
00267 }
00268 
00269 static Scheme_Object *os_wxBitmapGetGLConfig(int n,  Scheme_Object *p[])
00270 {
00271   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00272   REMEMBER_VAR_STACK();
00273   class wxGLConfig* r;
00274   objscheme_check_valid(os_wxBitmap_class, "get-gl-config in bitmap%", n, p);
00275 
00276   SETUP_VAR_STACK_REMEMBERED(1);
00277   VAR_STACK_PUSH(0, p);
00278 
00279   
00280 
00281   
00282   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->GetGLConfig());
00283 
00284   
00285   
00286   READY_TO_RETURN;
00287   return WITH_REMEMBERED_STACK(objscheme_bundle_wxGLConfig(r));
00288 }
00289 
00290 static Scheme_Object *os_wxBitmapSetGLConfig(int n,  Scheme_Object *p[])
00291 {
00292   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00293   REMEMBER_VAR_STACK();
00294   objscheme_check_valid(os_wxBitmap_class, "set-gl-config in bitmap%", n, p);
00295   class wxGLConfig* x0 INIT_NULLED_OUT;
00296 
00297   SETUP_VAR_STACK_REMEMBERED(2);
00298   VAR_STACK_PUSH(0, p);
00299   VAR_STACK_PUSH(1, x0);
00300 
00301   
00302   x0 = WITH_VAR_STACK(objscheme_unbundle_wxGLConfig(p[POFFSET+0], "set-gl-config in bitmap%", 1));
00303 
00304   
00305   WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->SetGLConfig(x0));
00306 
00307   
00308   
00309   READY_TO_RETURN;
00310   return scheme_void;
00311 }
00312 
00313 static Scheme_Object *os_wxBitmapSetMask(int n,  Scheme_Object *p[])
00314 {
00315   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00316   REMEMBER_VAR_STACK();
00317   objscheme_check_valid(os_wxBitmap_class, "set-loaded-mask in bitmap%", n, p);
00318   class wxBitmap* x0 INIT_NULLED_OUT;
00319 
00320   SETUP_VAR_STACK_REMEMBERED(2);
00321   VAR_STACK_PUSH(0, p);
00322   VAR_STACK_PUSH(1, x0);
00323 
00324   
00325   x0 = WITH_VAR_STACK(objscheme_unbundle_wxBitmap(p[POFFSET+0], "set-loaded-mask in bitmap%", 0));
00326 
00327   
00328   WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->SetMask(x0));
00329 
00330   
00331   
00332   READY_TO_RETURN;
00333   return scheme_void;
00334 }
00335 
00336 static Scheme_Object *os_wxBitmapGetMask(int n,  Scheme_Object *p[])
00337 {
00338   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00339   REMEMBER_VAR_STACK();
00340   class wxBitmap* r;
00341   objscheme_check_valid(os_wxBitmap_class, "get-loaded-mask in bitmap%", n, p);
00342 
00343   SETUP_VAR_STACK_REMEMBERED(1);
00344   VAR_STACK_PUSH(0, p);
00345 
00346   
00347 
00348   
00349   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->GetMask());
00350 
00351   
00352   
00353   READY_TO_RETURN;
00354   return WITH_REMEMBERED_STACK(objscheme_bundle_wxBitmap(r));
00355 }
00356 
00357 static Scheme_Object *os_wxBitmapSaveFile(int n,  Scheme_Object *p[])
00358 {
00359   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00360   REMEMBER_VAR_STACK();
00361   Bool r;
00362   objscheme_check_valid(os_wxBitmap_class, "save-file in bitmap%", n, p);
00363   wpathname x0 INIT_NULLED_OUT;
00364   int x1;
00365   int x2;
00366 
00367   SETUP_VAR_STACK_REMEMBERED(2);
00368   VAR_STACK_PUSH(0, p);
00369   VAR_STACK_PUSH(1, x0);
00370 
00371   
00372   x0 = (wpathname)WITH_VAR_STACK(objscheme_unbundle_write_pathname(p[POFFSET+0], "save-file in bitmap%"));
00373   x1 = WITH_VAR_STACK(unbundle_symset_saveBitmapType(p[POFFSET+1], "save-file in bitmap%"));
00374   if (n > (POFFSET+2)) {
00375     x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], 0, 100, "save-file in bitmap%"));
00376   } else
00377     x2 = 75;
00378 
00379   
00380   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->SaveFile(x0, x1, x2));
00381 
00382   if (1) WITH_VAR_STACK(scheme_thread_block(0.0));
00383   
00384   READY_TO_RETURN;
00385   return (r ? scheme_true : scheme_false);
00386 }
00387 
00388 static Scheme_Object *os_wxBitmapLoadFile(int n,  Scheme_Object *p[])
00389 {
00390   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00391   REMEMBER_VAR_STACK();
00392   Bool r;
00393   objscheme_check_valid(os_wxBitmap_class, "load-file in bitmap%", n, p);
00394   pathname x0 INIT_NULLED_OUT;
00395   int x1;
00396   class wxColour* x2 INIT_NULLED_OUT;
00397 
00398   SETUP_VAR_STACK_REMEMBERED(3);
00399   VAR_STACK_PUSH(0, p);
00400   VAR_STACK_PUSH(1, x0);
00401   VAR_STACK_PUSH(2, x2);
00402 
00403   
00404   x0 = (pathname)WITH_VAR_STACK(objscheme_unbundle_pathname(p[POFFSET+0], "load-file in bitmap%"));
00405   if (n > (POFFSET+1)) {
00406     x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[POFFSET+1], "load-file in bitmap%"));
00407   } else
00408     x1 = 0;
00409   if (n > (POFFSET+2)) {
00410     x2 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+2], "load-file in bitmap%", 1));
00411   } else
00412     x2 = NULL;
00413 
00414   
00415   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->LoadFile(x0, x1, x2));
00416 
00417   if (r) WITH_VAR_STACK(scheme_thread_block(0.0));
00418   
00419   READY_TO_RETURN;
00420   return (r ? scheme_true : scheme_false);
00421 }
00422 
00423 static Scheme_Object *os_wxBitmapIsColor(int n,  Scheme_Object *p[])
00424 {
00425   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00426   REMEMBER_VAR_STACK();
00427   Bool r;
00428   objscheme_check_valid(os_wxBitmap_class, "is-color? in bitmap%", n, p);
00429 
00430   SETUP_VAR_STACK_REMEMBERED(1);
00431   VAR_STACK_PUSH(0, p);
00432 
00433   
00434 
00435   
00436   r = WITH_VAR_STACK(IsColor(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)));
00437 
00438   
00439   
00440   READY_TO_RETURN;
00441   return (r ? scheme_true : scheme_false);
00442 }
00443 
00444 static Scheme_Object *os_wxBitmapOk(int n,  Scheme_Object *p[])
00445 {
00446   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00447   REMEMBER_VAR_STACK();
00448   Bool r;
00449   objscheme_check_valid(os_wxBitmap_class, "ok? in bitmap%", n, p);
00450 
00451   SETUP_VAR_STACK_REMEMBERED(1);
00452   VAR_STACK_PUSH(0, p);
00453 
00454   
00455 
00456   
00457   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->Ok());
00458 
00459   
00460   
00461   READY_TO_RETURN;
00462   return (r ? scheme_true : scheme_false);
00463 }
00464 
00465 static Scheme_Object *os_wxBitmapGetWidth(int n,  Scheme_Object *p[])
00466 {
00467   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00468   REMEMBER_VAR_STACK();
00469   int r;
00470   objscheme_check_valid(os_wxBitmap_class, "get-width in bitmap%", n, p);
00471 
00472   SETUP_VAR_STACK_REMEMBERED(1);
00473   VAR_STACK_PUSH(0, p);
00474 
00475   
00476 
00477   
00478   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->GetWidth());
00479 
00480   
00481   
00482   READY_TO_RETURN;
00483   return scheme_make_integer(r);
00484 }
00485 
00486 static Scheme_Object *os_wxBitmapGetHeight(int n,  Scheme_Object *p[])
00487 {
00488   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00489   REMEMBER_VAR_STACK();
00490   int r;
00491   objscheme_check_valid(os_wxBitmap_class, "get-height in bitmap%", n, p);
00492 
00493   SETUP_VAR_STACK_REMEMBERED(1);
00494   VAR_STACK_PUSH(0, p);
00495 
00496   
00497 
00498   
00499   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->GetHeight());
00500 
00501   
00502   
00503   READY_TO_RETURN;
00504   return scheme_make_integer(r);
00505 }
00506 
00507 static Scheme_Object *os_wxBitmapGetDepth(int n,  Scheme_Object *p[])
00508 {
00509   WXS_USE_ARGUMENT(n) WXS_USE_ARGUMENT(p)
00510   REMEMBER_VAR_STACK();
00511   int r;
00512   objscheme_check_valid(os_wxBitmap_class, "get-depth in bitmap%", n, p);
00513 
00514   SETUP_VAR_STACK_REMEMBERED(1);
00515   VAR_STACK_PUSH(0, p);
00516 
00517   
00518 
00519   
00520   r = WITH_VAR_STACK(((wxBitmap *)((Scheme_Class_Object *)p[0])->primdata)->GetDepth());
00521 
00522   
00523   
00524   READY_TO_RETURN;
00525   return scheme_make_integer(r);
00526 }
00527 
00528 static Scheme_Object *os_wxBitmap_ConstructScheme(int n,  Scheme_Object *p[])
00529 {
00530   SETUP_PRE_VAR_STACK(1);
00531   PRE_VAR_STACK_PUSH(0, p);
00532   os_wxBitmap *realobj INIT_NULLED_OUT;
00533   REMEMBER_VAR_STACK();
00534   if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_pathname(p[POFFSET+0], NULL))) {
00535     pathname x0 INIT_NULLED_OUT;
00536     int x1;
00537     class wxColour* x2 INIT_NULLED_OUT;
00538 
00539     SETUP_VAR_STACK_PRE_REMEMBERED(4);
00540     VAR_STACK_PUSH(0, p);
00541     VAR_STACK_PUSH(1, realobj);
00542     VAR_STACK_PUSH(2, x0);
00543     VAR_STACK_PUSH(3, x2);
00544 
00545     
00546     if ((n < (POFFSET+1)) || (n > (POFFSET+3))) 
00547       WITH_VAR_STACK(scheme_wrong_count_m("initialization in bitmap% (pathname case)", POFFSET+1, POFFSET+3, n, p, 1));
00548     x0 = (pathname)WITH_VAR_STACK(objscheme_unbundle_pathname(p[POFFSET+0], "initialization in bitmap% (pathname case)"));
00549     if (n > (POFFSET+1)) {
00550       x1 = WITH_VAR_STACK(unbundle_symset_bitmapType(p[POFFSET+1], "initialization in bitmap% (pathname case)"));
00551     } else
00552       x1 = 0;
00553     if (n > (POFFSET+2)) {
00554       x2 = WITH_VAR_STACK(objscheme_unbundle_wxColour(p[POFFSET+2], "initialization in bitmap% (pathname case)", 1));
00555     } else
00556       x2 = NULL;
00557 
00558     
00559     realobj = WITH_VAR_STACK(new os_wxBitmap CONSTRUCTOR_ARGS((x0, x1, x2)));
00560 #ifdef MZ_PRECISE_GC
00561     WITH_VAR_STACK(realobj->gcInit_wxBitmap(x0, x1, x2));
00562 #endif
00563     realobj->__gc_external = (void *)p[0];
00564     if (realobj->Ok()) WITH_VAR_STACK(scheme_thread_block(0.0));
00565     
00566     READY_TO_PRE_RETURN;
00567   } else if ((n >= (POFFSET+1)) && WITH_REMEMBERED_STACK(objscheme_istype_number(p[POFFSET+0], NULL))) {
00568     int x0;
00569     int x1;
00570     Bool x2;
00571 
00572     SETUP_VAR_STACK_PRE_REMEMBERED(2);
00573     VAR_STACK_PUSH(0, p);
00574     VAR_STACK_PUSH(1, realobj);
00575 
00576     
00577     if ((n < (POFFSET+2)) || (n > (POFFSET+3))) 
00578       WITH_VAR_STACK(scheme_wrong_count_m("initialization in bitmap% (width/height case)", POFFSET+2, POFFSET+3, n, p, 1));
00579     x0 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+0], 1, 10000, "initialization in bitmap% (width/height case)"));
00580     x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+1], 1, 10000, "initialization in bitmap% (width/height case)"));
00581     if (n > (POFFSET+2)) {
00582       x2 = WITH_VAR_STACK(objscheme_unbundle_bool(p[POFFSET+2], "initialization in bitmap% (width/height case)"));
00583     } else
00584       x2 = 0;
00585 
00586     
00587     realobj = WITH_VAR_STACK(new os_wxBitmap CONSTRUCTOR_ARGS((x0, x1, x2)));
00588 #ifdef MZ_PRECISE_GC
00589     WITH_VAR_STACK(realobj->gcInit_wxBitmap(x0, x1, x2));
00590 #endif
00591     realobj->__gc_external = (void *)p[0];
00592     
00593     
00594     READY_TO_PRE_RETURN;
00595   } else  {
00596     bstring x0 INIT_NULLED_OUT;
00597     int x1;
00598     int x2;
00599 
00600     SETUP_VAR_STACK_PRE_REMEMBERED(3);
00601     VAR_STACK_PUSH(0, p);
00602     VAR_STACK_PUSH(1, realobj);
00603     VAR_STACK_PUSH(2, x0);
00604 
00605     
00606     if (n != (POFFSET+3)) 
00607       WITH_VAR_STACK(scheme_wrong_count_m("initialization in bitmap% (datastring case)", POFFSET+3, POFFSET+3, n, p, 1));
00608     x0 = (bstring)WITH_VAR_STACK(objscheme_unbundle_bstring(p[POFFSET+0], "initialization in bitmap% (datastring case)"));
00609     x1 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+1], 1, 10000, "initialization in bitmap% (datastring case)"));
00610     x2 = WITH_VAR_STACK(objscheme_unbundle_integer_in(p[POFFSET+2], 1, 10000, "initialization in bitmap% (datastring case)"));
00611 
00612     if (SCHEME_BYTE_STRTAG_VAL(p[POFFSET]) < (((x1 * x2) + 7) >> 3)) WITH_VAR_STACK(scheme_arg_mismatch(METHODNAME("bitmap%","initialization"), "byte string too short: ", p[POFFSET]));
00613     realobj = WITH_VAR_STACK(new os_wxBitmap CONSTRUCTOR_ARGS((x0, x1, x2)));
00614 #ifdef MZ_PRECISE_GC
00615     WITH_VAR_STACK(realobj->gcInit_wxBitmap(x0, x1, x2));
00616 #endif
00617     realobj->__gc_external = (void *)p[0];
00618     
00619     
00620     READY_TO_PRE_RETURN;
00621   }
00622 
00623   ((Scheme_Class_Object *)p[0])->primdata = realobj;
00624   ((Scheme_Class_Object *)p[0])->primflag = 1;
00625   WITH_REMEMBERED_STACK(objscheme_register_primpointer(p[0], &((Scheme_Class_Object *)p[0])->primdata));
00626   return scheme_void;
00627 }
00628 
00629 void objscheme_setup_wxBitmap(Scheme_Env *env)
00630 {
00631   SETUP_VAR_STACK(1);
00632   VAR_STACK_PUSH(0, env);
00633 
00634   wxREGGLOB(os_wxBitmap_class);
00635 
00636   os_wxBitmap_class = WITH_VAR_STACK(objscheme_def_prim_class(env, "bitmap%", "object%", (Scheme_Method_Prim *)os_wxBitmap_ConstructScheme, 12));
00637 
00638   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "get-argb-pixels" " method", (Scheme_Method_Prim *)os_wxBitmapwxGetARGBPixels, 5, 6));
00639   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "get-gl-config" " method", (Scheme_Method_Prim *)os_wxBitmapGetGLConfig, 0, 0));
00640   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "set-gl-config" " method", (Scheme_Method_Prim *)os_wxBitmapSetGLConfig, 1, 1));
00641   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "set-loaded-mask" " method", (Scheme_Method_Prim *)os_wxBitmapSetMask, 1, 1));
00642   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "get-loaded-mask" " method", (Scheme_Method_Prim *)os_wxBitmapGetMask, 0, 0));
00643   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "save-file" " method", (Scheme_Method_Prim *)os_wxBitmapSaveFile, 2, 3));
00644   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "load-file" " method", (Scheme_Method_Prim *)os_wxBitmapLoadFile, 1, 3));
00645   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "is-color?" " method", (Scheme_Method_Prim *)os_wxBitmapIsColor, 0, 0));
00646   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "ok?" " method", (Scheme_Method_Prim *)os_wxBitmapOk, 0, 0));
00647   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "get-width" " method", (Scheme_Method_Prim *)os_wxBitmapGetWidth, 0, 0));
00648   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "get-height" " method", (Scheme_Method_Prim *)os_wxBitmapGetHeight, 0, 0));
00649   WITH_VAR_STACK(scheme_add_method_w_arity(os_wxBitmap_class, "get-depth" " method", (Scheme_Method_Prim *)os_wxBitmapGetDepth, 0, 0));
00650 
00651 
00652   WITH_VAR_STACK(scheme_made_class(os_wxBitmap_class));
00653 
00654 
00655   READY_TO_RETURN;
00656 }
00657 
00658 int objscheme_istype_wxBitmap(Scheme_Object *obj, const char *stop, int nullOK)
00659 {
00660   REMEMBER_VAR_STACK();
00661   if (nullOK && XC_SCHEME_NULLP(obj)) return 1;
00662   if (objscheme_is_a(obj,  os_wxBitmap_class))
00663     return 1;
00664   else {
00665     if (!stop)
00666        return 0;
00667     WITH_REMEMBERED_STACK(scheme_wrong_type(stop, nullOK ? "bitmap% object or " XC_NULL_STR: "bitmap% object", -1, 0, &obj));
00668     return 0;
00669   }
00670 }
00671 
00672 Scheme_Object *objscheme_bundle_wxBitmap(class wxBitmap *realobj)
00673 {
00674   Scheme_Class_Object *obj INIT_NULLED_OUT;
00675   Scheme_Object *sobj INIT_NULLED_OUT;
00676 
00677   if (!realobj) return XC_SCHEME_NULL;
00678 
00679   if (realobj->__gc_external)
00680     return (Scheme_Object *)realobj->__gc_external;
00681 
00682   SETUP_VAR_STACK(2);
00683   VAR_STACK_PUSH(0, obj);
00684   VAR_STACK_PUSH(1, realobj);
00685 
00686   if ((sobj = WITH_VAR_STACK(objscheme_bundle_by_type(realobj, realobj->__type))))
00687     { READY_TO_RETURN; return sobj; }
00688   obj = (Scheme_Class_Object *)WITH_VAR_STACK(scheme_make_uninited_object(os_wxBitmap_class));
00689 
00690   obj->primdata = realobj;
00691   WITH_VAR_STACK(objscheme_register_primpointer(obj, &obj->primdata));
00692   obj->primflag = 0;
00693 
00694   realobj->__gc_external = (void *)obj;
00695   READY_TO_RETURN;
00696   return (Scheme_Object *)obj;
00697 }
00698 
00699 class wxBitmap *objscheme_unbundle_wxBitmap(Scheme_Object *obj, const char *where, int nullOK)
00700 {
00701   if (nullOK && XC_SCHEME_NULLP(obj)) return NULL;
00702 
00703   REMEMBER_VAR_STACK();
00704 
00705   (void)objscheme_istype_wxBitmap(obj, where, nullOK);
00706   Scheme_Class_Object *o = (Scheme_Class_Object *)obj;
00707   WITH_REMEMBERED_STACK(objscheme_check_valid(NULL, NULL, 0, &obj));
00708   if (o->primflag)
00709     return (os_wxBitmap *)o->primdata;
00710   else
00711     return (wxBitmap *)o->primdata;
00712 }
00713