Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
michel

How can i make cool ascii logo

Question

3 answers to this question

Recommended Posts

  • 0

i know this is almost a year old

you can use u+2800 to u+28ff to do that
every character is 2x4 pixels
 

add the following amount for each pixel

1  8
2  16
4  32
64 128

some example code:

local unicode = require("unicode")

local PIXEL_AMOUNTS = {
	{0x01, 0x08},
	{0x02, 0x10},
	{0x04, 0x20},
	{0x40, 0x80},
}

local function draw(pixels)
	if #pixels % 4 ~= 0 then
		error("image height must be a multiple of 4")
	end
	
	if #pixels[1] % 2 ~= 0 then
		error("image width mode be a multiple of 2")
	end
	
	for cy = 1, #pixels, 4 do
		for cx = 1, #pixels[1], 2 do
			local char_code = 0x2800
			
			for y = 1, 4 do
				for x = 1, 2 do
					if pixels[cy + y - 1][cx + x - 1] then
						char_code = char_code + PIXEL_AMOUNTS[y][x]
					end
				end
			end
			
			io.write(unicode.char(char_code))
		end
		
		io.write("\n")
	end
end

local image = {
	{false, true,  true,  true,  true,  true,  true,  false},
	{true,  false, false, false, false, false, false, true},
	{true,  false, true,  false, false, true,  false, true},
	{true,  false, false, false, false, false, false, true},
	{true,  false, true,  true,  true,  true,  false, true},
	{true,  false, false, true,  true,  false, false, true},
	{true,  false, false, false, false, false, false, true},
	{false, true,  true,  true,  true,  true,  true,  false},
}

draw(image)

if you see this image multiple times its bc oc fourms is broken

 

image.png

image.png

image.png

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.