Difference between revisions of "TColorToRGB/de"

From Lazarus wiki
Jump to navigationJump to search
m (Fixed syntax highlighting; deleted category included in page template)
 
Line 1: Line 1:
 
{{TColorToRGB}}
 
{{TColorToRGB}}
<br>
+
 
Zurück zur Seite [[code examples/de|Code Beispiele]].<br>
+
 
<br>
+
Zurück zur Seite [[code examples/de|Code Beispiele]].
Wandelt Datentyp TColor in RGB-Farbwerte um.<br>
+
 
<br>
+
 
 +
Wandelt Datentyp TColor in RGB-Farbwerte um.
 +
 
 
Die maximalen Werte von RGB sind 255, 255, 255. Das Ergebnis ist die Farbe Weiss.<br>
 
Die maximalen Werte von RGB sind 255, 255, 255. Das Ergebnis ist die Farbe Weiss.<br>
 
Die minimalen Werte von RGB sind 0, 0, 0. Das Ergebnis ist die Farbe Schwarz.<br>
 
Die minimalen Werte von RGB sind 0, 0, 0. Das Ergebnis ist die Farbe Schwarz.<br>
<syntaxhighlight>
+
 
 +
<syntaxhighlight lang=pascal>
 
uses
 
uses
 
   Graphics, Windows, ...;
 
   Graphics, Windows, ...;
Line 28: Line 31:
  
 
</syntaxhighlight>
 
</syntaxhighlight>
<br>
 
<br>
 
--[[User:Olaf|Olaf]] 16:44, 30 April 2013 (UTC)
 
 
  
 
{{AutoCategory}}
 
{{AutoCategory}}
 
[[Category:Code Snippets/de]]
 
[[Category:Code Snippets/de]]
 
[[Category:Color/de]]
 
[[Category:Color/de]]

Latest revision as of 06:04, 29 February 2020

Deutsch (de)


Zurück zur Seite Code Beispiele.


Wandelt Datentyp TColor in RGB-Farbwerte um.

Die maximalen Werte von RGB sind 255, 255, 255. Das Ergebnis ist die Farbe Weiss.
Die minimalen Werte von RGB sind 0, 0, 0. Das Ergebnis ist die Farbe Schwarz.

uses
  Graphics, Windows, ...;

...

procedure subTColorToRGB(Color: TColor; out bytR: byte; out bytG: byte; out bytB: byte);
begin
  if Color shr 24 = $FF then
    Color := GetSysColor(Color and $FF)
  else if Color shr 24 > $02 then
    Color := 0;

  bytR := Color;
  bytG := (Color shr 8);
  bytB := (Color shr 16);
end; 

...