Javascript Canvas pixelformat

I noticed that everyone who works with the Canvas object multiplies around the pixelbuffer by 4 (RGBA). I worked a lot with built-in pixel coding (Delphi and C ++) and recognized this as a regular 32-bit RGBA (encoding 888-8). My question is : is there a way to detect the browser pixel format? If you are working on a device that supports 16-bit (565) or 24-bit (888) encoding, this will be very slow if the browser has to lower the bitmaps for each redraw. Especially when using alpha blending.

Also (and this is secondary): Is it possible to create a clean 888 or 565 raster map in general under javascript? Or what about an 8-bit palette based on a bitmap? JS-based games would benefit only by being able to work with 8-bit pixels in my view.

+5
source share
3 answers

No. There is no way to lower the pixels of the canvas, since this is what imageData is just up to the specification itself.

You can, of course, create a javascript game using only 8-bit PNGs, which will save loading time and time, but not display the time.

+3
source

, , . . , (Google Chrome) .

+2

: . 5-6-5 - , . <canvas> z-, .

"", .

0

All Articles