 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
June Shi Guest
|
Posted: Wed Sep 20, 2006 8:11 am Post subject: how to set text's outline? |
|
|
Hi everyone,
I want to set text's outline.
First, i use BeginPath\EndPath\StrokeAndFillPath, it works well in big
font size and Bold.
procedure TForm1.Button1Click(Sender: TObject);
begin
BeginPath(Canvas.Handle);
SetBkMode(Canvas.Handle,TRANSPARENT);
Canvas.Font.Size:=12;
Canvas.Font.Name:='Arial';
Canvas.TextOut(50,50,'Hello World!');
EndPath(Canvas.Handle);
Canvas.Brush.Color:=clRed;
Canvas.Pen.Color:=clBlue;
StrokeAndFillPath(Canvas.Handle);
end;
But under my needs, it not use Big font and Bold style. my font size must
be 12.
How to do it perfect? how to improve? please help me. thanks all.
Sincerely,
June Shi |
|
| Back to top |
|
 |
Peter Below (TeamB) Guest
|
Posted: Wed Sep 20, 2006 11:13 pm Post subject: Re: how to set text's outline? |
|
|
June Shi wrote:
| Quote: | Hi everyone,
I want to set text's outline.
First, i use BeginPath\EndPath\StrokeAndFillPath, it works well in
big font size and Bold.
procedure TForm1.Button1Click(Sender: TObject);
begin
BeginPath(Canvas.Handle);
SetBkMode(Canvas.Handle,TRANSPARENT);
Canvas.Font.Size:=12;
Canvas.Font.Name:='Arial';
Canvas.TextOut(50,50,'Hello World!');
EndPath(Canvas.Handle);
Canvas.Brush.Color:=clRed;
Canvas.Pen.Color:=clBlue;
StrokeAndFillPath(Canvas.Handle);
end;
But under my needs, it not use Big font and Bold style. my font size
must be 12.
How to do it perfect? how to improve? please help me. thanks all.
|
It would help if you told us what your actual problem is. In what way
is the output not meeting your need?
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be |
|
| Back to top |
|
 |
Herre de Jonge Guest
|
Posted: Thu Sep 21, 2006 8:11 am Post subject: Re: how to set text's outline? |
|
|
June Shi wrote:
| Quote: | You can try the code above, when you run it, the text's outlineand stroke
path is not very clear. how to improve it?
|
There is too much detail for an outline of 1 pixel. You probably
want to use something like GDI+ (or Graphics32? or ...) and draw
the outline using anti-aliasing.
Take care,
Herre |
|
| Back to top |
|
 |
June Shi Guest
|
Posted: Thu Sep 21, 2006 8:11 am Post subject: Re: how to set text's outline? |
|
|
You can try the code above, when you run it, the text's outlineand stroke
path is not very clear. how to improve it?
"Peter Below (TeamB)" <none>
??????:xn0ergde4wzhc000 (AT) newsgroups (DOT) borland.com...
| Quote: | June Shi wrote:
Hi everyone,
I want to set text's outline.
First, i use BeginPath\EndPath\StrokeAndFillPath, it works well in
big font size and Bold.
procedure TForm1.Button1Click(Sender: TObject);
begin
BeginPath(Canvas.Handle);
SetBkMode(Canvas.Handle,TRANSPARENT);
Canvas.Font.Size:=12;
Canvas.Font.Name:='Arial';
Canvas.TextOut(50,50,'Hello World!');
EndPath(Canvas.Handle);
Canvas.Brush.Color:=clRed;
Canvas.Pen.Color:=clBlue;
StrokeAndFillPath(Canvas.Handle);
end;
But under my needs, it not use Big font and Bold style. my font size
must be 12.
How to do it perfect? how to improve? please help me. thanks all.
It would help if you told us what your actual problem is. In what way
is the output not meeting your need?
--
Peter Below (TeamB)
Don't be a vampire (http://slash7.com/pages/vampires),
use the newsgroup archives :
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be |
|
|
| Back to top |
|
 |
June Shi Guest
|
Posted: Thu Sep 21, 2006 2:11 pm Post subject: Re: how to set text's outline? |
|
|
I use GDI, i set pen's width as 1, how to use pixel? could you tell me more
information about this?
"Herre de Jonge" <hdejonge (AT) ravelin (DOT) nl>
??????:451230eb$1 (AT) newsgroups (DOT) borland.com...
| Quote: | June Shi wrote:
You can try the code above, when you run it, the text's outlineand stroke
path is not very clear. how to improve it?
There is too much detail for an outline of 1 pixel. You probably
want to use something like GDI+ (or Graphics32? or ...) and draw
the outline using anti-aliasing.
Take care,
Herre |
|
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Thu Sep 21, 2006 4:58 pm Post subject: Re: how to set text's outline? |
|
|
GDI only works with a resolution of 1 pixel, not any sub-pixel accuracy, or
anti-aliasing. Therefore it looks horrible on outlined text for small font
sizes.
You can try GDI+ as mentioned, or Graphics32, or my new Pyro library. This
new library is really easy to use for things like text outlining, because
you can just set the Text.Stroke property instead of Text.Fill.
There's an example here, you can look at the source code of the main
program. Pyro costs Eur99 for the dcu and Eur449 for the source version.
http://www.simdesign.nl/forum/viewtopic.php?t=648
Link directly to the example zip:
http://www.simdesign.nl/download/shapedemo.zip
(see the demo-> add text menu for an example on outlined text)
If you want to stay with GDI as it is you can also consider drawing your
outlined text to a larger bitmap, then resampling (shrinking) the bitmap.
Kind regards,
Nils Haeck
www.simdesign.nl
"June Shi" <june.shi (AT) yahoo (DOT) com> schreef in bericht
news:4512573e (AT) newsgroups (DOT) borland.com...
| Quote: | I use GDI, i set pen's width as 1, how to use pixel? could you tell me more
information about this?
"Herre de Jonge" <hdejonge (AT) ravelin (DOT) nl
??????:451230eb$1 (AT) newsgroups (DOT) borland.com...
June Shi wrote:
You can try the code above, when you run it, the text's outlineand
stroke path is not very clear. how to improve it?
There is too much detail for an outline of 1 pixel. You probably
want to use something like GDI+ (or Graphics32? or ...) and draw
the outline using anti-aliasing.
Take care,
Herre
|
|
|
| Back to top |
|
 |
June Shi Guest
|
Posted: Fri Sep 22, 2006 1:09 pm Post subject: Re: how to set text's outline? |
|
|
thanks.
"Nils Haeck" <bla (AT) bla (DOT) com> 写入消息新闻:45127dad$1 (AT) newsgroups (DOT) borland.com...
| Quote: | GDI only works with a resolution of 1 pixel, not any sub-pixel accuracy,
or anti-aliasing. Therefore it looks horrible on outlined text for small
font sizes.
You can try GDI+ as mentioned, or Graphics32, or my new Pyro library. This
new library is really easy to use for things like text outlining, because
you can just set the Text.Stroke property instead of Text.Fill.
There's an example here, you can look at the source code of the main
program. Pyro costs Eur99 for the dcu and Eur449 for the source version.
http://www.simdesign.nl/forum/viewtopic.php?t=648
Link directly to the example zip:
http://www.simdesign.nl/download/shapedemo.zip
(see the demo-> add text menu for an example on outlined text)
If you want to stay with GDI as it is you can also consider drawing your
outlined text to a larger bitmap, then resampling (shrinking) the bitmap.
Kind regards,
Nils Haeck
www.simdesign.nl
"June Shi" <june.shi (AT) yahoo (DOT) com> schreef in bericht
news:4512573e (AT) newsgroups (DOT) borland.com...
I use GDI, i set pen's width as 1, how to use pixel? could you tell me
more information about this?
"Herre de Jonge" <hdejonge (AT) ravelin (DOT) nl
??????:451230eb$1 (AT) newsgroups (DOT) borland.com...
June Shi wrote:
You can try the code above, when you run it, the text's outlineand
stroke path is not very clear. how to improve it?
There is too much detail for an outline of 1 pixel. You probably
want to use something like GDI+ (or Graphics32? or ...) and draw
the outline using anti-aliasing.
Take care,
Herre
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|