STM32 Cube board support package TFT und Farbe

Gast #5059737
Lesenswert?

Ich versuche, die Funktion für ein farbiges Rechteck zu schreiben:
1
    void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
2
    {
3
      BSP_LCD_SetTextColor(color);  // keine Farbänderung
4
      BSP_LCD_SetBackColor(color);  // keine Farbänderung
5
      BSP_LCD_SetColorKeying(0, color); // keine Farbänderung
6
      BSP_LCD_FillRect(x, y, w, h); // Rechteck bleibt schwarz
7
    };

Mist, es bleibt schwarz.
Ich finde nirgends ein Beispiel
Gast #5059773
Lesenswert?

bittesehr:
1
/****************************************************************
2
 Rechteck auf Bildschirm mit Farbe füllen.
3
 left/top = erste zu füllende Koordinate
4
 right/bottom = letzte zu füllende Koordinate.
5
 also CgFillRect(.. 3,3,3,3) füllt genau 1 Pixel auf Position 3/3
6
 ****************************************************************/
7
void CgFillRect  (TDCB* DC, RECT* R)
8
{ word* Pb;
9
  int  i, left, top, right, bott;
10
  word  color;
11

12
  left = R->left;
13
  top  = R->top;
14
  right= R->right;
15
  bott = R->bottom;
16
  if (left < DC->CurrentClipRect.left)   left  = DC->CurrentClipRect.left;
17
  if (right> DC->CurrentClipRect.right)  right = DC->CurrentClipRect.right;
18
  if (top  < DC->CurrentClipRect.top)    top   = DC->CurrentClipRect.top;
19
  if (bott > DC->CurrentClipRect.bottom) bott  = DC->CurrentClipRect.bottom;
20
  color = DC->BrushColor;
21
  Pb = DC->Buffer + ( top * DC->PixelPerLine );
22
  while (top <= bott)
23
  {  i = left;
24
     while (i <= right)  Pb[i++] = color;
25
     ++top;
26
     Pb = Pb + DC->PixelPerLine;
27
  }
28
}

W.S.
Gast #5060281
Lesenswert?

aus dem BSP:
#define LCD_COLOR_ORANGE        ((uint32_t)0xFFFFA500)

void BSP_LCD_SetTextColor(uint32_t Color)
{
  DrawProp[ActiveLayer].TextColor = Color;
}

dein Beispiel:
void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t 
color)
    {
BSP_LCD_SetTextColor(color);
...
};

ein Byte zuwenig bei der Farbe.

Gruß,

dasrotemopped.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren