|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How can I calculate GetBrightness ny myself?I know there is a function named GetBrightness() on .net framework but if I
need to write this function by myself, how can I do? Because some language does not provide this function, can I calculate by using R G B of the color? Thanks Hi Dominic,
Using Lutz Roeder's Reflector, I see the following code under System.Drawing.Color: ''' <summary>Gets the hue-saturation-brightness (HSB) brightness value for this <see cref="T:System.Drawing.Color"></see> structure.</summary> ''' <returns>The brightness of this <see cref="T:System.Drawing.Color"></see>. The brightness ranges from 0.0 through 1.0, where 0.0 represents black and 1.0 represents white.</returns> Public Function GetBrightness() As Single Dim single1 As Single = (CSng(Me.R) / 255!) Dim single2 As Single = (CSng(Me.G) / 255!) Dim single3 As Single = (CSng(Me.B) / 255!) Dim single4 As Single = single1 Dim single5 As Single = single1 If (single2 > single4) Then single4 = single2 End If If (single3 > single4) Then single4 = single3 End If If (single2 < single5) Then single5 = single2 End If If (single3 < single5) Then single5 = single3 End If Return ((single4 + single5) / 2!) End Function MSDN article for more info: http://msdn2.microsoft.com/en-us/library/system.drawing.color.getbrightness.aspx Hope this information helps, Chris Show quoteHide quote "Dominic" <j_ala***@hotmail.com> wrote in message news:eK6yddg8GHA.3396@TK2MSFTNGP04.phx.gbl... >I know there is a function named GetBrightness() on .net framework but if I >need to write this function by myself, how can I do? > > Because some language does not provide this function, can I calculate by > using R G B of the color? > > Thanks >
how do you use Class to hold global variables?
Installed, but where is it? Full qual. name of current method DateTime Field Writing Data In Tabular format in Text File. What framework is running in this scenario? VBNET2005 : Manipulating MS Access tabledefinitions in VB.NET -> Create, Copy and Drop Table. Passing parameters in VB 2005!! Showing Form in New Thread? db connections and text boxes |
|||||||||||||||||||||||