Fix image tint in raylib renderer on windows

This commit is contained in:
Nic Barker 2025-02-04 16:52:43 +13:00
parent e8fe2e5270
commit 46e9170e01

View File

@ -143,12 +143,16 @@ void Clay_Raylib_Render(Clay_RenderCommandArray renderCommands, Font* fonts)
}
case CLAY_RENDER_COMMAND_TYPE_IMAGE: {
Texture2D imageTexture = *(Texture2D *)renderCommand->renderData.image.imageData;
Clay_Color tintColor = renderCommand->renderData.image.backgroundColor;
if (tintColor.r == 0 && tintColor.g == 0 || tintColor.b == 0 || tintColor.a == 0) {
tintColor = (Clay_Color) { 255, 255, 255, 255 };
}
DrawTextureEx(
imageTexture,
(Vector2){boundingBox.x, boundingBox.y},
0,
boundingBox.width / (float)imageTexture.width,
CLAY_COLOR_TO_RAYLIB_COLOR(renderCommand->renderData.image.backgroundColor));
CLAY_COLOR_TO_RAYLIB_COLOR(tintColor));
break;
}
case CLAY_RENDER_COMMAND_TYPE_SCISSOR_START: {