From a7b8f8220465f215b8a855305b1d5040365a9d48 Mon Sep 17 00:00:00 2001 From: "M. Sz" Date: Thu, 11 Mar 2021 11:20:15 +0100 Subject: [PATCH] pl2: RGBA and SetRGBA methods for PL2Color24Bits --- d2common/d2fileformats/d2pl2/pl2_color_24bits.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/d2common/d2fileformats/d2pl2/pl2_color_24bits.go b/d2common/d2fileformats/d2pl2/pl2_color_24bits.go index 514a2496..d6ebf7de 100644 --- a/d2common/d2fileformats/d2pl2/pl2_color_24bits.go +++ b/d2common/d2fileformats/d2pl2/pl2_color_24bits.go @@ -6,3 +6,13 @@ type PL2Color24Bits struct { G uint8 B uint8 } + +// RGBA returns RGBA values of PL2Color +func (p *PL2Color24Bits) RGBA() uint32 { + return toComposite(p.R, p.G, p.B, mask) +} + +// SetRGBA sets PL2Color's value to rgba given +func (p *PL2Color24Bits) SetRGBA(rgba uint32) { + p.R, p.G, p.B, _ = toComponent(rgba) +}