From: Holger Schemel Date: Sat, 6 Aug 2022 09:08:45 +0000 (+0200) Subject: added alpha channel for anti-aliasing to element collecting image X-Git-Tag: 4.3.3.0~74 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=b137e7481391c30c99dc23abea8762a0bbeac1e3;p=rocksndiamonds.git added alpha channel for anti-aliasing to element collecting image --- diff --git a/graphics/gfx_classic/RocksCollect.png b/graphics/gfx_classic/RocksCollect.png index 0f5a1dfc..710c556c 100644 Binary files a/graphics/gfx_classic/RocksCollect.png and b/graphics/gfx_classic/RocksCollect.png differ diff --git a/src/files.c b/src/files.c index 1d8ba026..09e3b4d2 100644 --- a/src/files.c +++ b/src/files.c @@ -13466,6 +13466,13 @@ void CreateCollectElementImages(void) filename_bmp, filename_png); + // force using RGBA surface for destination bitmap + SDL_SetColorKey(dst_bitmap->surface, SET_TRANSPARENT_PIXEL, + SDL_MapRGB(dst_bitmap->surface->format, 0x00, 0x00, 0x00)); + + dst_bitmap->surface = + SDL_ConvertSurfaceFormat(dst_bitmap->surface, SDL_PIXELFORMAT_RGBA32, 0); + for (i = 0; i < MAX_NUM_ELEMENTS; i++) { if (!createCollectImage(i)) @@ -13486,6 +13493,13 @@ void CreateCollectElementImages(void) BlitBitmap(src_bitmap, tmp_bitmap, src_x, src_y, tile_size, tile_size, 0, 0); + // force using RGBA surface for temporary bitmap (using transparent black) + SDL_SetColorKey(tmp_bitmap->surface, SET_TRANSPARENT_PIXEL, + SDL_MapRGB(tmp_bitmap->surface->format, 0x00, 0x00, 0x00)); + + tmp_bitmap->surface = + SDL_ConvertSurfaceFormat(tmp_bitmap->surface, SDL_PIXELFORMAT_RGBA32, 0); + tmp_bitmap->surface_masked = tmp_bitmap->surface; for (j = 0; j < anim_frames; j++) @@ -13506,9 +13520,9 @@ void CreateCollectElementImages(void) frame_bitmap = half_bitmap; } - BlitBitmap(frame_bitmap, dst_bitmap, 0, 0, - frame_size_final, frame_size_final, - dst_x + j * tile_size + offset, dst_y + offset); + BlitBitmapMasked(frame_bitmap, dst_bitmap, 0, 0, + frame_size_final, frame_size_final, + dst_x + j * tile_size + offset, dst_y + offset); FreeBitmap(frame_bitmap); }