Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-04

Clear font backgrounds

6 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dave Coventry

Hi,

I'm using Image1.Convas.TextOut and I need the font background to be clear.

Does anyone know how to achieve this?

Thanks,

Dave Coventry

Reply by email

Martin Friebe
to Dave Coventry
Dave Coventry wrote 6 lines
Hi, I'm using Image1.Convas.TextOut and I need the font background to be clear. Does anyone know how to achieve this?
uses LCLType, LCLIntf;
  SetBkMode(Image1.Canvas.Handle,  TRANSPARENT);

You may have to use LCLIntf.ExtTextOut()

Best Regards
Martin

Reply by email

Dave Coventry
to Martin Friebe

Hi Martin, Thanks for the response.

2009/4/13 Martin Friebe :

uses LCLType, LCLIntf; ?SetBkMode(Image1.Canvas.Handle, ?TRANSPARENT);

Yes, I do seem to have these functions.

You may have to use ?LCLIntf.ExtTextOut()

I'm not sure I understand.

Do you mean Image1.Canvas.LCLIntf.ExtTextOut()?

Reply by email

Martin Friebe
to Dave Coventry
Dave Coventry wrote 21 lines
Hi Martin, Thanks for the response. 2009/4/13 Martin Friebe : > uses LCLType, LCLIntf; > > SetBkMode(Image1.Canvas.Handle, TRANSPARENT); > Yes, I do seem to have these functions. > You may have to use LCLIntf.ExtTextOut() > I'm not sure I understand. Do you mean Image1.Canvas.LCLIntf.ExtTextOut()?

Nope,

After "SetBKMode" try to output text as usual, eg with: "Image1.Canvas.TextOut()". (or whatever it is, I don't recall exactly)

This may already work, I haven't tried it....

What I have used is:

  dc := Canvas.Handle;
  SetBkMode(dc,  TRANSPARENT);
  LCLIntf.ExtUTF8Out(dc, X, Y, 0, @ARect, Text, Length, nil);

ARect is a TRect thats specifies where the text goes. Unless you use clipping, only the top edge matters (since the background is transparent too)

Example can be found in SynEdit: components\synedit\syntextdrawer.pp line 1175 (the line refers to the SVN version; use search otherwise); the BKMode is set in synedits main unit.

Martin

Reply by email

Dave Coventry
to Martin Friebe

2009/4/13 Martin Friebe :

After "SetBKMode" try to output text as usual, eg with: "Image1.Canvas.TextOut()". ?(or whatever it is, I don't recall exactly) This may already work, I haven't tried it....

No, it doesn't, I'm afraid.

Show quoted text 13 lines
What I have used is: ?dc := Canvas.Handle; ?SetBkMode(dc, ?TRANSPARENT); ?LCLIntf.ExtUTF8Out(dc, X, Y, 0, @ARect, Text, Length, nil); ARect is a TRect thats specifies where the text goes. Unless you use clipping, only the top edge matters (since the background is transparent too) Example can be found in SynEdit: ?components\synedit\syntextdrawer.pp line 1175 (the line refers to the SVN version; use search otherwise); the BKMode is set in synedits main unit.

I've found an easier way:

Set Image1.Canvas.Bruch.Style:=bsClear.

Works fine.

Reply by email

Dave Coventry
to Martin Friebe: After "SetBKMode" try to output text as usual, eg with: "Image1.Canvas.TextOut()". (or…

2009/4/13 Martin Friebe :

After "SetBKMode" try to output text as usual, eg with: "Image1.Canvas.TextOut()". ?(or whatever it is, I don't recall exactly) This may already work, I haven't tried it....

No, it doesn't, I'm afraid.

Show quoted text 13 lines
What I have used is: ?dc := Canvas.Handle; ?SetBkMode(dc, ?TRANSPARENT); ?LCLIntf.ExtUTF8Out(dc, X, Y, 0, @ARect, Text, Length, nil); ARect is a TRect thats specifies where the text goes. Unless you use clipping, only the top edge matters (since the background is transparent too) Example can be found in SynEdit: ?components\synedit\syntextdrawer.pp line 1175 (the line refers to the SVN version; use search otherwise); the BKMode is set in synedits main unit.

I've found an easier way:

Set Image1.Canvas.Bruch.Style:=bsClear.

Works fine.

Reply by email