Mapping an Integer to an RGB color in C#

后端 未结 3 860
挽巷
挽巷 2020-12-29 10:47

So right now I have a number between 0 and 2^24, and I need to map it to three RGB values. I\'m having a bit of trouble on how I\'d accomplish this. Any assistance is apprec

3条回答
  •  暖寄归人
    2020-12-29 11:16

    You can do

    Color c = Color.FromArgb(someInt);
    

    and then use c.R, c.G and c.B for Red, Green and Blue values respectively

提交回复
热议问题