Recent

Author Topic: graphics textrect problem.  (Read 1692 times)

powerpcer

  • Jr. Member
  • **
  • Posts: 53
graphics textrect problem.
« on: May 03, 2020, 12:45:23 pm »
it shows so randomly,
i use a loop to render text using textrect.
but it give me strange behavior.
it will randomly render text like attachment in red rectangle,
the bottom line of pixel of text will render opaque.
it only happen in ASCII character

wp

  • Hero Member
  • *****
  • Posts: 8730
Re: graphics textrect problem.
« Reply #1 on: May 03, 2020, 01:15:00 pm »
Please post the code that you use for painting this.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

powerpcer

  • Jr. Member
  • **
  • Posts: 53
Re: graphics textrect problem.
« Reply #2 on: May 03, 2020, 02:34:17 pm »
 workingDC is a canvas of TBitmap


 FFontSize.cx := ceil(workingDC.TextWidth('體') / 2);
  FFontSize.cy := workingDC.TextHeight('體');
loop
      r.Top:= r.Top+ FFontSize.cy ;
      r.Bottom:= r.Bottom+ FFontSize.cy;
....
....
TextStyle := workingDC.TextStyle;
TextStyle.Wordbreak := False;
workingDC.Brush.Color := AnsiColorTable[ gc ];
workingDC.FillRect(r);
workingDC.font.Color := AnsiColorTable[ fc ];
workingDC.TextRect(r,r.Left,r.Top, s,TextStyle);
« Last Edit: May 03, 2020, 03:24:23 pm by powerpcer »

wp

  • Hero Member
  • *****
  • Posts: 8730
Re: graphics textrect problem.
« Reply #3 on: May 03, 2020, 09:56:25 pm »
No, I don't want to play with pasted incomplete code snippets where I can make too many things different from you. What I need is a simple, compilable project which definitely shows the issue and which I can look at. Pack the .pas, .lfm, .lpi and .lpr files into a common .zip which you can upload via "Attachments and other options" below the forum edit box. Do not include the exe and other compiler generated files.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

powerpcer

  • Jr. Member
  • **
  • Posts: 53
Re: graphics textrect problem.
« Reply #4 on: May 05, 2020, 01:26:22 am »
ok, i found the problem is when i redraw it use stretchdraw().

powerpcer

  • Jr. Member
  • **
  • Posts: 53
Re: graphics textrect problem.
« Reply #5 on: May 10, 2020, 04:54:45 pm »
attachment is what i found in FPC developer mail list, it should be the standard of FPC

 

TinyPortal © 2005-2018