![]() |
Gleiche Farbwerte sind innerhalb einer Anwendung ungleich
Ja ich hab da eine Größere Anwendung in der gibt es eine TStringGrid Abgeleitete Gitter Componente
und eine von TPaintbox abgeleitete ....DekoKomponete(?)... . Wenn ich mein Betriebssystem mit 256 Farben fahre dann wird die Farbe $80FF80 , welches eine reine Farbe ist, auf der Dekokomponente als perverses grün angezeigt und auf der Gitter komponente als Grau. Ich will aber das perverse Grün! Ich vermute das das Problem darin liegt das das Gitter mit der TextRect(*bla*) (in Drawcell) direkt auf das Canvas von dem TStringgrid nachfahren malt. Tstringgrid.GetPalette ist aber 0. Während die methode Paint des TPaintbox Nachfahren zunächst auf ein TBitmap malt und dieses dann über Draw(0,0,bitmap) darstellt. Tbitmap hat eine Palette! Tbitmap.GetPalette ergibt einen Handle. Das mit den 256 Farben ist wichtig wegen des alten Terminalservers 2000 der nur 256 Farben kann, 16Bit-Grafik gibts ja auch erst seit 1984 oder so.... Ich hoffe es kann mir jemand sagen ob meine Vermutung stimmt oder mir sonst wie weiterhelfen. Letztes hatte ich kaum Feedback. |
Re: Gleiche Farbwerte sind innerhalb einer Anwendung ungleic
Ich denke auch, dass es an dem Bitmap und dem Canvas liegt. Während das Bitmap mit echten Paletten-Farben arbeitet werden die Farben des StringGrids vom Betriebssystem heruntergerechnet, wodurch es zu diesen Anzeigen kommt.
Vieleicht funktioniert es, wenn du das Stringgrid auf ein Internes Bitmap zeichnest und dieses dann in 256 Farben umwandelst... |
Re: Gleiche Farbwerte sind innerhalb einer Anwendung ungleic
Vielleicht verbessert sich die Darstellung ja schon, wenn du beim Farbwert $80FF80 das HighByte des 32-bit Wertes auf $01 oder $02 setzt ($0180FF80 bzw. $0280FF80) . Lies mal dazu die Online-Hilfe zu TColor.
Grüße vom marabu |
Re: Gleiche Farbwerte sind innerhalb einer Anwendung ungleic
Normalerweise sind die High Bits doch imme 00 ?
Also ein Reines $0080FF80 Oder habe ich da nu was falsch verstanden. |
Re: Gleiche Farbwerte sind innerhalb einer Anwendung ungleic
Also die Farbkonstanten sind mit Palette $00 definiert, aber was in den Bildern/der Farbpalette verwendet wird, ist 'ne andere angelegenheit.
Delphi-Quellcode:
( TColor - RGB-Color (Red, Green, Blue):
( ************************************** ( ( TColorRec = Record Case Byte of ( 0: (Org: TColor); ( 1: (Red, Green, Blue, Palette: Byte); << if Palette = $00..$02 ( 2: (Systemcolor: Byte; dummy: Word; Palette: Byte); << if Palette = $FF ( ... ( End; ( ( Palette = $00: most similar color from the system palette ( Palette = $01: most similar color from the acting palette ( Palette = $02: most similar color from the logical palette of the current device context ( Palette = $FF: system color ( ( Palette = $1F: no color ( Palette = $20: default color
Delphi-Quellcode:
Const cpSystemPalette = $00;
cpActingPalette = $01; cpLogicalPalette = $02; cpNoColor = $1F; cpDefaultColor = $20; cpSystemColor = $FF; clScrollBar = TColor(cpSystemColor shl 24 or TColorIndex(0)); clBackground = TColor(cpSystemColor shl 24 or TColorIndex(1)); clActiveCaption = TColor(cpSystemColor shl 24 or TColorIndex(2)); clInactiveCaption = TColor(cpSystemColor shl 24 or TColorIndex(3)); clMenu = TColor(cpSystemColor shl 24 or TColorIndex(4)); clWindow = TColor(cpSystemColor shl 24 or TColorIndex(5)); clWindowFrame = TColor(cpSystemColor shl 24 or TColorIndex(6)); clMenuText = TColor(cpSystemColor shl 24 or TColorIndex(7)); clWindowText = TColor(cpSystemColor shl 24 or TColorIndex(8)); clCaptionText = TColor(cpSystemColor shl 24 or TColorIndex(9)); clActiveBorder = TColor(cpSystemColor shl 24 or TColorIndex(10)); clInactiveBorder = TColor(cpSystemColor shl 24 or TColorIndex(11)); clAppWorkSpace = TColor(cpSystemColor shl 24 or TColorIndex(12)); clHighlight = TColor(cpSystemColor shl 24 or TColorIndex(13)); clHighlightText = TColor(cpSystemColor shl 24 or TColorIndex(14)); clBtnFace = TColor(cpSystemColor shl 24 or TColorIndex(15)); clBtnShadow = TColor(cpSystemColor shl 24 or TColorIndex(16)); clGrayText = TColor(cpSystemColor shl 24 or TColorIndex(17)); clBtnText = TColor(cpSystemColor shl 24 or TColorIndex(18)); clInactiveCaptionText = TColor(cpSystemColor shl 24 or TColorIndex(19)); clBtnHighlight = TColor(cpSystemColor shl 24 or TColorIndex(20)); cl3DDkShadow = TColor(cpSystemColor shl 24 or TColorIndex(21)); cl3DLight = TColor(cpSystemColor shl 24 or TColorIndex(22)); clInfoText = TColor(cpSystemColor shl 24 or TColorIndex(23)); clInfoBk = TColor(cpSystemColor shl 24 or TColorIndex(24)); clHotLight = TColor(cpSystemColor shl 24 or TColorIndex(26)); clGradientActiveCaption = TColor(cpSystemColor shl 24 or TColorIndex(27)); clGradientInactiveCaption = TColor(cpSystemColor shl 24 or TColorIndex(28)); clMenuHighlight = TColor(cpSystemColor shl 24 or TColorIndex(29)); clMenuBar = TColor(cpSystemColor shl 24 or TColorIndex(30)); { No Const } {} _Palette_ = cpSystemPalette shl 24; clBlack = TColor(_Palette_ or $000000); clGray = TColor(_Palette_ or $808080); clLtGray = TColor(_Palette_ or $C0C0C0); clWhite = TColor(_Palette_ or $FFFFFF); clMaroon = TColor(_Palette_ or $000080); clRed = TColor(_Palette_ or $0000FF); clGreen = TColor(_Palette_ or $008000); clLime = TColor(_Palette_ or $00FF00); clOlive = TColor(_Palette_ or $008080); clYellow = TColor(_Palette_ or $00FFFF); clNavy = TColor(_Palette_ or $800000); clBlue = TColor(_Palette_ or $FF0000); clPurple = TColor(_Palette_ or $800080); clFuchsia = TColor(_Palette_ or $FF00FF); clTeal = TColor(_Palette_ or $808000); clAqua = TColor(_Palette_ or $FFFF00); clDkGray = clGray; // = TColor(_Palette_ or $808080); clSilver = clLtGray; // = TColor(_Palette_ or $C0C0C0); clMoneyGreen = TColor(_Palette_ or $C0DCC0); clSkyBlue = TColor(_Palette_ or $F0CAA6); clCream = TColor(_Palette_ or $F0FBFF); clMedGray = TColor(_Palette_ or $A4A0A0); clNone = TColor(cpNoColor shl 24 or $FFFFFF); clDefault = TColor(cpDefaultColor shl 24 or $000000); |
Re: Gleiche Farbwerte sind innerhalb einer Anwendung ungleic
Danke erstmal für das feedback.
ja das mit den $01 und $02 Paletten hab ich auch schon versucht. Das hat mir im falles eines hallen Reinen gelb geholfen $02 zu nehmen $01 ist immer schwarz. aber bei $02 funktioniert dieses Pastelfarbene Grün im Falle des StringGrids dennoch nicht. Die methode mit dem zwischen schritt über das Bitmap hab ich mir auch schon überlegt evtl müste ich zusätzlicg GetPalette auch noch überschreiben um eine vernünftige anzeige zu kriegen. Werd es Montag versuchen, drückt mir die daumen. @Himitsu : wie soll das mit dem Listing mir helfen? meinst ich sollte eine ganz andere Palette verwenden? |
Re: Gleiche Farbwerte sind innerhalb einer Anwendung ungleic
OK also das benutzen eines buffers (TBitmap) für das Grid hats nicht gebracht. weiß echt nicht wie
das problem gelüst werden könnte. |
Re: Gleiche Farbwerte sind innerhalb einer Anwendung ungleic
Verwendet TBitmap nicht Device independend Bitmaps?
Lösung 1: Verwende keine DIBs 2. Frag ab ob 256Farben aktiviert sind und verwende eine andere Farbe um dein Grün zu erreuchen 3. Frag ab (gab im Block von Raymond Chen letztens ein Beispiel wie dies funktioniert) ob der Terminalserver aktiv ist und a) Verwende Lösung 2 oder b) Verwende kein Bitmap, da Bitmaps TerminalServern übel aufstossen. Grund ist dass nicht die reinen Zeichenbefehle übertragen werden können, sondern das gesamte Bitmap umständlich durch die Leitung wandern muss. Gruss *Edit* Achja, mir ist noch etwas eingefallen, keine Ahnung ob es der Fall sein kann. Kann es sein das du das Bitmap VOR dem Umschalten auf die 256 Farben erzeugst? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:17 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