+Bitmap *ZoomBitmap(Bitmap *src_bitmap, int zoom_width, int zoom_height)
+{
+ Bitmap *dst_bitmap = CreateBitmap(zoom_width, zoom_height, DEFAULT_DEPTH);
+
+#if defined(TARGET_SDL)
+ SDLZoomBitmap(src_bitmap, dst_bitmap);
+#else
+ X11ZoomBitmap(src_bitmap, dst_bitmap);
+#endif
+
+ return dst_bitmap;
+}
+
+void CreateBitmapWithSmallBitmaps(Bitmap *src_bitmap)
+{
+ Bitmap *tmp_bitmap, *tmp_bitmap_2, *tmp_bitmap_8;
+ int src_width, src_height;
+ int tmp_width, tmp_height;
+
+ src_width = src_bitmap->width;
+ src_height = src_bitmap->height;
+
+ tmp_width = src_width;
+ tmp_height = src_height + src_height / 2;
+
+ tmp_bitmap = CreateBitmap(tmp_width, tmp_height, DEFAULT_DEPTH);
+
+ tmp_bitmap_2 = ZoomBitmap(src_bitmap, src_width / 2, src_height / 2);
+ tmp_bitmap_8 = ZoomBitmap(src_bitmap, src_width / 8, src_height / 8);
+
+ BlitBitmap(src_bitmap, tmp_bitmap, 0, 0, src_width, src_height, 0, 0);
+ BlitBitmap(tmp_bitmap_2, tmp_bitmap, 0, 0, src_width / 2, src_height / 2,
+ 0, src_height);
+ BlitBitmap(tmp_bitmap_8, tmp_bitmap, 0, 0, src_width / 8, src_height / 8,
+ 3 * src_width / 4, src_height);
+
+ FreeBitmap(tmp_bitmap_2);
+ FreeBitmap(tmp_bitmap_8);
+
+#if defined(TARGET_SDL)
+ src_bitmap->surface = tmp_bitmap->surface;
+ tmp_bitmap->surface = NULL;
+#else
+ src_bitmap->drawable = tmp_bitmap->drawable;
+ tmp_bitmap->drawable = None;
+#endif
+
+ src_bitmap->height = tmp_bitmap->height;
+
+ FreeBitmap(tmp_bitmap);
+}
+
+
+/* ------------------------------------------------------------------------- */
+/* mouse pointer functions */
+/* ------------------------------------------------------------------------- */
+
+/* cursor bitmap in XPM format */
+static const char *cursor_image_playfield[] =
+{
+ /* width height num_colors chars_per_pixel */
+ " 32 32 3 1",
+
+ /* colors */
+ "X c #000000",
+ ". c #ffffff",
+ " c None",
+
+ " X ",
+ "X.X ",
+ " X ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ "1,1"
+};
+
+static struct MouseCursorInfo *get_cursor_from_image(const char **image)
+{
+ struct MouseCursorInfo *cursor;
+ int row, col, i;
+
+ cursor = checked_calloc(sizeof(struct MouseCursorInfo));
+
+ i = -1;
+ for (row=0; row<32; ++row)
+ {
+ for (col=0; col<32; ++col)
+ {
+ if (col % 8)
+ {
+ cursor->data[i] <<= 1;
+ cursor->mask[i] <<= 1;
+ }
+ else
+ {
+ i++;
+ cursor->data[i] = cursor->mask[i] = 0;
+ }
+
+ switch (image[4+row][col])
+ {
+ case 'X':
+ cursor->data[i] |= 0x01;
+ cursor->mask[i] |= 0x01;
+ break;
+
+ case '.':
+ cursor->mask[i] |= 0x01;
+ break;
+
+ case ' ':
+ break;
+ }
+ }
+ }
+
+ sscanf(image[4+row], "%d,%d", &cursor->hot_x, &cursor->hot_y);
+
+ cursor->width = 32;
+ cursor->height = 32;
+
+ return cursor;
+}
+
+void SetMouseCursor(int mode)
+{
+ struct MouseCursorInfo *cursor_playfield = NULL;
+
+ if (cursor_playfield == NULL)
+ cursor_playfield = get_cursor_from_image(cursor_image_playfield);
+
+#if defined(TARGET_SDL)
+ SDLSetMouseCursor(mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL);
+#elif defined(TARGET_X11_NATIVE)
+ X11SetMouseCursor(mode == CURSOR_PLAYFIELD ? cursor_playfield : NULL);
+#endif
+}
+