diff options
-rw-r--r-- | README.org | 6 | ||||
-rw-r--r-- | main.go | 9 |
2 files changed, 6 insertions, 9 deletions
@@ -29,11 +29,11 @@ Well, the idea to do this came to me as I was browsing the vim subreddit (as one does) and saw [[https://www.reddit.com/r/vim/comments/1e5o998/if_were_sharing_vim_pixel_art][this post]] by ~u/fapperruning~ where he drew the vim logo with pixel art. The size was small enough it could nicely fit - in a terminal window, though big enough it waas no feasible to draw by hand. + in a terminal window, though big enough it was not feasible to draw by hand. - So using this as a starting point, I searched for a way to firstly parse the image + So using this as a starting point, I searched for a way to parse the image and found [[https://www.piskelapp.com/p/create/sprite][Piskel]]. The amazing thing about Piskel is that it allows you to export - a sprite as a big integer array written in C. The first thing I did was to + a sprite as a big integer array written in a C file. The first thing I did was to downscale ~u/fapperruning~'s image so that 1 pixel = 1 square in the sprite. I the slightly modified Piskel's C file output so that it corresponds to a Go slice of 32-bit unsigned integers. @@ -54,11 +54,9 @@ func mkPixelStack(top, bot pixel) string { case noTop && noBot: return " " case noTop: - return fmt.Sprintf(botFmt+postFmt, - bot.r, bot.g, bot.b) + return fmt.Sprintf(botFmt+postFmt, bot.r, bot.g, bot.b) case noBot: - return fmt.Sprintf(topFmt+postFmt, - top.r, top.g, top.b) + return fmt.Sprintf(topFmt+postFmt, top.r, top.g, top.b) default: return fmt.Sprintf(topFmt+botFmt+postFmt, top.r, top.g, top.b, @@ -77,8 +75,7 @@ func (p pixelArt) draw(stream io.Writer) { if p.height%2 != 0 { for i := range top { - top[i] = pixel{0, 0, 0} - bot[i] = int2Pixel(p.pixels[0]) + top[i], bot[i] = pixel{0, 0, 0}, int2Pixel(p.pixels[0]) } drawRowStack(top, bot) topIdx += step |