From b5e4d9e7958c7914d96bd26be5589eaac5a4218d Mon Sep 17 00:00:00 2001 From: North Date: Sat, 2 Mar 2013 15:50:39 +0200 Subject: [PATCH] removed unused classes --- .../src/mage/filters/FilterFactory.java | 15 ---- Mage.Common/src/mage/filters/PointFilter.java | 69 ------------------- .../src/mage/filters/impl/HueFilter.java | 68 ------------------ 3 files changed, 152 deletions(-) delete mode 100644 Mage.Common/src/mage/filters/FilterFactory.java delete mode 100644 Mage.Common/src/mage/filters/PointFilter.java delete mode 100644 Mage.Common/src/mage/filters/impl/HueFilter.java diff --git a/Mage.Common/src/mage/filters/FilterFactory.java b/Mage.Common/src/mage/filters/FilterFactory.java deleted file mode 100644 index a0d71d9c625..00000000000 --- a/Mage.Common/src/mage/filters/FilterFactory.java +++ /dev/null @@ -1,15 +0,0 @@ -package mage.filters; - -import mage.filters.impl.HueFilter; - -/** - * Creates filter instances. - * - * @author nantuko - */ -public class FilterFactory { - - public static HueFilter getHueFilter() { - return new HueFilter(); - } -} diff --git a/Mage.Common/src/mage/filters/PointFilter.java b/Mage.Common/src/mage/filters/PointFilter.java deleted file mode 100644 index f1aeb8f3a1e..00000000000 --- a/Mage.Common/src/mage/filters/PointFilter.java +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 2006 Jerry Huxtable - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mage.filters; - -import java.awt.image.BufferedImage; -import java.awt.image.WritableRaster; - -/** - * An abstract super class for filters that work with points. - * Takes into account image type to avoid performance issue with getRGB and setRGB methods of BufferedImage. - * - * @author nantuko - */ -public abstract class PointFilter extends MageBufferedImageOp { - - protected boolean canFilterIndexColorModel = false; - - public BufferedImage filter(BufferedImage src, BufferedImage dst) { - int width = src.getWidth(); - int height = src.getHeight(); - int type = src.getType(); - WritableRaster srcRaster = src.getRaster(); - - if (dst == null) { - dst = createCompatibleDestImage(src, null); - } - WritableRaster dstRaster = dst.getRaster(); - - setDimensions(width, height); - - int[] inPixels = new int[width]; - for (int y = 0; y < height; y++) { - if (type == BufferedImage.TYPE_INT_ARGB || type == BufferedImage.TYPE_INT_RGB) { - srcRaster.getDataElements(0, y, width, 1, inPixels); - for (int x = 0; x < width; x++) { - inPixels[x] = filterRGB(x, y, inPixels[x]); - } - dstRaster.setDataElements(0, y, width, 1, inPixels); - } else { - src.getRGB(0, y, width, 1, inPixels, 0, width); - for (int x = 0; x < width; x++) { - inPixels[x] = filterRGB(x, y, inPixels[x]); - } - dst.setRGB(0, y, width, 1, inPixels, 0, width); - } - } - - return dst; - } - - public void setDimensions(int width, int height) { - } - - public abstract int filterRGB(int x, int y, int rgb); -} diff --git a/Mage.Common/src/mage/filters/impl/HueFilter.java b/Mage.Common/src/mage/filters/impl/HueFilter.java deleted file mode 100644 index 7cb2d0c387f..00000000000 --- a/Mage.Common/src/mage/filters/impl/HueFilter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2006 Jerry Huxtable - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package mage.filters.impl; - -import mage.filters.PointFilter; - -import java.awt.*; - -/** - * Point filter that changes hue of the image. - * - * @author nantuko - */ -public class HueFilter extends PointFilter { - - public float hue; - private float[] hsb = new float[3]; - - public HueFilter() { - this(0); - } - - public HueFilter(float hue) { - this.hue = hue; - canFilterIndexColorModel = true; - } - - public void setHue(float hue) { - this.hue = hue; - } - - public float getHue() { - return hue; - } - - public int filterRGB(int x, int y, int rgb) { - int a = rgb & 0xff000000; - int r = (rgb >> 16) & 0xff; - int g = (rgb >> 8) & 0xff; - int b = rgb & 0xff; - Color.RGBtoHSB(r, g, b, hsb); - hsb[0] += hue; - while (hsb[0] < 0) { - hsb[0] += Math.PI*2; - } - rgb = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]); - return a | (rgb & 0xffffff); - } - - public String toString() { - return "Change HUE filter"; - } -} -