From: Kartik Thakore Date: Tue, 3 Nov 2009 18:51:11 +0000 (-0500) Subject: Added SurfacePixel and its test for now so we can duplicated function for it with... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2a9d61293090b97298208e394f8f0e482e033279;p=sdlgit%2FSDL_perl.git Added SurfacePixel and its test for now so we can duplicated function for it with set_pixel and get_pixel --- diff --git a/src/SDL.xs b/src/SDL.xs index 89de5c6..684a201 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -900,201 +900,6 @@ IMG_Load ( filename ) #endif -=for comment - -Comment out for now as it does not compile - -SDL_Surface * -CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask ) - char *pixels - int width - int height - int depth - int pitch - Uint32 Rmask - Uint32 Gmask - Uint32 Bmask - Uint32 Amask - CODE: - Uint8* pixeldata; - Uint32 len = pitch * height; - New(0,pixeldata,len,Uint8); - Copy(pixels,pixeldata,len,Uint8); - RETVAL = SDL_CreateRGBSurfaceFrom ( pixeldata, width, height, - depth, pitch, Rmask, Gmask, Bmask, Amask ); - OUTPUT: - RETVAL - -SDL_Surface* -SurfaceCopy ( surface ) - SDL_Surface *surface - CODE: - Uint8* pixels; - Uint32 size = surface->pitch * surface->h; - New(0,pixels,size,Uint8); - Copy(surface->pixels,pixels,size,Uint8); - RETVAL = SDL_CreateRGBSurfaceFrom(pixels,surface->w,surface->h, - surface->format->BitsPerPixel, surface->pitch, - surface->format->Rmask, surface->format->Gmask, - surface->format->Bmask, surface->format->Amask); - OUTPUT: - RETVAL - -void -FreeSurface ( surface ) - SDL_Surface *surface - CODE: - if (surface) { - Uint8* pixels = surface->pixels; - Uint32 flags = surface->flags; - SDL_FreeSurface(surface); - if (flags & SDL_PREALLOC) - Safefree(pixels); - } - -Uint32 -SurfaceFlags ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->flags; - OUTPUT: - RETVAL - -SDL_Palette * -SurfacePalette ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->palette; - OUTPUT: - RETVAL - -Uint8 -SurfaceBitsPerPixel ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->BitsPerPixel; - OUTPUT: - RETVAL - -Uint8 -SurfaceBytesPerPixel ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->BytesPerPixel; - OUTPUT: - RETVAL - -Uint8 -SurfaceRshift ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Rshift; - OUTPUT: - RETVAL - -Uint8 -SurfaceGshift ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Gshift; - OUTPUT: - RETVAL - -Uint8 -SurfaceBshift ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Bshift; - OUTPUT: - RETVAL - -Uint8 -SurfaceAshift ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Ashift; - OUTPUT: - RETVAL - -Uint32 -SurfaceRmask( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Rmask; - OUTPUT: - RETVAL - -Uint32 -SurfaceGmask ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Gmask; - OUTPUT: - RETVAL - -Uint32 -SurfaceBmask ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Bmask; - OUTPUT: - RETVAL - -Uint32 -SurfaceAmask ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->Amask; - OUTPUT: - RETVAL - -Uint32 -SurfaceColorKey ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->colorkey; - OUTPUT: - RETVAL - -Uint32 -SurfaceAlpha( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->format->alpha; - OUTPUT: - RETVAL - -int -SurfaceW ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->w; - OUTPUT: - RETVAL - -int -SurfaceH ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->h; - OUTPUT: - RETVAL - -Uint16 -SurfacePitch ( surface ) - SDL_Surface *surface - CODE: - RETVAL = surface->pitch; - OUTPUT: - RETVAL - -SV* -SurfacePixels ( surface ) - SDL_Surface *surface - CODE: - RETVAL = newSVpvn(surface->pixels,surface->pitch*surface->h); - OUTPUT: - RETVAL SDL_Color* SurfacePixel ( surface, x, y, ... ) @@ -1161,7 +966,9 @@ SurfacePixel ( surface, x, y, ... ) } OUTPUT: RETVAL -=for documenation + +=for docs + int MUSTLOCK ( surface ) diff --git a/t/core_surface.t b/t/core_surface.t index 8c6e2f8..a695d07 100644 --- a/t/core_surface.t +++ b/t/core_surface.t @@ -98,6 +98,8 @@ SDL::Video::update_rects( $app, $small_rect ); diag( 'This is in surface : ' . SDL::Surface::get_pixels($app) ); +SDL::SurfacePixel($app, 20, 20 , SDL::Color->new(20, 20, 20) ); + pass 'did this pass'; SDL::delay(100);