20 package net.sf.gridarta.model.face;
22 import java.awt.image.RGBImageFilter;
23 import org.jetbrains.annotations.NotNull;
94 public int filterRGB(
final int x,
final int y,
final int rgb) {
96 final float r = (float) (rgb >> RED_SHIFT & 0xFF);
97 final float g = (float) (rgb >> GREEN_SHIFT & 0xFF);
98 final float b = (float) (rgb >> BLUE_SHIFT & 0xFF);
99 int gray1 = (int) (0.66F * r + 0.66F * g + 0.66F * b);
100 int gray2 = gray1 - 256;
113 gray1 = gray1 << BLUE_SHIFT | gray1 << GREEN_SHIFT | gray1 <<
RED_SHIFT;
114 gray2 = gray2 << BLUE_SHIFT | gray2 << GREEN_SHIFT | gray2 <<
RED_SHIFT;
116 return alpha | gray1 & positiveMask | gray2 &
negativeMask;
122 return super.clone();
static final int BLUE_SHIFT
The bit-offset for the blue bits.
static final int GREEN_SHIFT
The bit-offset for the green bits.
int filterRGB(final int x, final int y, final int rgb)
Converts a pixel by applying an or operation.
final int positiveMask
The positive mask to apply.
ColourFilter(final int mask)
Create an ColourFilter.
static final int RED_GREEN_BLUE_MASK
The mask for selecting the red, green, and blue bits.
static final int GREEN_MASK
The mask for selecting the green bits.
final int negativeMask
The negative mask to apply.
static final int RED_MASK
The mask for selecting the red bits.
static final int ALPHA_MASK
The mask for selecting the alpha bits.
Class to filter images by simply applying a boolean OR operation.
static final int RED_SHIFT
The bit-offset for the red bits.
static final int BLUE_MASK
The mask for selecting the blue bits.