Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.167 Beiträge
 
Delphi 12 Athens
 
#2

AW: Problem mit verschiedenen Typen im RGB-to-HSL-Range Procedur

  Alt 4. Jul 2022, 22:29
Code:
 R := GetRValue (RGB) / 255;
 G := GetGValue (RGB) / 255;
 B := GetBValue (RGB) / 255;

^^^ Byte  :=         ^^^ Float
Doesn't the compiler tell you exactly what's wrong?

On the right you have a float (Extended) and you want to assign that to an integer (byte) on the left, which of course cannot work.
Why are you dividing there at all?



Also, the compiler should tell you that these lines are wrong (useless).
Delphi-Quellcode:
 h1 := h;
 s1 := s;
If you change a little thing, you will quickly realize that the value is only output, but not input (InOut).
Delphi-Quellcode:
//procedure RGB2HSVRange(RGB: TColor; var H: Word; var S, V: Byte);
  procedure RGB2HSVRange(RGB: TColor; out H: Word; out S, V: Byte);
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests

Geändert von himitsu ( 4. Jul 2022 um 23:21 Uhr)
  Mit Zitat antworten Zitat