Update of /cvsroot/fxruby/FXRuby/swig-interfaces
In directory usw-pr-cvs1:/tmp/cvs-serv3253/swig-interfaces
Modified Files:
Tag: release10
typemaps.i FXImage.i FXIcon.i
Log Message:
Corrected input typemaps for "const void *pix" and "const FXuchar *PIXELS";
these should not in fact accept FXMemoryBuffer instances as inputs. But
modified the constructors for FXIcon and FXImage to accept this.
Index: typemaps.i
===================================================================
RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/typemaps.i,v
retrieving revision 1.35.2.4
retrieving revision 1.35.2.5
diff -C2 -d -r1.35.2.4 -r1.35.2.5
*** typemaps.i 9 May 2002 20:22:28 -0000 1.35.2.4
--- typemaps.i 10 May 2002 20:12:29 -0000 1.35.2.5
***************
*** 71,85 ****
/**
* Used by constructors for icons and images that require an array
! * of bytes as input; uses a Ruby string or a MemoryBuffer instance
! * instead. Also accepts "nil" in place of a NULL pointer.
*/
%typemap(ruby, in) const void* pix, const FXuchar* PIXELS {
if ($input != Qnil) {
if (TYPE($input) == T_STRING) {
! $1 = reinterpret_cast<$1_ltype>(RSTRING($input)->ptr);
} else {
FXMemoryBuffer *memoryBuffer =
reinterpret_cast<FXMemoryBuffer*>(FXRbConvertPtr($input, FXRbTypeQuery("FXMemoryBuffer *")));
! $1 = reinterpret_cast<$1_ltype>(memoryBuffer->getData());
}
} else {
--- 71,99 ----
/**
* Used by constructors for icons and images that require an array
! * of bytes as input; accepts a Ruby string instance instead. Also
! * accepts "nil" in place of a NULL pointer.
*/
%typemap(ruby, in) const void* pix, const FXuchar* PIXELS {
if ($input != Qnil) {
+ Check_Type($input, T_STRING);
+ $1 = reinterpret_cast<$1_ltype>(RSTRING($input)->ptr);
+ } else {
+ $1 = NULL;
+ }
+ }
+
+ /**
+ * Used by FXImage constructor for the image pixel data; accepts a Ruby
+ * string instance or an FXMemoryBuffer from some other image instead. Also
+ * accepts "nil" in place of a NULL pointer.
+ */
+ %typemap(ruby, in) const void* IMGPIXELS {
+ if ($input != Qnil) {
if (TYPE($input) == T_STRING) {
! $1 = reinterpret_cast<void *>(RSTRING($input)->ptr);
} else {
FXMemoryBuffer *memoryBuffer =
reinterpret_cast<FXMemoryBuffer*>(FXRbConvertPtr($input, FXRbTypeQuery("FXMemoryBuffer *")));
! $1 = reinterpret_cast<void *>(memoryBuffer->getData());
}
} else {
Index: FXImage.i
===================================================================
RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/FXImage.i,v
retrieving revision 1.15.2.2
retrieving revision 1.15.2.3
diff -C2 -d -r1.15.2.2 -r1.15.2.3
*** FXImage.i 8 May 2002 16:45:09 -0000 1.15.2.2
--- FXImage.i 10 May 2002 20:12:29 -0000 1.15.2.3
***************
*** 70,74 ****
/// Create an image
! FXImage(FXApp* a,const void *pix=NULL,FXuint opts=0,FXint w=1,FXint h=1);
/// To get to the pixel data
--- 70,74 ----
/// Create an image
! FXImage(FXApp* a,const void *IMGPIXELS=NULL,FXuint opts=0,FXint w=1,FXint h=1);
/// To get to the pixel data
***************
*** 145,149 ****
public:
// Constructor
! FXRbImage(FXApp* a,const void *pix=NULL,FXuint opts=0,FXint w=1,FXint h=1);
// Destructor
--- 145,149 ----
public:
// Constructor
! FXRbImage(FXApp* a,const void *IMGPIXELS=NULL,FXuint opts=0,FXint w=1,FXint h=1);
// Destructor
Index: FXIcon.i
===================================================================
RCS file: /cvsroot/fxruby/FXRuby/swig-interfaces/FXIcon.i,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** FXIcon.i 19 Mar 2002 23:18:40 -0000 1.9
--- FXIcon.i 10 May 2002 20:12:29 -0000 1.9.2.1
***************
*** 38,42 ****
* and options as in FXImage.
*/
! FXIcon(FXApp* a,const void *pix=NULL,FXColor clr=0,FXuint opts=0,FXint w=1,FXint h=1);
/// Create the icon resource
--- 38,42 ----
* and options as in FXImage.
*/
! FXIcon(FXApp* a,const void *IMGPIXELS=NULL,FXColor clr=0,FXuint opts=0,FXint w=1,FXint h=1);
/// Create the icon resource
***************
*** 70,74 ****
public:
// Constructor
! FXRbIcon(FXApp* a,const void *pix=NULL,FXColor clr=0,FXuint opts=0,FXint w=1,FXint h=1);
// Destructor
--- 70,74 ----
public:
// Constructor
! FXRbIcon(FXApp* a,const void *IMGPIXELS=NULL,FXColor clr=0,FXuint opts=0,FXint w=1,FXint h=1);
// Destructor
|