mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
removed unused classes
This commit is contained in:
parent
cdd5c3f2d3
commit
b5e4d9e795
3 changed files with 0 additions and 152 deletions
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue