Forum > BGRABitmap and LazPaint

ClearType in CanvasBGRA

(1/2) > >>

lainz:
ClearType is supported in CanvasBGRA?

See the attached shot, the top text is TBGRABitmap.CanvasBGRA.TextOut (with Font.Height := 0), the other is TBGRABitmap.Canvas.TextOut.

There is a way to 'enable' ClearType in CanvasBGRA TextOut / TextRect?

circular:
I don't think there is an easy way to implement this, except by redirecting TextOut and TextRect calls to Canvas. But this would slow down the process. It may be needed to rebuild the TBitmap object for each call to TextOut. An other way would be to implement ClearType algorithm in BGRABitmap library.

circular:
Hello Lainz, i've added cleartype support on subversion. Can you try it ?

lainz:

--- Code: ---  Bitmap.Fill(BGRAPixelTransparent);
  Bitmap.CanvasBGRA.Font.Quality := fqFineClearTypeRGB;
  Bitmap.CanvasBGRA.Font.Height := 30;
  Bitmap.CanvasBGRA.TextOut(100, 100, Caption);
  Bitmap.Draw(Canvas, 0, 0, False); 
--- End code ---

ClearType is applied but I get some 'gray' in the borders.

circular:
This has something to do with transparency. In fact drawing with ClearType does not make sense on a transparent canvas. But this should be handled and draw normal antialiasing instead in this case.

The rectangles you see are font overhang, i.e, where text may go out of its box, for example with italic style.

I've made some filters in LazPaint to simulate ClearType. It's on subversion. So you can take an image or a screenshot that does not have ClearType and apply it, or the contrary, take a screenshot and remove ClearType effect afterwards.

Navigation

[0] Message Index

[#] Next page

Go to full version