X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=b4ac9ce4e83a3b8bb4e49a954e78f071a6ab4391;hp=bd9fc229206806112c19f051eb9e02d0615018bc;hb=efd0d0abb853018aa3ccc3c727b39bd7f5ba679d;hpb=1ea24d77ffed5e4581099ed0e0c96de412a087e7 diff --git a/src/libgame/system.c b/src/libgame/system.c index bd9fc229..b4ac9ce4 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -438,6 +438,26 @@ inline void DrawLines(Bitmap *bitmap, struct XY *points, int num_points, #endif } +inline Pixel GetPixel(Bitmap *bitmap, int x, int y) +{ +#if defined(TARGET_SDL) + return SDLGetPixel(bitmap, x, y); +#elif defined(TARGET_ALLEGRO) + return AllegroGetPixel(bitmap->drawable, x, y); +#else + unsigned long pixel_value; + XImage *pixel_image; + + pixel_image = XGetImage(display, bitmap->drawable, x, y, 1, 1, + AllPlanes, ZPixmap); + pixel_value = XGetPixel(pixel_image, 0, 0); + + XDestroyImage(pixel_image); + + return pixel_value; +#endif +} + inline Pixel GetPixelFromRGB(Bitmap *bitmap, unsigned int color_r, unsigned int color_g, unsigned int color_b) {