send alpha, if needed
This commit is contained in:
parent
0ede282b73
commit
8f18af72f7
|
@ -45,10 +45,15 @@ func commandsFromImage(img *image.NRGBA, offset image.Point) (cmds commands) {
|
||||||
if c.A == 0 {
|
if c.A == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// @incomplete: also send alpha? -> bandwidth tradeoff
|
var cmd string
|
||||||
|
if c.A != 255 {
|
||||||
|
cmd = fmt.Sprintf("PX %d %d %.2x%.2x%.2x%.2x\n",
|
||||||
|
x+offset.X, y+offset.Y, c.R, c.G, c.B, c.A)
|
||||||
|
} else {
|
||||||
// @speed: this sprintf call is quite slow..
|
// @speed: this sprintf call is quite slow..
|
||||||
cmd := fmt.Sprintf("PX %d %d %.2x%.2x%.2x\n",
|
cmd = fmt.Sprintf("PX %d %d %.2x%.2x%.2x\n",
|
||||||
x+offset.X, y+offset.Y, c.R, c.G, c.B)
|
x+offset.X, y+offset.Y, c.R, c.G, c.B)
|
||||||
|
}
|
||||||
cmds[numCmds] = []byte(cmd)
|
cmds[numCmds] = []byte(cmd)
|
||||||
numCmds++
|
numCmds++
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue