Extension method library for actions on System.Dra

2019-04-10 04:29发布

Has anyone written a nice extension method 'library' for System.Drawing.Color.

Would be nice to say :

 Color.Red.AdjustBrightness(.5)
 Color.Red.AdjustAlpha(.5)
 Color.Red.ToHSV()

or something like that.

Alpha is easy, but others become time consuming because you have to go off and fine all the right mathematical equations for HSV and HSB and all that fun stuff.

Hoping someone else had done the work already :-) Microsoft doesn't seem to want to do it for me.

1条回答
看我几分像从前
2楼-- · 2019-04-10 05:31

CodeProject has some code for an HSBColor class. It doesn't include extension methods, but they would be very straightforward to write once you have the HSBColor class and its associated conversion code available.

查看更多
登录 后发表回答