use of java.awt.image.BufferedImage in project javatari by ppeccin.
the class SwingHelper method asCompatibleImage.
public static BufferedImage asCompatibleImage(Image img) {
BufferedImage ret = defaultScreenDeviceConfiguration().createCompatibleImage(img.getWidth(null), img.getHeight(null));
Graphics2D gc = ret.createGraphics();
gc.drawImage(img, 0, 0, null);
gc.dispose();
return ret;
}
use of java.awt.image.BufferedImage in project javatari by ppeccin.
the class SwingHelper method asCompatibleImage.
public static BufferedImage asCompatibleImage(Image img, int transparency) {
BufferedImage ret = defaultScreenDeviceConfiguration().createCompatibleImage(img.getWidth(null), img.getHeight(null), transparency);
Graphics2D gc = ret.createGraphics();
gc.setComposite(AlphaComposite.Src);
gc.drawImage(img, 0, 0, null);
gc.dispose();
return ret;
}
use of java.awt.image.BufferedImage in project jforum2 by rafaelsteil.
the class Captcha method writeCaptchaImage.
public void writeCaptchaImage() {
BufferedImage image = SessionFacade.getUserSession().getCaptchaImage();
if (image == null) {
return;
}
OutputStream outputStream = null;
try {
outputStream = JForumExecutionContext.getResponse().getOutputStream();
ImageIO.write(image, "jpg", outputStream);
} catch (IOException ex) {
logger.error(ex);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException ex) {
}
}
}
}
use of java.awt.image.BufferedImage in project jforum2 by rafaelsteil.
the class AttachmentCommon method createSaveThumb.
private void createSaveThumb(String path) {
try {
BufferedImage image = ImageUtils.resizeImage(path, ImageUtils.IMAGE_JPEG, SystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_IMAGES_MAX_THUMB_W), SystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_IMAGES_MAX_THUMB_H));
ImageUtils.saveImage(image, path + "_thumb", ImageUtils.IMAGE_JPEG);
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
use of java.awt.image.BufferedImage 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);
}
Aggregations