From a37630daa3382efd7551d25ac9444b246f9931c7 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 18 Sep 2025 12:57:52 +0200 Subject: [PATCH] Add bgra swap in _encode_image --- base/sources/iron.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/base/sources/iron.h b/base/sources/iron.h index 80a4b421..b48a2383 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -1697,6 +1697,14 @@ void _encode_image_func(void *context, void *data, int size) { } buffer_t *_encode_image(buffer_t *bytes, i32 w, i32 h, i32 format, i32 quality) { + #ifdef IRON_BGRA + unsigned char *pixels = bytes->buffer; + for (int i = 0; i < w * h; ++i) { + unsigned char c = pixels[i * 4]; + pixels[i * 4 ] = pixels[i * 4 + 2]; + pixels[i * 4 + 2] = c; + } + #endif _encode_data = (unsigned char *)malloc(w * h * 4); _encode_size = 0; format == 0 ?