![]() |
color integer wert von "grau"
ich hätte gerne diesen color integer wert (von mycolor := 12213123 zB) für grau generell(so das man den wert hell - dunkel grau machen kann
.... aus was ergeben sich die werte überhaupt? danke |
Re: color integer wert von "grau"
das sind rgb werte. jeweils 1 byte für r g und b, um 16, 8 bzw 0 bit nach links verschoben (shl). bei grau ist r=b=g
|
Re: color integer wert von "grau"
Hi Nico,
sieh mal in der OH nach: ![]() Meine heißgeliebte OH schreibt: If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color intensities for blue, green, and red, respectively. The value $00FF0000 represents full-intensity, pure blue, $0000FF00 is pure green, and $000000FF is pure red. $00000000 is black and $00FFFFFF is white. If the highest-order byte is zero, the color obtained is the closest matching color in the system palette. If the highest-order byte is one ($01), the color obtained is the closest matching color in the currently realized palette. If the highest-order byte is two ($02), the value is matched with the nearest color in the logical palette of the current device context. Bei Graustufen sind einfach die Bytes für Rot, Gelb und Blau genau gleich, somit ergeben sich die 256 verschiedenen Grautöne. Beantwortet das deine Frage? Greetz alcaeus |
Re: color integer wert von "grau"
Hallo!
Die Farbwerte setzen sich aus Rot-, Grün- und Blauanteilen zusammen, die in einem 32 bit Farbwert jeweils durch ein Byte representiert werden. Um Grauwerte zu bekommen müssen die drei Farbkomponenten jeweils den gleichen Wert haben (Folglich gibt es 256 verschiedene Grauwerte, inklusive Schwarz und Weiß). Du kannst diue Funktion rgb() verwenden, der du jeweils ein byte für Rot, Grün und Blau übergibst. Alternativ kannst du die Farbe direkt als Zahlwert schreiben, dazu bietet sich die Hexadezimale Schreibweise an, da man hier jedes byte direkt sieht. Achtung: das niederwertigste byte steht für Rot, dann kommt Grün, dann Blau, das höchstwertige byte bestimmt, wie die Farbe dargestellt wird (siehe OH). Ein Farbwert in hexadezimaler Schreibweise sieht also vom Aufbau zB. so aus: $00BBGGRR (R=rot,G=grün, B=blau) (steht auch alles in der OH). So wäre zB. $00808080 ein mittleres Grau, $00F0F0F0 ein helles, und $000A0A0A ein dunkleres. Viele Grüße, Sebastian |
Re: color integer wert von "grau"
nicht ganz :zwinker:
nämlich ... wie wäre jetzt der code für "grau" ... so in btnface richtung ... und wie würde ich das nacher dunkler machen 255255255 ist es nicht :| und der wert bei mycolor := 1232; muss ja nicht 8 zeichen lang sein :gruebel: |
Re: color integer wert von "grau"
habs geschafft!!
danke vielmals! habs per rbg() gemacht! :love: |
Re: color integer wert von "grau"
Zitat:
Dunkler wirds mit kleineren Werten der bytes, zB. $00505050 Viele Grüße, Sebastian |
Re: color integer wert von "grau"
danke!
|
Re: color integer wert von "grau"
naja ... ich glaub ihr m,üsst mir trotzdem weiterhelfen :stupid:
Delphi-Quellcode:
wenn ihr es ausprobiert werdet ihr sehen das der code insofern schlecht ist ...
var
Form1: TForm1; MyPoints : Array [1..150] of TPoint; Zahl : Integer = 1; implementation {$R *.dfm} procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var i : Integer; begin Canvas.Brush.Color := clblack; Canvas.FillRect(Rect(0,0,Form1.Width,Form1.Height)); Canvas.Pixels[X,Y] := 1111111; if Zahl < high(MyPoints)-1 then MyPoints[Zahl] := Point(X,Y) else begin zahl := 1; MyPoints[Zahl] := Point(X,Y); end; for i := 1 to high(MyPoints)-1 do begin If (MyPoints[i].X <> 0) and (MyPoints[i].Y <> 0) then Canvas.Pixels[MyPoints[i].X, MyPoints[i].Y] := rgb(105+i,105+i,105+i) ; // form1.caption := 'rgb(55+' + IntToStr(i) + ',55+' + IntToStr(i) +',55+' + IntToStr(i) ; end; //Canvas.Pixels[Xold,Yold] := clgray; //MyPoint[ inc(Zahl); end; procedure TForm1.FormCreate(Sender: TObject); var i : Integer; begin for i := 1 to high(MyPoints)-1 do MyPoints[i] := Point(0,0); end; ich wollte das der pixel der neu gezzeichnet wird der hellste ist(weiß also) und der rest pixel für pixel grauer wird (von hell zu dunkel) so das es auschaut als zieht es sich so hinterhe rund fällt ab geht aber irgendwie nicht ganz und die logik hab ich nicht :wall: |
Re: color integer wert von "grau"
*push*
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:28 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