public byte[] getImage() {
if (imageData==null) {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-
- switch (imageType) {
- case WEBDB_JPG:
- JAI.create("encode", planarImage, outStream, "JPEG", null);break;
- case WEBDB_GIF:
- JAI.create("encode", planarImage, outStream, "JPEG", null);break;
- default:
- System.err.println("unknown image format: " + imageType);
- }
-
+ // @todo the choice of PNG or JPEG should be made configurable
+ JAI.create("encode", planarImage, outStream, "PNG", null);
imageData = outStream.toByteArray();
}
return imageData;
InterpolationBilinear interp = new InterpolationBilinear();
PlanarImage temp = JAI.create("scale", planarImage, scale, scale, 0.0F, 0.0F, interp);
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- /** @todo gif */
- switch (imageType) {
- case WEBDB_JPG:
- JAI.create("encode", temp, outStream, "JPEG", null);break;
- case WEBDB_GIF:
- JAI.create("encode", temp, outStream, "JPEG", null);break;
- default:
- System.err.println("unknown image format: " + imageType);
- }
+ // @todo the choice of PNG or JPEG should be made configurable
+ JAI.create("encode", temp, outStream, "PNG", null);
iconData = outStream.toByteArray();
iconWidth=temp.getWidth();
iconHeight=temp.getHeight();