[jboss-user] [JBoss Seam] - Re: Hypersonic Database Explorer no longer runs up.
tony.herstell@gmail.com
do-not-reply at jboss.com
Tue Mar 20 18:55:50 EDT 2007
Thats what I thought..
Works fine if my Seam app is not in the deploy area.
I am using IceFaces... would that intercept anything?
humm...
I am causing havok with some graphix engine in Java actually using some code that does some image re-scaling... (getting quite a few exceptions after my image is rescaled but ignored them as seemed to have no bad effects)
I will run up, but not execute, my .ear and if confirmed will find a Java 2D expert to check my image rescaling code out.
So... Probably my code...
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| private byte[] getRescaledImageAsBytes(String contentType , int width, ImageIcon icon) {
| double ratio = (double) width / icon.getIconWidth();
| int height = (int) (icon.getIconHeight() * ratio);
|
| int imageType = "image/png".equals(contentType) ? BufferedImage.TYPE_INT_ARGB
| : BufferedImage.TYPE_INT_RGB;
| BufferedImage bImg = new BufferedImage(width, height, imageType);
| Graphics2D g2d = bImg.createGraphics();
| g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
| RenderingHints.VALUE_INTERPOLATION_BICUBIC);
| g2d.drawImage(icon.getImage(), 0, 0, width, height, null);
| g2d.dispose();
|
| String formatName = "";
| if ("image/png".equalsIgnoreCase(contentType))
| formatName = "png";
| else if ("image/jpeg".equalsIgnoreCase(contentType))
| formatName = "jpeg";
| else if ("image/jpg".equalsIgnoreCase(contentType))
| formatName = "jpg";
| else if ("image/gif".equalsIgnoreCase(contentType))
| formatName = "gif";
|
| ByteArrayOutputStream baos = null;
| OutputStream out = null;
| try {
| baos = new ByteArrayOutputStream();
| out = new BufferedOutputStream(baos);
| try {
| ImageIO.write(bImg, formatName, out);
| } catch (IOException e) {
| e.printStackTrace();
| }
| } finally { // Try to release any resources.
| try {
| if (baos != null) {
| baos.close();
| }
| } catch (IOException ignored) {}
| try {
| if (out != null) {
| out.close();
| }
| } catch (IOException ignored) {}
| }
| return baos.toByteArray();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030037#4030037
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030037
More information about the jboss-user
mailing list