I need to cut out an image in the shape of the text in another image. I think it\'s best shown in images.
This is a photo of a cat:
Use GlyphVector
. Use Font
class
public GlyphVector layoutGlyphVector(FontRenderContext frc,
char[] text,
int start,
int limit,
int flags) {
You can get outline Shape
from glyph vector by public abstract Shape getOutline()
Assign the outline Shape
as a clip to your Graphics
instance.
Draw the image on the graphics.
Only clipped shape will be filled.