I think its must be possible, but i am not really sure how to use/write it in C#. What i need is an array where i can read/write RGBA values and just direct access to RED, GREEN, BLUE, ALPHA.
// Init
public struct ARGB // RGBA or ARGB ^^
{
public byte A;
public byte R;
public byte G;
public byte B;
}
public uint[] arTexture;
// Methode
public void TestStructArray()
{
arTexture = new uint[64 * 64];
}
Later something like following should be possible:
// Set (byte) value for any color channel
arTexture[ position ].A = 255
arTexture[ position ].R = 255
arTexture[ position ].G = 255
arTexture[ position ].B = 255
// Set (uint) value for ARGB pixel value
arTexture[ position ].ARGB = 0xFF224466
// Get (byte) value of any color channel
valueA = arTexture[ position ].A
valueR = arTexture[ position ].R
valueG = arTexture[ position ].G
valueB = arTexture[ position ].B
ValueARGB = arTexture[ position ].RGBA
Any idea how this can be done (array with struct)? And yes, i know this can be done by using C#'s COLOR... But i want to use my own for some reasons

[Edited - Added:]
Atm i am using an uint[] where i read/write the full pixelcolor as ARGB and using SHL/SHR operators to get/set the value of the wanted color channel! This works but i want to have a cleaner code and being more flexible.