Some tips about 2d visualization based on image.
RGBs and RsGsBs
When we look at one colored image with width*height
pixels, there are actually three layers (red, green and blue). We can get colorful results when we blend these three values properly on screen.
There are two typical ways to store each pixel value, store results separately, such as RRRR…GGGG…BBBB we use RGBs to represent it, we store each channel separately. Another way is store it by RGBs namelly RGBRGBRGB… we need to know the how the data is stored in memory before we give image to specific paiting library.
Number of channels
Typical way is RGB for three channels and RGBA for four channels. The A value represents the alpha value which shows the transparency of each pixel. Using RGBA as an example, there are usually 4*8bit=32bit=4B
for each pixle.
Using Cario as 2d painter example
Depending on little endian and small endian, the sequence of data can be different. For small endian, the first data is put from low memory address to high memory address. For big endian mode, the data is put into the high memory address firstly and then small address.
For cario RGB24, and the data is small endian, we actually put bbbbbbbbggggggggrrrrrrrr in memory (left is high memory address and right is low memory address)
TODO, add cario little small endian pattern