Frage zu Graphios

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Seite 1 von 6
wilbo
Benutzer
Avatar
Geschlecht:
Alter: 69
Beiträge: 63
Dabei seit: 11 / 2023
Betreff:

Frage zu Graphios

 · 
Gepostet: 25.06.2025 - 17:26 Uhr  ·  #1
Hallo,

ich habe folgendes Problem:

gFillRect(110, 195, 210, 220, byte(clRed)); // geht nicht es wird nichts gezeichnet
mDelay(2000);
FillRect(110, 195, 210, 220, $FFE0); // geht
sprich der Aufruf unter umgehung von Graphios funktioniert.
Sind unter Graphios irgendwelche Besonderheiten zu beachten?

Treiber ist aus dem Demo XGraph_TFT320x240

Gruß wilbo
Harry
Moderator
Avatar
Geschlecht:
Herkunft: zwischen Augsburg und Ulm
Alter: 60
Beiträge: 2155
Dabei seit: 03 / 2003
Betreff:

Re: Frage zu Graphios

 · 
Gepostet: 26.06.2025 - 15:56 Uhr  ·  #2
Hallo Wilbo,

der Farbwert muß ein Word sein. Erstaunlich, daß du das mit Byte() compilieren kannst.

Gruss
Harry
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1476
Dabei seit: 03 / 2005
Betreff:

Re: Frage zu Graphios

 · 
Gepostet: 26.06.2025 - 17:14 Uhr  ·  #3
Hi Harry, Wilbo.

According to the manual the colour parameter for gFillRect is a byte.

gFillRect (Xs, Ys, Xe, Ye : integer; pattern : byte);
gFillRect (Xs, Ys, Xe, Ye : integer; color : byte); // xy-address mode

@Harry

Have you set your viewport?
wilbo
Benutzer
Avatar
Geschlecht:
Alter: 69
Beiträge: 63
Dabei seit: 11 / 2023
Betreff:

Re: Frage zu Graphios

 · 
Gepostet: 26.06.2025 - 17:43 Uhr  ·  #4
Hallo Harry und Merlin,
dank euch beiden für die Rückmeldung.
@Harry
die umsetzung von byte in word erfolgt wenn ich es richtig sehe in folgendem Code abschnitt:
Code
 
  // foreground color
  if colorFg > byte(max(tColors)) then
    ColorWfg:= $0000;   // clblack
    colorFg:= 1;
    ColorPfG:= colorFg;
  elsif colorFg <> ColorPfG then
    ColorPfG:= colorFg;
    ColorWfg:= ColorArr[(tColors(colorFg))];
  endif;

  // background color
  if colorBg > byte(max(tColors)) then
    ColorWbg:= $0000;   // clblack
    colorBg:= 1;
    ColorPbg:= colorBg;
  elsif colorBg <> ColorPbg then
    ColorPbg:= colorBg;
    ColorWbg:= ColorArr[(tColors(colorBg))];
  endif;

die Prozedure Fillrect ist meiner meinung nach ok und functioniert beim direkten aufruf bzw. Gclrscr(Byte(clWhite)) richtig.

Hi Harry and Merlin,
thanks to both of you for the feedback.
@Harry
the conversion from byte to word is done in the following code section if I see it correctly:
Code
 
 // foreground color
  if colorFg > byte(max(tColors)) then
    ColorWfg:= $0000;   // clblack
    colorFg:= 1;
    ColorPfG:= colorFg;
  elsif colorFg <> ColorPfG then
    ColorPfG:= colorFg;
    ColorWfg:= ColorArr[(tColors(colorFg))];
  endif;

  // background color
  if colorBg > byte(max(tColors)) then
    ColorWbg:= $0000;   // clblack
    colorBg:= 1;
    ColorPbg:= colorBg;
  elsif colorBg <> ColorPbg then
    ColorPbg:= colorBg;
    ColorWbg:= ColorArr[(tColors(colorBg))];
  endif;

the procedure Fillrect is ok in my opinion and functions correctly when called directly or Gclrscr(Byte(clWhite)).
Der an diesem Beitrag angefügte Anhang ist entweder nur im eingeloggten Zustand sichtbar oder die Berechtigung Deiner Benutzergruppe ist nicht ausreichend.
Harry
Moderator
Avatar
Geschlecht:
Herkunft: zwischen Augsburg und Ulm
Alter: 60
Beiträge: 2155
Dabei seit: 03 / 2003
Betreff:

Re: Frage zu Graphios

 · 
Gepostet: 26.06.2025 - 18:54 Uhr  ·  #5
Mir war das so in Erinnerung
Code

Type
  // enum for Color lookup table
  tColors        = (clBlack, clWhite, clBlue, clGreen, clRed, clAqua, clPurple,
                    clYellow, clGrey, clLtGrey, clLtrGrey, clBlue2, clGreen2,
                    clRed2, clAqua2, clPurple2, clYellow2, clBlue3, clGreen3,
                    clRed3, clAqua3, clPurple3, clYellow3);

  tColorArr      = Array[tColors] of Word;



Wieso geht dann das hier?

FillRect(110, 195, 210, 220, $FFE0); --> 1111 1111 1110 0000 --> 11111 rot, 111111 grün, 00000 blau

Gefunden ...

Code

const
   // color lookup table
  ColorArr : tColorArr = ($8888,       // clNone,
                          $07FF,       // clAqua,
                          $0000,       // clBlack,
                          $001F,       // clBlue
                          $E718,       // clCream
                          $7BEF,       // clDkGray
                          $E018,       // clFuchsia  6

                          $9472,       // clGray
                          $07E0,       // clGreen
                          $07F8,       // clLime
                          $C618,       // clLtGray
                          $8000,       // clMaroon
                          $73AE,       // clMedGray
                          $7D0C,       // clMoneyGreen  13

                          $0010,       // clNavy
                          $BCEA,       // clOlive
                          $F81F,       // clPurple
                          $F800,       // clRed
                          $C61C,       // clSilver
                          $9E1C,       // clSkyBlue
                          $0410,       // clTeal    20

                          $FFFF,       // clWhite
                          $FFE0,       // clYellow
                          $F81F,       // clMAGENTA
                          $07FF);      // clCyan    24
Merlin
Administrator
Avatar
Geschlecht:
Alter: 25
Beiträge: 1476
Dabei seit: 03 / 2005
Betreff:

Re: Frage zu Graphios

 · 
Gepostet: 26.06.2025 - 19:27 Uhr  ·  #6
I have looked at the compiler source for gFillRect. Here is my assessment.

There are two versions of gFillRect, depending on the type of graphic controller that you have. If the controller type is RA8875 then that last parameter should be a tColors type (e.g. clRed). Otherwise that last parameter is a byte.

You appear to be using the second form.

In this form the last parameter is not a colour. It is a fill pattern.

=========================================================================

Ich habe mir den Compiler-Quellcode für gFillRect angesehen. Hier ist meine Einschätzung:

Es gibt zwei Versionen von gFillRect, abhängig vom Typ Ihres Grafikcontrollers. Wenn der Controllertyp RA8875 ist, sollte der letzte Parameter ein tColors-Typ (z. B. clRed) sein. Andernfalls ist der letzte Parameter ein Byte.

Sie scheinen die zweite Version zu verwenden.

In dieser Version ist der letzte Parameter keine Farbe, sondern ein Füllmuster.
wilbo
Benutzer
Avatar
Geschlecht:
Alter: 69
Beiträge: 63
Dabei seit: 11 / 2023
Betreff:

Re: Frage zu Graphios

 · 
Gepostet: 27.06.2025 - 09:52 Uhr  ·  #7
Hallo Harry, Merlin
Graphios erwartet doch für ColorFg..Bg ein Byte und das kann doch nur ein Index von ColorArr sein. So ergibt byte(clYellow) gleich 22. Oder bin ich da völlig auf dem Holzweg.
userdevice GraphIOS(xs, ys, xe, ye: word; pattern, colorFg, colorBg: byte; draw: gDrawType): byte;

Hello Harry, Merlin
Graphios expects a byte for ColorFg..Bg and that can only be an index of ColorArr. So byte(clYellow) equals 22. or am I completely on the wrong track.
userdevice GraphIOS(xs, ys, xe, ye: word; pattern, colorFg, colorBg: byte; draw: gDrawType): byte;

Gruß wilbo
wilbo
Benutzer
Avatar
Geschlecht:
Alter: 69
Beiträge: 63
Dabei seit: 11 / 2023
Betreff:

Re: Frage zu Graphios

 · 
Gepostet: 27.06.2025 - 15:34 Uhr  ·  #8
Hallo Merlin & Harry,
Ist es tatsächlich abhängig vom Controller Typ(RA8875) welche der Version von gFillRect verwendet wird, wäre dann nicht besser es vom Import von GraphColor abhängen würde.
Denn ich als Anwender habe ja nicht die Wahl der Version und ich würde denken das Füllmuster ohne Farbe nur bei Monochromen Displays ein Sinn ergibt.

Hi Merlin & Harry,
Is it really dependent on the controller type (RA8875) which version of gFillRect is used, wouldn't it be better if it depended on the import of GraphColor.
Because I as a user do not have the choice of the version and I would think that the fill pattern without color only makes sense for monochrome displays.

Gruß Wilbo
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • Seite 1 von 6
Gewählte Zitate für Mehrfachzitierung:   0

Registrierte in diesem Topic

Aktuell kein registrierter in diesem Bereich

Die Statistik zeigt, wer in den letzten 5 Minuten online war. Erneuerung alle 90 Sekunden.
MySQL Queries: 15 · Cache Hits: 14   137   151 · Page-Gen-Time: 0.034164s · Speichernutzung: 2 MB · GZIP: ein · Viewport: SMXL-HiDPI