use of com.google.code.appengine.awt.image.BufferedImage in project activityinfo by bedatadriven.
the class ChartRendererJC method renderImage.
public BufferedImage renderImage(PivotChartReportElement element, boolean includeTitle, int width, int height, int dpi) {
try {
Chart chart = createChart(element, includeTitle, width, height, dpi);
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
chart.setGraphics2D(bufferedImage.createGraphics());
chart.render();
return bufferedImage;
} catch (IOException e) {
throw new ReportModelException(e, element);
} catch (ChartDataException e) {
throw new ReportModelException(e, element);
} catch (PropertyException e) {
throw new ReportModelException(e, element);
}
}
use of com.google.code.appengine.awt.image.BufferedImage in project activityinfo by bedatadriven.
the class ChartRendererJC method render.
public void render(PivotChartReportElement element, OutputStream os) throws IOException {
BufferedImage image = renderImage(element, true, 640, 480, 96);
ImageIO.write(image, "PNG", os);
}
use of com.google.code.appengine.awt.image.BufferedImage in project activityinfo by bedatadriven.
the class ImageMapRenderer method render.
public void render(MapReportElement element, OutputStream os) throws IOException {
BufferedImage image = new BufferedImage(element.getWidth(), element.getHeight(), ColorSpace.TYPE_RGB);
Graphics2D g2d = image.createGraphics();
render(element, g2d);
ImageIO.write(image, "PNG", os);
}
use of com.google.code.appengine.awt.image.BufferedImage in project activityinfo by bedatadriven.
the class ImageMapRenderer method getIconImage.
private BufferedImage getIconImage(String name) {
BufferedImage image = iconImages.get(name);
if (image == null) {
try {
image = ImageIO.read(getImageFile(name));
iconImages.put(name, image);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Exception reading icon '" + name + "'", e);
}
}
return image;
}
use of com.google.code.appengine.awt.image.BufferedImage in project activityinfo by bedatadriven.
the class GcsBlobFieldStorageServiceTest method thumbnail.
@Test
public void thumbnail() throws IOException {
int width = 30;
int height = 20;
Response response = blobService.getThumbnail(user, blobId, resourceId, width, height);
assertEquals(response.getStatus(), 200);
Object entity = response.getEntity();
String directory = "target/blob-test/thumbnail";
createDirectory(directory);
File imageFile = new File(directory + File.separator + FILE_NAME);
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream((byte[]) entity));
ImageIO.write(bufferedImage, MimeTypeUtil.fileExtension(FILE_NAME), imageFile);
System.out.println(imageFile.getAbsolutePath());
assertEquals(bufferedImage.getWidth(), width);
// we don't check height because image scales depending on width
// assertEquals(bufferedImage.getHeight(), height);
}
Aggregations