mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 20:52:20 +00:00
Iterate on pixel buffer in telnet package
This commit is contained in:
parent
d26562d43d
commit
e63d4bf170
@ -158,14 +158,17 @@ func StartASCIIArtStream(streamID string, reader io.ReadCloser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert image to ASCII
|
// Convert image to ASCII
|
||||||
for j := 0; j < Cfg.Height; j++ {
|
for i, pixel := range pixelBuff {
|
||||||
for i := 0; i < Cfg.Width; i++ {
|
if i%Cfg.Width == 0 {
|
||||||
textBuff.WriteByte(asciiChars[pixelBuff[Cfg.Width*j+i]/22])
|
// New line
|
||||||
textBuff.WriteByte(asciiChars[pixelBuff[Cfg.Width*j+i]/22])
|
|
||||||
}
|
|
||||||
textBuff.WriteByte('\n')
|
textBuff.WriteByte('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Print two times the character to make a square
|
||||||
|
textBuff.WriteByte(asciiChars[pixel/22])
|
||||||
|
textBuff.WriteByte(asciiChars[pixel/22])
|
||||||
|
}
|
||||||
|
|
||||||
*(currentMessage[streamID]) = textBuff.String()
|
*(currentMessage[streamID]) = textBuff.String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user