Some characters are paint in an image and I wonder how to judge if a specified pixel
falls into those characters.
I use checkPoint to judge if a point(x,y) in the character. And the source code are
given below. But I try many points, all of them are not in the characters. Why?
public Shape getFontShape(char ch)
{
font = new Font("SansSerif", Font.PLAIN, 9);
FontRenderContext frc = new FontRenderContext(null, true, true);
GlyphVector gv = font.createGlyphVector(frc, ch+"");
return gv.getGlyphOutline(0);
}
public boolean checkPoint(double x, double y, char ch)
{
Shape sh = getFontShape(ch);
return sh.contains(x,y);
}
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".