< prev index next >
src/java.desktop/share/classes/java/awt/image/RGBImageFilter.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 144,157 ****
* @exception NullPointerException if {@code icm} is null
* @return a new IndexColorModel representing the filtered colors
*/
public IndexColorModel filterIndexColorModel(IndexColorModel icm) {
int mapsize = icm.getMapSize();
! byte r[] = new byte[mapsize];
! byte g[] = new byte[mapsize];
! byte b[] = new byte[mapsize];
! byte a[] = new byte[mapsize];
icm.getReds(r);
icm.getGreens(g);
icm.getBlues(b);
icm.getAlphas(a);
int trans = icm.getTransparentPixel();
--- 144,157 ----
* @exception NullPointerException if {@code icm} is null
* @return a new IndexColorModel representing the filtered colors
*/
public IndexColorModel filterIndexColorModel(IndexColorModel icm) {
int mapsize = icm.getMapSize();
! byte[] r = new byte[mapsize];
! byte[] g = new byte[mapsize];
! byte[] b = new byte[mapsize];
! byte[] a = new byte[mapsize];
icm.getReds(r);
icm.getGreens(g);
icm.getBlues(b);
icm.getAlphas(a);
int trans = icm.getTransparentPixel();
*** 190,200 ****
* in the array
* @see ColorModel#getRGBdefault
* @see #filterRGB
*/
public void filterRGBPixels(int x, int y, int w, int h,
! int pixels[], int off, int scansize) {
int index = off;
for (int cy = 0; cy < h; cy++) {
for (int cx = 0; cx < w; cx++) {
pixels[index] = filterRGB(x + cx, y + cy, pixels[index]);
index++;
--- 190,200 ----
* in the array
* @see ColorModel#getRGBdefault
* @see #filterRGB
*/
public void filterRGBPixels(int x, int y, int w, int h,
! int[] pixels, int off, int scansize) {
int index = off;
for (int cy = 0; cy < h; cy++) {
for (int cx = 0; cx < w; cx++) {
pixels[index] = filterRGB(x + cx, y + cy, pixels[index]);
index++;
*** 220,235 ****
* with the filtering operation.
* @see ColorModel#getRGBdefault
* @see #filterRGBPixels
*/
public void setPixels(int x, int y, int w, int h,
! ColorModel model, byte pixels[], int off,
int scansize) {
if (model == origmodel) {
consumer.setPixels(x, y, w, h, newmodel, pixels, off, scansize);
} else {
! int filteredpixels[] = new int[w];
int index = off;
for (int cy = 0; cy < h; cy++) {
for (int cx = 0; cx < w; cx++) {
filteredpixels[cx] = model.getRGB((pixels[index] & 0xff));
index++;
--- 220,235 ----
* with the filtering operation.
* @see ColorModel#getRGBdefault
* @see #filterRGBPixels
*/
public void setPixels(int x, int y, int w, int h,
! ColorModel model, byte[] pixels, int off,
int scansize) {
if (model == origmodel) {
consumer.setPixels(x, y, w, h, newmodel, pixels, off, scansize);
} else {
! int[] filteredpixels = new int[w];
int index = off;
for (int cy = 0; cy < h; cy++) {
for (int cx = 0; cx < w; cx++) {
filteredpixels[cx] = model.getRGB((pixels[index] & 0xff));
index++;
*** 257,272 ****
* with the filtering operation.
* @see ColorModel#getRGBdefault
* @see #filterRGBPixels
*/
public void setPixels(int x, int y, int w, int h,
! ColorModel model, int pixels[], int off,
int scansize) {
if (model == origmodel) {
consumer.setPixels(x, y, w, h, newmodel, pixels, off, scansize);
} else {
! int filteredpixels[] = new int[w];
int index = off;
for (int cy = 0; cy < h; cy++) {
for (int cx = 0; cx < w; cx++) {
filteredpixels[cx] = model.getRGB(pixels[index]);
index++;
--- 257,272 ----
* with the filtering operation.
* @see ColorModel#getRGBdefault
* @see #filterRGBPixels
*/
public void setPixels(int x, int y, int w, int h,
! ColorModel model, int[] pixels, int off,
int scansize) {
if (model == origmodel) {
consumer.setPixels(x, y, w, h, newmodel, pixels, off, scansize);
} else {
! int[] filteredpixels = new int[w];
int index = off;
for (int cy = 0; cy < h; cy++) {
for (int cx = 0; cx < w; cx++) {
filteredpixels[cx] = model.getRGB(pixels[index]);
index++;
< prev index next >