Hi all
When I try this:
loColor = _Screen.System.Drawing.Color.DarkGray ? loColor.GetHue() ? loColor.GetSaturation() ? loColor.GetBrightness()
The result is
******************* (numeric overflow) 0 38174
A similar problem exists with other colours where R=G=B
Any ideas? Thanks.
Paul Newton
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Try Cast(loColor.GetHue() as Integer) or Cast(loColor.GetHue() as Numeric(12, 2)) ...
Alan
That solves GetHue() because Cast(loColor.GetHue() As Integer gives a result of 0, but what about DarkGray GetBrightness returning 38174 ?
Also DarkSalmon RGB(233,150,122) is returning: R = 0 G = 0 B = 0 Cast(GetHue() As Integer) = 0 Cast(GetSaturation() As Integer) = 0 Cast(GetBrightnes() As Integer) = 0
Paul
On 30/06/2022 16:31, Alan Bourke wrote:
Try Cast(loColor.GetHue() as Integer) or Cast(loColor.GetHue() as Numeric(12, 2)) ...
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
I don't think its implementation of these methods is correct Paul, comparing with what .NET would return.
You are right Alan so I have implemented conversion routines based on the following
https://www.rapidtables.com/convert/color/hsl-to-rgb.html https://www.rapidtables.com/convert/color/rgb-to-hsl.html
I also found this site useful for checking results
http://www.workwithcolor.com/color-converter-01.htm
I will look into how GDIPlusX does its calculations for H, S and L. Do you have a link for these conversions in .NET?
Paul
I also found this site useful for checking results On 01/07/2022 09:17, Alan Bourke wrote:
I don't think its implementation of these methods is correct Paul, comparing with what .NET would return.
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Paul
The .NET syntax is very similar: https://dotnetfiddle.net/b2uIkS
However it returns the lightness value in a range of 0 .. 1 so you have to multiply by 100 to express in a % which seems to be how everyone else does it.
Except Microsoft which uses 0-255 !
On 01/07/2022 14:41, Alan Bourke wrote:
Paul
The .NET syntax is very similar:https://dotnetfiddle.net/b2uIkS
However it returns the lightness value in a range of 0 .. 1 so you have to multiply by 100 to express in a % which seems to be how everyone else does it.
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---