Modify

Opened 6 years ago

Closed 6 years ago

#3687 closed Bug (Fixed)

_ColorConvertRGBtoHSL does not use right bases

Reported by: Nine Owned by: Melba23
Milestone: 3.3.15.1 Component: AutoIt
Version: 3.3.14.5 Severity: None
Keywords: Cc:

Description

The formulas are good but the base to finalize the results is wrong. H is a degree so base should be 360, S and L are percentages, so base should be 100. But in the current UDF (color.au3) the base used is 240 !

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by Melba23

  • Owner set to Melba23
  • Status changed from new to assigned

Looking into it, but at first glance it seems you are correct.

M23

comment:2 Changed 6 years ago by Melba23

A fairly simple fix.

We need to replace this single constant:

Global Const $__COLORCONSTANTS_HSLMAX = 240

with these 2:

Global Const $__COLORCONSTANTS_HMAX = 360
Global Const $__COLORCONSTANTS_SLMAX = 100

and adjust the formulae in the 2 conversion functions to match:

; _ColorConvertHSLtoRGB
Local $nR, $nG, $nB
Local $nH = Number($aArray[0]) / $__COLORCONSTANTS_HMAX
Local $nS = Number($aArray[1]) / $__COLORCONSTANTS_SLMAX
Local $nL = Number($aArray[2]) / $__COLORCONSTANTS_SLMAX
.
.
.
; _ColorConvertRGBtoHSL
$aArray[0] = $nH * $__COLORCONSTANTS_HMAX
$aArray[1] = $nS * $__COLORCONSTANTS_SLMAX
$aArray[2] = $nL * $__COLORCONSTANTS_SLMAX

That gives me the correct values according to colour conversion websites.

M23

comment:3 Changed 6 years ago by Melba23

  • Milestone set to 3.3.15.1
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [12186] in version: 3.3.15.1

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Melba23.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.