memcpy(surface->pixels, p, len);
void
+surface_set_pixel_RGB(screen, x, y, r, g, b )
+ SDL_Surface *screen
+ int x
+ int y
+ Uint8 r
+ Uint8 g
+ Uint8 b
+
+ CODE:
+ Uint32 *pixmem32;
+ Uint32 colour;
+ colour = SDL_MapRGB( screen->format, r, g, b );
+ pixmem32 = screen->pixels + y + x;
+ *pixmem32 = colour;
+
+void
+surface_set_pixel_RGBA(screen, x, y, r, g, b, a )
+ SDL_Surface *screen
+ int x
+ int y
+ Uint8 r
+ Uint8 g
+ Uint8 b
+ Uint8 a
+ CODE:
+ Uint32 *pixmem32;
+ Uint32 colour;
+ colour = SDL_MapRGBA( screen->format, r, g, b, a );
+ pixmem32 = screen->pixels + y + x;
+ *pixmem32 = colour;
+
+
+void
surface_DESTROY(surface)
SDL_Surface *surface
CODE:
SDL_FreeSurface(surface);
if (flags & SDL_PREALLOC)
Safefree(pixels);
+
use SDL::Color;
use SDL::Video;
use SDL::PixelFormat;
-use Test::More tests => 35;
+use Test::More tests => 37;
my $surface
= SDL::Surface->new( SDL::SDL_ANYFORMAT(), 640, 320, 8, 0, 0, 0, 0 );
diag( 'This is in surface : ' . SDL::Surface::get_pixels($app) );
-SDL::SurfacePixel($app, 20, 20 , SDL::Color->new(20, 20, 20) );
+#depreceated
+# SDL::SurfacePixel($app, 20, 20 , SDL::Color->new(20, 20, 20) );
+
+$app->set_pixel_RGB( 20, 20, 100, 100, 100); pass '[set_pixel_RGB] ran!';
+
+$app->set_pixel_RGBA( 20, 20, 100, 100, 10, 100); pass '[set_pixel_RGBA] ran!';
+
pass 'did this pass';