home *** CD-ROM | disk | FTP | other *** search
- import java.awt.image.RGBImageFilter;
-
- class fprotatx extends RGBImageFilter {
- private int m_i;
- private int m_n;
- private int m_w;
- private int m_h;
- private int m_effect;
- private int m_alpha;
- private int m_rowsPerSlat;
- private int m_colsPerSlat;
- private int m_slatPosition;
- private int m_xc;
- private int m_yc;
- private int m_xl;
- private int m_xr;
- private int m_yt;
- private int m_yb;
- private int m_maxDist;
-
- public int filterRGB(int x, int y, int rgb) {
- int rgbVal = rgb & 16777215;
- int alpha;
- switch (this.m_effect) {
- case 0:
- alpha = -16777216;
- break;
- case 1:
- if (y % this.m_rowsPerSlat < this.m_slatPosition) {
- alpha = -16777216;
- } else {
- alpha = 0;
- }
- break;
- case 2:
- if (x % this.m_colsPerSlat < this.m_slatPosition) {
- alpha = -16777216;
- } else {
- alpha = 0;
- }
- break;
- case 3:
- alpha = this.m_alpha << 24;
- break;
- case 4:
- if (x > this.m_xl && x < this.m_xr && y > this.m_yt && y < this.m_yb) {
- alpha = 0;
- } else {
- alpha = -16777216;
- }
- break;
- case 5:
- if (x >= this.m_xl && x <= this.m_xr && y >= this.m_yt && y <= this.m_yb) {
- alpha = -16777216;
- } else {
- alpha = 0;
- }
- break;
- default:
- alpha = 0;
- }
-
- return alpha | rgbVal;
- }
-
- public fprotatx(int i, int n, int w, int h, int effect) {
- super.canFilterIndexColorModel = false;
- this.m_i = i;
- this.m_n = n;
- this.m_w = w;
- this.m_h = h;
- this.m_effect = effect;
- this.m_xc = this.m_w / 2;
- this.m_yc = this.m_h / 2;
- if (this.m_effect == 1) {
- this.m_rowsPerSlat = 16;
- this.m_slatPosition = (this.m_i + 1) * this.m_rowsPerSlat / this.m_n;
- }
-
- if (this.m_effect == 2) {
- this.m_colsPerSlat = 16;
- this.m_slatPosition = (this.m_i + 1) * this.m_colsPerSlat / this.m_n;
- }
-
- this.m_alpha = (this.m_i + 1) * 255 / this.m_n;
- if (this.m_effect == 4) {
- this.m_xl = (this.m_i + 1) * this.m_xc / this.m_n;
- this.m_yt = (this.m_i + 1) * this.m_yc / this.m_n;
- this.m_xr = this.m_w - this.m_xl;
- this.m_yb = this.m_h - this.m_yt;
- }
-
- if (this.m_effect == 5) {
- this.m_xl = (this.m_n - this.m_i - 1) * this.m_xc / this.m_n;
- this.m_yt = (this.m_n - this.m_i - 1) * this.m_yc / this.m_n;
- this.m_xr = this.m_w - this.m_xl;
- this.m_yb = this.m_h - this.m_yt;
- }
-
- }
- }
-