fixing color management issue with texts

This commit is contained in:
2024-01-10 20:22:53 +01:00
parent 62c623d70a
commit 875d73e3dd
8 changed files with 30 additions and 22 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */
/* Updated: 2024/01/10 14:17:24 by maldavid ### ########.fr */
/* Updated: 2024/01/10 19:57:12 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -46,7 +46,7 @@ namespace mlx::core
inline void destroyGraphicsSupport(void* win);
inline void pixelPut(void* win, int x, int y, uint32_t color) const noexcept;
inline void stringPut(void* win, int x, int y, int color, char* str);
inline void stringPut(void* win, int x, int y, uint32_t color, char* str);
void* newTexture(int w, int h);
void* newStbTexture(char* file, int* w, int* h); // stb textures are format managed by stb image (png, jpg, bpm, ...)

View File

@@ -97,7 +97,7 @@ namespace mlx::core
_graphics[*static_cast<int*>(win)]->pixelPut(x, y, color);
}
void Application::stringPut(void* win, int x, int y, int color, char* str)
void Application::stringPut(void* win, int x, int y, uint32_t color, char* str)
{
MLX_PROFILE_FUNCTION();
CHECK_WINDOW_PTR(win);

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
/* Updated: 2023/12/31 00:22:58 by maldavid ### ########.fr */
/* Updated: 2024/01/10 19:54:51 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -193,8 +193,8 @@ extern "C"
unsigned char color_bits[4];
color_bits[0] = (color & 0x00FF0000) >> 16;
color_bits[1] = (color & 0x0000FF00) >> 8;
color_bits[2] = color & 0x000000FF;
color_bits[3] = 0xFF;
color_bits[2] = (color & 0x000000FF);
color_bits[3] = (color & 0xFF000000) >> 24;
static_cast<mlx::core::Application*>(mlx)->stringPut(win, x, y, *reinterpret_cast<unsigned int*>(color_bits), str);
return 0;
}

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */
/* Updated: 2024/01/10 14:18:48 by maldavid ### ########.fr */
/* Updated: 2024/01/10 19:59:58 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -44,7 +44,7 @@ namespace mlx
inline void clearRenderData() noexcept;
inline void pixelPut(int x, int y, uint32_t color) noexcept;
inline void stringPut(int x, int y, int color, std::string str);
inline void stringPut(int x, int y, uint32_t color, std::string str);
inline void texturePut(Texture* texture, int x, int y);
inline void loadFont(const std::filesystem::path& filepath, float scale);

View File

@@ -32,7 +32,7 @@ namespace mlx
_pixel_put_pipeline.setPixel(x, y, color);
}
void GraphicsSupport::stringPut(int x, int y, int color, std::string str)
void GraphicsSupport::stringPut(int x, int y, uint32_t color, std::string str)
{
MLX_PROFILE_FUNCTION();
_text_put_pipeline->put(x, y, color, str);