New GetPixel function
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1720 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -1040,6 +1040,22 @@ TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line)
|
|||||||
return (uint8*)surf->pixels + surf->pitch * line;
|
return (uint8*)surf->pixels + surf->pitch * line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y, int *r, int *g, int *b)
|
||||||
|
{
|
||||||
|
SDL_Surface* surf = (SDL_Surface *)canvas;
|
||||||
|
Uint8 ur, ug, ub;
|
||||||
|
Uint32 pixel;
|
||||||
|
GetPixelFn getpixel;
|
||||||
|
|
||||||
|
getpixel = getpixel_for(surf);
|
||||||
|
pixel = (*getpixel)(surf, x, y);
|
||||||
|
SDL_GetRGB (pixel, surf->format, &ur, &ug, &ub);
|
||||||
|
*r = ur;
|
||||||
|
*g = ug;
|
||||||
|
*b = ub;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_DrawCanvas_Rotate (TFB_Canvas src_canvas, TFB_Canvas dst_canvas, int angle, EXTENT size)
|
TFB_DrawCanvas_Rotate (TFB_Canvas src_canvas, TFB_Canvas dst_canvas, int angle, EXTENT size)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,5 +126,6 @@ void TFB_DrawCanvas_SetTransparentColor (TFB_Canvas canvas, int r, int g, int b,
|
|||||||
void TFB_DrawCanvas_Initialize (void);
|
void TFB_DrawCanvas_Initialize (void);
|
||||||
void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt);
|
void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt);
|
||||||
void* TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line);
|
void* TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line);
|
||||||
|
void TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y, int *r, int *g, int *b);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user