/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
public class BufferedBufImgOps {
{
if (biop instanceof ConvolveOp) {
} else {
throw new InternalError("Unknown BufferedImageOp");
}
}
if (biop instanceof ConvolveOp) {
} else {
throw new InternalError("Unknown BufferedImageOp");
}
}
/**************************** ConvolveOp support ****************************/
// REMIND: we currently can only handle 3x3 and 5x5 kernels,
// but hopefully this is just a temporary restriction;
// see native shader comments for more details
return false;
}
return true;
}
{
// assert rq.lock.isHeldByCurrentThread();
boolean edgeZero =
int sizeofFloat = 4;
}
// assert rq.lock.isHeldByCurrentThread();
}
/**************************** RescaleOp support *****************************/
{
if (srcCM instanceof IndexColorModel) {
throw new
IllegalArgumentException("Rescaling cannot be "+
"performed on an indexed image");
}
if (numFactors != 1 &&
{
throw new IllegalArgumentException("Number of scaling constants "+
"does not equal the number of"+
" components");
}
{
// Not prepared to deal with other color spaces
return false;
}
// Not really prepared to handle this at the native level, so...
return false;
}
return true;
}
{
// assert rq.lock.isHeldByCurrentThread();
boolean nonPremult =
/*
* Note: The user-provided scale factors and offsets are arranged
* in R/G/B/A order, regardless of the raw data order of the
* underlying Raster/DataBuffer. The source image data is ultimately
* converted into RGBA data when uploaded to an OpenGL texture
* (even for TYPE_GRAY), so the scale factors and offsets are already
* in the order expected by the native OpenGL code.
*
* However, the offsets provided by the user are in a range dictated
* example, for 8/8/8 data each offset is in the range [0,255],
* for 5/5/5 data each offset is in the range [0,31], and so on.
* The OpenGL shader only thinks in terms of [0,1], so below we need
* to normalize the user-provided offset values into the range [0,1].
*/
// To make things easier, we will always pass all four bands
// down to native code...
float[] normScaleFactors;
float[] normOffsets;
if (numFactors == 1) {
normScaleFactors = new float[4];
normOffsets = new float[4];
for (int i = 0; i < 3; i++) {
}
// Leave alpha untouched...
} else if (numFactors == 3) {
normScaleFactors = new float[4];
normOffsets = new float[4];
for (int i = 0; i < 3; i++) {
normScaleFactors[i] = origScaleFactors[i];
normOffsets[i] = origOffsets[i];
}
// Leave alpha untouched...
} else { // (numFactors == 4)
}
// The user-provided offsets are specified in the range
// of each source color band, but the OpenGL shader only wants
// to deal with data in the range [0,1], so we need to normalize
// each offset value to the range [0,1] here.
// Gray data
for (int i = 0; i < 3; i++) {
normOffsets[i] /= maxValue;
}
} else {
// RGB(A) data
normOffsets[i] /= maxValue;
}
}
int sizeofFloat = 4;
}
// assert rq.lock.isHeldByCurrentThread();
}
/**************************** LookupOp support ******************************/
{
if (srcCM instanceof IndexColorModel) {
throw new
IllegalArgumentException("LookupOp cannot be "+
"performed on an indexed image");
}
if (numComps != 1 &&
{
throw new IllegalArgumentException("Number of arrays in the "+
" lookup table ("+
") is not compatible with"+
" the src image: "+srcImg);
}
{
// Not prepared to deal with other color spaces
return false;
}
// Not really prepared to handle this at the native level, so...
return false;
}
// The LookupTable spec says that "all arrays must be the
// same size" but unfortunately the constructors do not
// enforce that. Also, our native code only works with
// arrays no larger than 256 elements, so check both of
// these restrictions here.
if (table instanceof ByteLookupTable) {
{
return false;
}
}
} else if (table instanceof ShortLookupTable) {
{
return false;
}
}
} else {
return false;
}
return true;
}
{
// assert rq.lock.isHeldByCurrentThread();
boolean nonPremult =
int bandLength;
int bytesPerElem;
boolean shortData;
if (table instanceof ShortLookupTable) {
bytesPerElem = 2;
shortData = true;
} else { // (table instanceof ByteLookupTable)
bytesPerElem = 1;
shortData = false;
}
// Adjust the LUT length so that it ends on a 4-byte boundary
if (shortData) {
for (int i = 0; i < numBands; i++) {
}
} else {
for (int i = 0; i < numBands; i++) {
}
}
if (padding != 0) {
}
}
// assert rq.lock.isHeldByCurrentThread();
}
}