Re: [sdljava-users] Anyone using get/setPixelDataXX()?
Status: Beta
Brought to you by:
ivan_ganza
From: S. Meslin-W. <st...@ta...> - 2005-07-18 21:19:52
|
Hi Ivan, On Tue, Jul 12, 2005 at 05:54:19PM -0400, Ivan Z. Ganza wrote: > Not a problem. I did not have time to properly test them, however, the > code was actually still in the native layer from where I first coded > that part , and I know it was working at that point. Yup, it's back as it was... > The reason for long instead of int is because that is how swig maps it. >=20 > void SWIG_GetPixelData32(SDL_Surface *surface, Uint32 pixelData[]) Argh. that's a huge bottleneck for me. I treat ints as uint32 as it is (for AARRGGBB) and other libraries I use (VNCj notably) also use this interpretation for int. > For the above SWIG mapg the Uint32 to a long[]. I suppose we could add > our own (additonal) method with takes an int[] and casts it to long[] > calling the appropriate method (for conviencence). Not sure if that > would cause any problems due to the cast. No, it's not possible to cast int[] to long[]. I end up having to do the following: long[] longs =3D new long[source.length]; for (int i =3D 0; i < source.length; i++) { longs[i] =3D source[i]; } SDLUtil.setPixelData32(screen, longs); You can imagine how expensive this can get :( I don't think that pushing this to C is the answer. Perhaps SWIG needs fixing? Steph --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Stephane Meslin-Weber Email: st...@ta... Senior Software Engineer Web: http://odonata.tangency.co.uk =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D |