mh said it's ok. just a little cleanup...
authorrk <rk>
Wed, 23 Apr 2003 18:38:57 +0000 (18:38 +0000)
committerrk <rk>
Wed, 23 Apr 2003 18:38:57 +0000 (18:38 +0000)
jmagick/README [deleted file]
jmagick/WebdbImage.java.jmagick [deleted file]

diff --git a/jmagick/README b/jmagick/README
deleted file mode 100755 (executable)
index 0f1110f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-This directory contains an implementation of mir.misc.WedbImage that uses
-JMagick for image manipulation as an alternative to Sun's JAI ( Java 
-Advanced Imaging). JMagick is the java interface to good'ol ImageMagick.
-This code is for JMagick-5.33. You need to dowload JMagick from the ImageMagick
-site.
-
-There are no plans to replace the JAI implementation with this. JAI is better
-maintained (the last JMagick release was November 2000) and is more powerful.
-
-You absolutely need to have the Jmagick shared library in your LD_LIBRARY_PATH
-var for it to work.
-
-The only advantage it has over JAI is that it is open source (AFAIK, the JAI
-source is not available, please correct me if I'm wrong). 
-
-Also, it provides a native implementation (the c shared library) for all 
-platforms as one has the source to compile it... However, my testing shows
-that the pure Java JAI is *faster* than the native JMagick/ImageMagick, at
-least on the PPC architecture (G3) tested against JAI 1.1.1.
-
--mh <heckmann@hbe.ca>
-2001.10.19
diff --git a/jmagick/WebdbImage.java.jmagick b/jmagick/WebdbImage.java.jmagick
deleted file mode 100755 (executable)
index 38c7d2d..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (C) 2001  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mir.misc;
-
-/**
- * Title:
- * Description:
- * Copyright:    Copyright (c) 2001
- * Company:      Indymedia
- * @author
- * @version 1.0
- */
-
-import java.io.*;
-//import java.awt.image.renderable.ParameterBlock;
-import java.awt.Dimension;
-import java.awt.Rectangle;
-import magick.*;
-
-public class WebdbImage
-{
-
-    private Logfile theLog = Logfile.getInstance(MirConfig.getPropWithHome("HTMLTemplateProcessor.Logfile"));
-       // imageTypes
-       public final static int        WEBDB_JPG=0;
-       public final static int        WEBDB_GIF=1;
-
-       // default values for scaling
-       private int               maxIconSize=120;
-       private int               maxImageSize=640;
-
-       private byte[]            iconData;
-       private byte[]            imageData;
-       private int               imageType;
-       private int               iconWidth;
-       private int               iconHeight;
-
-       // internal representation of the image
-       private MagickImage       magickImage;
-
-
-       // constructor
-       public WebdbImage(byte[] image, int type)
-               throws IOException
-       {
-               imageType=type;
-        try {
-            magickImage = new MagickImage(new ImageInfo(), image);
-        } catch (MagickException e) {theLog.printDebugInfo("fail: "+e.toString());}
-               scaleImage();
-       }
-
-       public WebdbImage(byte[] image, int type, int iconMax)
-               throws IOException
-       {
-               imageType=type;
-               maxIconSize=iconMax;
-        try {
-            magickImage = new MagickImage(new ImageInfo(), image);
-        } catch (MagickException e) {theLog.printDebugInfo("fail: "+e.toString());}
-               scaleImage();
-       }
-
-       public WebdbImage(byte[] image, int type, int iconMax, int imageMax)
-               throws IOException
-       {
-               imageType=type;
-               maxIconSize=iconMax;
-               maxImageSize=imageMax;
-        try {
-            magickImage = new MagickImage(new ImageInfo(), image);
-        } catch (MagickException e) {theLog.printDebugInfo("fail: "+e.toString());}
-               scaleImage();
-       }
-
-
-       // acc3ssor-methods
-       public int getIconWidth() throws IOException {
-               if (iconData==null) scaleIcon();
-               return iconWidth;
-       }
-
-       public int getIconHeight() throws IOException {
-               if (iconData==null) scaleIcon();
-               return iconHeight;
-       }
-
-       public int getImageWidth() {
-        try {
-            return (int)magickImage.getDimension().getWidth();
-        } catch (MagickException e) { return -1;}
-       }
-
-       public int getImageHeight() {
-        int gg;
-        try {
-                   return (int)magickImage.getDimension().getHeight();
-        } catch (MagickException e) { return -1;}
-       }
-
-       public byte[] getImage() {
-               if (imageData==null) {
-            try {
-                ImageInfo imageInfo = new ImageInfo();
-                imageInfo.init();
-
-                switch (imageType) {
-                    case WEBDB_JPG:
-                        imageInfo.setMagickMember("JPG");
-                    case WEBDB_GIF:
-                        imageInfo.setMagickMember("JPG");
-                }
-
-                imageData = magickImage.imageToBlob(imageInfo);
-            } catch (MagickException e) {
-                theLog.printDebugInfo("getImage: magick "+e.toString());
-            }
-        }
-        return imageData;
-       }
-
-       public byte[] getIcon()
-               throws IOException
-       {
-               if (iconData == null) scaleIcon();
-               return iconData;
-       }
-
-       private void scaleImage()
-               throws java.io.IOException
-       {
-               if (maxImageSize>0 && ( getImageHeight()> maxImageSize|| getImageWidth() >maxImageSize))
-               {
-                       float scale;
-                       if (getImageHeight() > getImageWidth())
-                               scale = (float)maxImageSize / (float)getImageHeight();
-                       else
-                               scale = (float)maxImageSize / (float)getImageWidth();
-
-            try {
-                           magickImage = magickImage.scaleImage((int)scale*getImageWidth(), (int)scale*getImageHeight());
-            } catch (MagickException e) {}
-               }
-       }
-
-       private void scaleIcon()
-               throws java.io.IOException
-       {
-               if (iconData==null) {
-                       float scale;
-                       if (getImageHeight() > getImageWidth())
-                               scale = (float)maxIconSize / (float)getImageHeight();
-                       else
-                               scale = (float)maxIconSize / (float)getImageWidth();
-
-            try {
-                           MagickImage temp = magickImage.scaleImage((int)(scale*getImageWidth()), (int)(scale*getImageHeight()));
-                ImageInfo imageInfo = new ImageInfo();
-                imageInfo.init();
-                /** @todo gif */
-                switch (imageType) {
-                    case WEBDB_JPG:
-                        imageInfo.setMagickMember("JPG");
-                    case WEBDB_GIF:
-                        imageInfo.setMagickMember("JPG");
-                }
-                iconWidth=(int)temp.getDimension().getWidth();
-                iconHeight=(int)temp.getDimension().getHeight();
-                // Put a black rectangle around the border
-                DrawInfo drawInfo = new DrawInfo(imageInfo);
-                drawInfo.setPrimitive("Rectangle 0 0 "+(iconWidth-1)+" "+(iconHeight-1));
-                drawInfo.setStroke(PixelPacket.queryColorDatabase("black"));
-                temp.drawImage(drawInfo);
-                iconData = temp.imageToBlob(imageInfo);
-            } catch (MagickException e) {}
-               }
-       }
-
-}