Pack 8 to 4 bit color channel

I need help onto how to pack 8 to 4 bit color (alpha channel). It something like this right now:
1
2
3
4
5
6
7
8
9
10
11
12
// RGBA color 8 bits per channel
DWORD color_a;

// ARGB color 4 bits per channel
WORD color_b;

...

BYTE alpha = (BYTE)(color_a & 0xff);// grabs Alpha channel from color_a?
alpha???...// here i don't know how to pack and how to preserve "gradients"
color_b = alpha << 12; // puts in alpha channel of color_b
Previously there were 256 values per channel, now you have 16 per channel, so 16 times less.
Just divide each channel by 16:
alpha>>=4;
Thanks.
Topic archived. No new replies allowed.