Extension method library for actions on System.Drawing.Color

安稳与你 提交于 2020-01-01 11:55:10

问题


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:


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.



来源:https://stackoverflow.com/questions/780759/extension-method-library-for-actions-on-system-drawing-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!