[Solved(Duplicate)] Is there any way to create 8bit-per-pixel grayscale canvas and draw on it?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
qwdqwqwffqw
Prole
Posts: 33
Joined: Sat Jan 25, 2020 4:11 pm

[Solved(Duplicate)] Is there any way to create 8bit-per-pixel grayscale canvas and draw on it?

Post by qwdqwqwffqw »

It would be helpful as in many simple games we use grayscale graphics only. Also, there are many elements(textbox, mask, etc) that use only black and white.

* Normal canvas needs 3 times more memory.
* 'la8' pixel format might be a good option(grayscale+alpha), but it can not be used in canvas - one could make imageData with la8 and use setPixel/mapPixel to draw on that, but it would be costly and cumbersome.
* 'r8' pixel format is available for canvas, but it is monochrome red(r, 0, 0) unlike la8(l, l, l, a). To my knowledge there is no way to turn this into grayscale(or monochrome of other tones) with setColor or setBlendMode, other than relying on shaders.
Last edited by qwdqwqwffqw on Wed Oct 09, 2024 2:25 pm, edited 1 time in total.
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: Is there any way to create 8bit-per-pixel grayscale canvas and draw on it?

Post by pgimeno »

I asked pretty much the same question a few years ago. I guess the answer is still the same.

viewtopic.php?t=89381
qwdqwqwffqw
Prole
Posts: 33
Joined: Sat Jan 25, 2020 4:11 pm

Re: Is there any way to create 8bit-per-pixel grayscale canvas and draw on it?

Post by qwdqwqwffqw »

Oops, should have searched for 'greyscale' as well. :)
Thanks!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests