hzeller / rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO
GNU General Public License v2.0
3.71k stars 1.17k forks source link

What is the best way to implement a kind of diffusion from a central pixel to its surrounded pixels #1067

Open croisez opened 4 years ago

croisez commented 4 years ago

I was thinking that it could be of interest to implement a diffusion of a pixel to its surrounded pixels. It could be an equivalent of an anti-aliasing process.

I tried to dig into the code, and arrived at the FrameCanvas::SetPixel() function, and tried to modify it to implement the pixel diffusion. But I was searching for something like FrameCanvas::GetPixel(), but could not find it.

So, how could I determine the RGB values of a pixel, given its coordinates?

hzeller commented 4 years ago

You have to implement a canvas (Canvas is just an interface) that delegates to another Canvas but keeps the pixels in an array so that you can implement getPixel(). The FrameCanvas internally converts it into the memory representation needed to push it to the matrix and there is no cheap way converting it back.

croisez commented 4 years ago

Can you point me to some example, I have no idea how to create such delegated Canvas

Le dim. 17 mai 2020 à 18:02, Henner Zeller notifications@github.com a écrit :

You have to implement a canvas (Canvas is just an interface) that delegates to another Canvas but keeps the pixels in an array so that you can implement getPixel(). The FrameCanvas internally converts it into the memory representation needed to push it to the matrix and there is no cheap way converting it back.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hzeller/rpi-rgb-led-matrix/issues/1067#issuecomment-629820444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANRFSJHGOPSZ6VPWABTMP3RSADCNANCNFSM4NDKZWKQ .