/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 6299168 6399660 6519600
* @summary Test verifies that the subsampling usage does not causes color
* changes.
* @run main BMPSubsamplingTest
* @author andrew.brygin
*/
public class BMPSubsamplingTest {
private int[] img_types = new int[] {
};
int h = 300;
continue;
}
// exclude BI_JPEG from automatic test
// due to color diffusion effect on the borders.
continue;
}
} else {
continue;
}
0, 0);
types[i] + ".bmp");
}
}
}
return imageWriteParam;
}
{
(rawType == TYPE_USHORT_565_BGR)))
{
return false;
}
// only 4bpp images can be encoded as BI_RLE4
return false;
}
// only 8bpp images can be encoded as BI_RLE8
return false;
}
((rawType == TYPE_USHORT_555_GRB) ||
(rawType == TYPE_USHORT_555_BGR)))
{
return false;
}
return true;
}
switch(t) {
case BufferedImage.TYPE_INT_RGB:
return "TYPE_INT_RGB";
case BufferedImage.TYPE_INT_BGR:
return "TYPE_INT_BGR";
case TYPE_INT_GRB:
return "TYPE_INT_GRB";
case TYPE_INT_GBR:
return "TYPE_INT_GBR";
case TYPE_INT_RBG:
return "TYPE_INT_RBG";
case TYPE_INT_BRG:
return "TYPE_INT_BRG";
return "TYPE_USHORT_555_RGB";
return "TYPE_USHORT_565_RGB";
case TYPE_USHORT_555_GRB:
return "TYPE_USHORT_555_GRB";
case TYPE_USHORT_555_BGR:
return "TYPE_USHORT_555_BGR";
case TYPE_USHORT_565_BGR:
return "TYPE_USHORT_565_BGR";
case BufferedImage.TYPE_3BYTE_BGR:
return "TYPE_3BYTE_BGR";
case TYPE_3BYTE_RGB:
return "TYPE_3BYTE_RGB";
case TYPE_3BYTE_GRB:
return "TYPE_3BYTE_GRB";
return "TYPE_BYTE_INDEXED";
case TYPE_4BPP_INDEXED:
return "TYPE_BYTE_INDEXED (4bpp)";
default:
throw new IllegalArgumentException("Unknown image type: " + t);
}
}
switch(type) {
case TYPE_INT_GRB:
0x0000ff00,
0x00ff0000,
0x000000ff);
break;
case TYPE_INT_GBR:
0x000000ff,
0x00ff0000,
0x0000ff00);
break;
case TYPE_INT_RBG:
0x00ff0000,
0x000000ff,
0x0000ff00);
break;
case TYPE_INT_BRG:
0x0000ff00,
0x000000ff,
0x00ff0000);
break;
case TYPE_3BYTE_RGB:
new int[] {0, 1, 2});
break;
case TYPE_3BYTE_GRB:
new int[] {1, 0, 2});
break;
case TYPE_USHORT_555_GRB:
0x03E0,
0x7C00,
0x001F);
break;
case TYPE_USHORT_555_BGR:
0x001F,
0x03E0,
0x7C00);
break;
case TYPE_USHORT_565_BGR:
0x001F,
0x07E0,
0xf800);
break;
case TYPE_4BPP_INDEXED:
break;
default:
}
}
}
g.dispose();
return dst;
}
// calculate palette size
// prepare palette;
byte[] r = new byte[psize];
byte[] g = new byte[psize];
byte[] b = new byte[psize];
}
// now prepare appropriate index clor model
}
false, false,
w, h,
w*3, 3,
}
// NB: do not forget about subsampling factor.
int y = h / (2 * srcYSubsampling);
throw new RuntimeException("Test failed due to wrong dst color " +
}
x += dx / srcXSubsampling;
}
}
}
}