From 45fa282b61279a28cee84bd1bcfb053a9a6758c7 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Mon, 21 Aug 2023 22:39:13 -0400 Subject: [PATCH] Texture now checks for transparent pixels --- texture.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/texture.go b/texture.go index 346f62b..f105b32 100644 --- a/texture.go +++ b/texture.go @@ -4,9 +4,10 @@ import "image" import "git.tebibyte.media/tomo/tomo" type texture struct { - pix []uint8 - stride int - rect image.Rectangle + pix []uint8 + stride int + rect image.Rectangle + transparent bool } func (backend *Backend) NewTexture (source image.Image) tomo.Texture { @@ -27,6 +28,10 @@ func (backend *Backend) NewTexture (source image.Image) tomo.Texture { texture.pix[index + 2] = uint8(r >> 8) texture.pix[index + 3] = uint8(a >> 8) index += 4 + + if a != 0xFFFF { + texture.transparent = true + } }} return texture