Recent

Author Topic: Yellow background with FontAntialias  (Read 10165 times)

Dibo

  • Hero Member
  • *****
  • Posts: 1045
Re: Yellow background with FontAntialias
« Reply #15 on: May 31, 2012, 03:39:47 pm »
This code get me white background (with 0 instead of 128). But I didn't draw any text, just only your code

circular

  • Hero Member
  • *****
  • Posts: 3048
    • Personal webpage
Re: Yellow background with FontAntialias
« Reply #16 on: June 01, 2012, 12:36:46 am »
Ok, so it's not a problem with ClearTypeDrawPixel.

Maybe is it a problem with BGRAFillClearTypeMask procedure of BGRAText. What if you do the replacement I proposed in BGRATextRect in the previous message ?
Conscience is the debugger of the mind

Dibo

  • Hero Member
  • *****
  • Posts: 1045
Re: Yellow background with FontAntialias
« Reply #17 on: June 01, 2012, 08:35:00 am »
Ok, now as you expected, I obtain cyan background.
« Last Edit: June 01, 2012, 02:58:17 pm by Dibo »

circular

  • Hero Member
  • *****
  • Posts: 3048
    • Personal webpage
Re: Yellow background with FontAntialias
« Reply #18 on: June 01, 2012, 04:07:55 pm »
So it's probable that BGRAFillClearTypeRGBMask (not BGRAFillClearTypeMask in fact, I confused them) get some wrong result. Why that, I don't know. Basically, you need to find why Cb (or Cr) parameter of ClearTypeDrawPixel gets a non zero value from BGRAFillClearTypeMask for the background.

What can I tell you about it? BGRAFillClearTypeRGBMask scans a mask bitmap, so maybe the pixels retrieved are not zero there.
Conscience is the debugger of the mind

Dibo

  • Hero Member
  • *****
  • Posts: 1045
Re: Yellow background with FontAntialias
« Reply #19 on: June 01, 2012, 08:24:50 pm »
What I found is that in BGRAText.BGRAFillClearTypeRGBMask method is some loop. Inside this loop is line:
psrc := mask.ScanLine[yb]+minx;

Then psrc is send as param in ClearTypeDrawPixel (line 430) where Cb param (psrc^.blue) is 255. All other colors are 0.

So problem could be inside mask.ScanLine ?
« Last Edit: June 01, 2012, 08:27:34 pm by Dibo »

circular

  • Hero Member
  • *****
  • Posts: 3048
    • Personal webpage
Re: Yellow background with FontAntialias
« Reply #20 on: June 01, 2012, 11:45:11 pm »
No, ScanLine only returns the address of the data. It seems that the bitmap really contains blue pixels. So BGRAFillClearTypeRGBMask is maybe ok, and the problem would appear in BGRATextOut and BGRATextRect. In some mysterious way, the bitmap gets a blue background. Maybe a problem of image format, because there is an implicit conversion between TBitmap and BGRABitmap data. But why this problem would appear with ClearType only, I don't understand.
Conscience is the debugger of the mind