rocksndiamonds-2.0.1
[rocksndiamonds.git] / src / libgame / system.c
index bd9fc229206806112c19f051eb9e02d0615018bc..b4ac9ce4e83a3b8bb4e49a954e78f071a6ab4391 100644 (file)
@@ -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)
 {