Browse Source

Fixed alpha channel on RGB colors

master v0.1.5
maze 7 months ago
parent
commit
a73a03fc0d
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      pixelcolor/color.go

+ 5
- 0
pixelcolor/color.go View File

@ -91,6 +91,7 @@ func (c RGB332) RGBA() (r, g, b, a uint32) {
r = lut3to8[(c&0b111_000_00)>>5]
g = lut3to8[(c&0b000_111_00)>>2]
b = lut2to8[(c&0b000_000_11)>>0]
a = 0xffff
return
}
@ -112,6 +113,7 @@ func (c RGB565) RGBA() (r, g, b, a uint32) {
r = lut5to8[(c&0b11111_000000_00000)>>11]
g = lut6to8[(c&0b00000_111111_00000)>>5]
b = lut5to8[(c&0b00000_000000_11111)>>0]
a = 0xffff
return
}
@ -135,6 +137,7 @@ func (c RGB888) RGBA() (r, g, b, a uint32) {
g |= g << 8
b = uint32(c.B)
b |= b << 8
a = 0xffff
return
}
@ -246,6 +249,7 @@ func (c RGBX5551) RGBA() (r, g, b, a uint32) {
r = lut5to8[(c&0b11111_00000_00000_0)>>11]
g = lut5to8[(c&0b00000_11111_00000_0)>>6]
b = lut5to8[(c&0b00000_00000_11111_0)>>1]
a = 0xffff
return
}
@ -484,6 +488,7 @@ func (c XRGB1555) RGBA() (r, g, b, a uint32) {
r = lut5to8[(c&0b0_11111_00000_00000)>>10]
g = lut5to8[(c&0b0_00000_11111_00000)>>5]
b = lut5to8[(c&0b0_00000_00000_11111)>>0]
a = 0xffff
return
}


Loading…
Cancel
Save