From 2053879bfbbcb15691ff954286ce5b216bc8c4bb Mon Sep 17 00:00:00 2001 From: imprity Date: Sun, 15 Sep 2024 09:54:51 +0900 Subject: [PATCH] Fix NewImageFromImage color converting Old version of NewImageFromImage converted colors incorrectly. This commit fixes the issue. --- raylib/raylib_purego.go | 2 +- raylib/rtextures.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/raylib/raylib_purego.go b/raylib/raylib_purego.go index c9c457f..fa9a944 100644 --- a/raylib/raylib_purego.go +++ b/raylib/raylib_purego.go @@ -3776,7 +3776,7 @@ func NewImageFromImage(img image.Image) *Image { for x := 0; x < size.X; x++ { col := img.At(x, y) r, g, b, a := col.RGBA() - rcolor := NewColor(uint8(r), uint8(g), uint8(b), uint8(a)) + rcolor := NewColor(uint8(r>>8), uint8(g>>8), uint8(b>>8), uint8(a>>8)) ImageDrawPixel(ret, int32(x), int32(y), rcolor) } } diff --git a/raylib/rtextures.go b/raylib/rtextures.go index 23a1f37..0a990a8 100644 --- a/raylib/rtextures.go +++ b/raylib/rtextures.go @@ -69,7 +69,7 @@ func NewImageFromImage(img image.Image) *Image { for x := 0; x < size.X; x++ { color := img.At(x, y) r, g, b, a := color.RGBA() - rcolor := NewColor(uint8(r), uint8(g), uint8(b), uint8(a)) + rcolor := NewColor(uint8(r>>8), uint8(g>>8), uint8(b>>8), uint8(a>>8)) ccolor = colorCptr(rcolor) cx = (C.int)(x)