filling glyphs

E

emilio

Hi everyone, do you know what is the best algorithm to fill object which
contour consists of lines and bezier curves. I use the flood fill
algorithm based on Smith, but it does not work with small letters
because in places where there is a narrow passage it stop.Of course, I
tried to start filling in a few places but still remain unfilled place.
Maybe you know some other algorithms that work with these types of
objects. How it is done eg in Corel?
 
J

John B. Matthews

emilio said:
Hi everyone, do you know what is the best algorithm to fill object
which contour consists of lines and bezier curves. I use the flood
fill algorithm based on Smith, but it does not work with small
letters because in places where there is a narrow passage it stop.Of
course, I tried to start filling in a few places but still remain
unfilled place. Maybe you know some other algorithms that work with
these types of objects. How it is done eg in Corel?

Have you looked into GlyphVector [1]. The getOutline() method returns a
Shape suitable for Graphics2D's fill() method. For smaller sizes, I
usually rely on TextLayout [2], as the associated FontRenderContext can
handle (possibly platform-dependent) anti-aliasing and fractional
metrics.

[1]<http://download.oracle.com/javase/6/docs/api/java/awt/font/GlyphVector.html>
[2]<http://download.oracle.com/javase/6/docs/api/java/awt/font/TextLayout.html>
 
E

emilio

W dniu 2011-02-03 22:12, John B. Matthews pisze:
emilio said:
Hi everyone, do you know what is the best algorithm to fill object
which contour consists of lines and bezier curves. I use the flood
fill algorithm based on Smith, but it does not work with small
letters because in places where there is a narrow passage it stop.Of
course, I tried to start filling in a few places but still remain
unfilled place. Maybe you know some other algorithms that work with
these types of objects. How it is done eg in Corel?

Have you looked into GlyphVector [1]. The getOutline() method returns a
Shape suitable for Graphics2D's fill() method. For smaller sizes, I
usually rely on TextLayout [2], as the associated FontRenderContext can
handle (possibly platform-dependent) anti-aliasing and fractional
metrics.

[1]<http://download.oracle.com/javase/6/docs/api/java/awt/font/GlyphVector.html>
[2]<http://download.oracle.com/javase/6/docs/api/java/awt/font/TextLayout.html>

I know how to do this in Graphics2D - create GeneralPath and when is
line make lineTo(x,y) and when is bezier curve make quadTo(x1,y1,x2,y2).
After draw(GeneralPath) and fill(GeneralPath). But I can't use it
because I need to do this in Graphics. I writing flash player for device
that haven't all java packages. There is only Graphics - doesn't have
Graphics2D. Sorry for my english but i hope You know what I mean.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top