sdl/surface: implement Set() for ABGR4444
@@ -547,6 +547,8 @@ func (surface *Surface) ColorModel() color.Model {
return BGR565Model
case PIXELFORMAT_ARGB4444:
return ARGB4444Model
+ case PIXELFORMAT_ABGR4444:
+ return ABGR4444Model
default:
panic("Not implemented yet")
}
@@ -655,6 +657,14 @@ func (surface *Surface) Set(x, y int, c color.Color) {
g := uint32(col.G) >> 4 & 0x0F
b := uint32(col.B) >> 4 & 0x0F
*buf = a<<12 | r<<8 | g<<4 | b
+ case PIXELFORMAT_ABGR4444:
+ col := surface.ColorModel().Convert(c).(color.RGBA)
+ buf := (*uint32)(unsafe.Pointer(&pix[i]))
+ a := uint32(col.A) >> 4 & 0x0F
+ r := uint32(col.R) >> 4 & 0x0F
+ g := uint32(col.G) >> 4 & 0x0F
+ b := uint32(col.B) >> 4 & 0x0F
+ *buf = a<<12 | b<<8 | g<<4 | r
default:
panic("Unknown pixel format!")
}
