@@ -9,7 +9,7 @@ static uint32_t toTexturePage(uint32_t x, uint32_t y) { return (x / 64) + ((y /
99
1010void AbstractTIM::writeImage (CLUTMap& clutMap, std::filesystem::path path)
1111{
12- cimg::CImg<uint8_t > new_image (width, height, 1 , 3 , 0 );
12+ cimg::CImg<uint8_t > new_image (width, height, 1 , 4 , 0 );
1313 auto & clut = clutMap[toTexturePage (pixelOrgX, pixelOrgY)];
1414
1515 for (uint32_t y = 0 ; y < height; y++)
@@ -23,13 +23,11 @@ void AbstractTIM::writeImage(CLUTMap& clutMap, std::filesystem::path path)
2323 uint32_t palette = clutCoord.coords .y - clutOrgY;
2424
2525 TIMColor color = palettes[palette][pixels[(y * static_cast <uint64_t >(width)) + x]];
26- const uint8_t bla[] = { static_cast <uint8_t >(color.r * 8 ),
27- static_cast <uint8_t >(color.g * 8 ),
28- static_cast <uint8_t >(color.b * 8 ) };
29- new_image.draw_point (x, y, bla, 1 .0f );
26+ RGBA rgba = color.getColor ();
27+ new_image.draw_point (x, y, reinterpret_cast <uint8_t *>(&rgba), 1 .0f );
3028 }
3129
32- new_image.save_bmp (path.string ().c_str ());
30+ new_image.save_png (path.string ().c_str ());
3331}
3432
3533AbstractTIM::AbstractTIM (const std::filesystem::path path)
0 commit comments