Search in sources :

Example 1 with ImageGraphicAttribute

use of java.awt.font.ImageGraphicAttribute in project hid-serial by rayshobby.

the class StyledString method getParagraghSpacer.

/**
	 * Create a graphic image character to simulate paragraph breaks
	 * 
	 * @param ww
	 * @return a blank image to manage paragraph ends.
	 */
private ImageGraphicAttribute getParagraghSpacer(int ww) {
    if (ww == Integer.MAX_VALUE)
        ww = 1;
    BufferedImage img = new BufferedImage(ww, 10, BufferedImage.TYPE_INT_ARGB);
    Graphics g = img.getGraphics();
    g.setColor(new Color(255, 255, 255, 0));
    g.fillRect(0, 0, img.getWidth(), img.getHeight());
    return new ImageGraphicAttribute(img, GraphicAttribute.TOP_ALIGNMENT);
}
Also used : Graphics(java.awt.Graphics) ImageGraphicAttribute(java.awt.font.ImageGraphicAttribute) Color(java.awt.Color) BufferedImage(java.awt.image.BufferedImage)

Aggregations

Color (java.awt.Color)1 Graphics (java.awt.Graphics)1 ImageGraphicAttribute (java.awt.font.ImageGraphicAttribute)1 BufferedImage (java.awt.image.BufferedImage)1