AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Algorithmen, Datenstrukturen und Klassendesign Problem mit verschiedenen Typen im RGB-to-HSL-Range Procedur
Thema durchsuchen
Ansicht
Themen-Optionen

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

Ein Thema von neumimnemecky · begonnen am 4. Jul 2022 · letzter Beitrag vom 5. Jul 2022
 
Benutzerbild von himitsu
himitsu
Online

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.574 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);
Ein Therapeut entspricht 1024 Gigapeut.

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


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:57 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz