return op.filter(image, null);
@Override public void paint(Graphics g) { if (g == null) throw new NullPointerException(); for (int x = 0; x < widthInCharacters; x++) { for (int y = 0; y < heightInCharacters; y++) { if (oldBackgroundColors[x][y] == backgroundColors[x][y] && oldForegroundColors[x][y] == foregroundColors[x][y] && oldChars[x][y] == chars[x][y]) continue; Color bg = backgroundColors[x][y]; Color fg = foregroundColors[x][y]; LookupOp op = setColors(bg, fg); BufferedImage img = op.filter(glyphs[chars[x][y]], null); offscreenGraphics.drawImage(img, x * charWidth, y * charHeight, null); oldBackgroundColors[x][y] = backgroundColors[x][y]; oldForegroundColors[x][y] = foregroundColors[x][y]; oldChars[x][y] = chars[x][y]; } } g.drawImage(offscreenBuffer,0,0,this); }
/** * For testing lookup tables */ public static Image toInverseVideo(Image source) { // BufferedImage src = new BufferedImage(source.getWidth(null), source .getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics g = src.getGraphics(); g.drawImage(source, 0, 0, null); // short[][] lookup = new short[4][256]; for (int c = 0; c < 4; c++) { for (short b = 0; b < 256; b++) { if (c == 3) lookup[c][b] = b; else lookup[c][b] = (short)(255 - b); } } LookupTable table = new ShortLookupTable(0, lookup); LookupOp op = new LookupOp (table, null); return op.filter(src, null); }
public WritableRaster copyData(WritableRaster wr){ CachableRed src = (CachableRed)getSources().get(0); wr = src.copyData(wr); GraphicsUtil.coerceData(wr, src.getColorModel(), false); WritableRaster srcWR = wr.createWritableTranslatedChild(0,0); operation.filter(srcWR, srcWR); return wr; } }
public WritableRaster copyData(WritableRaster wr){ CachableRed src = (CachableRed)getSources().get(0); wr = src.copyData(wr); GraphicsUtil.coerceData(wr, src.getColorModel(), false); WritableRaster srcWR = wr.createWritableTranslatedChild(0,0); operation.filter(srcWR, srcWR); return wr; } }
public WritableRaster copyData(WritableRaster wr){ CachableRed src = (CachableRed)getSources().get(0); wr = src.copyData(wr); GraphicsUtil.coerceData(wr, src.getColorModel(), false); WritableRaster srcWR = wr.createWritableTranslatedChild(0,0); operation.filter(srcWR, srcWR); return wr; } }
lop.filter(image, image);
theImage = lOp.filter(image, null);