/* * Copyright (c) 2014, 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. * * 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 8038000 8047066 * * @summary Verifies that we could create different type of Rasters with height 1 * and strideline which exceeds raster width. * Also checks that a set of RasterOp work correctly with such kind of Rasters. * For 8047066 verifies that ColorConvertOp could process * Raster (ByteBuffer + SinglePixelPackedSampleModel) * * @run main bug8038000
*/
publicstaticvoid main(String[] args) throws Exception { new bug8038000().checkOps();
// No exceptions - Passed
}
privatevoid checkOps() throws Exception {
RasterOp[] ops = new RasterOp[] { new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB),
ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), null), new AffineTransformOp(AffineTransform.getScaleInstance(1, 1.1), null)
};
/** * Takes two identical rasters (identical with the exception of scanline stride) * fills their pixels with identical data, applies the RasterOp to both rasters * and checks that the result is the same
*/ privatevoid checkOp(WritableRaster wr1, WritableRaster wr2, RasterOp op) {
System.out.println("Checking " + op + " with rasters: \n " + wr1 + "\n " + wr2); try {
WritableRaster r1 = op.filter(fillRaster(wr1), null);
WritableRaster r2 = op.filter(fillRaster(wr2), null);
compareRasters(r1, r2);
} catch (ImagingOpException e) {
System.out.println(" Skip: Op is not supported: " + e);
}
}
private WritableRaster fillRaster(WritableRaster wr) { int c = 0; for(int x = wr.getMinX(); x < wr.getMinX() + wr.getWidth(); x++) { for(int y = wr.getMinY(); y < wr.getMinY() + wr.getHeight(); y++) { for (int b = 0; b < wr.getNumBands(); b++) {
wr.setSample(x, y, b, c++);
}
}
} return wr;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.