RFR: 8316497 : ColorConvertOp - typo for non-ICC conversions needs one-line fix [v6]
Sergey Bylokhov
serb at openjdk.org
Thu Jan 4 06:17:22 UTC 2024
On Thu, 4 Jan 2024 06:08:00 GMT, Renjith Kannath Pariyangad <rkannathpari at openjdk.org> wrote:
>> Something like this:
>>
>> /*
>> * Copyright (c) 2024, 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.
>> */
>>
>> import java.awt.Color;
>> import java.awt.GradientPaint;
>> import java.awt.Graphics2D;
>> import java.awt.Transparency;
>> import java.awt.color.ColorSpace;
>> import java.awt.image.BufferedImage;
>> import java.awt.image.ColorConvertOp;
>> import java.awt.image.ComponentColorModel;
>> import java.awt.image.DataBuffer;
>> import java.awt.image.WritableRaster;
>>
>> /*
>> * @test
>> * @bug 8316497
>> * @summary Verifies Color filter on Non ICC profile
>> */
>> public final class NonICCFilterTest {
>>
>> private static final class TestColorSpace extends ColorSpace {
>>
>> private final ColorSpace cs;
>>
>> TestColorSpace(ColorSpace cs) {
>> super(cs.getType(), cs.getNumComponents());
>> this.cs = cs;
>> }
>>
>> public float[] toRGB(float[] colorvalue) {
>> return cs.toRGB(colorvalue);
>> }
>>
>> public float[] fromRGB(float[] rgbvalue) {
>> return cs.fromRGB(rgbvalue);
>> }
>>
>> public float[] toCIEXYZ(float[] colorvalue) {
>> return cs.toCIEXYZ(colorvalue);
>> }
>>
>> public float[] fromCIEXYZ(float[] xyzvalue) {
>> return cs.fromCIEXYZ(xyzvalue);
>> }
>> }
>>
>> private static BufferedImage createTestImage(boolean isSrc, boolean plain) {
>> ColorSpace cs = createCS(isSrc, plain);
>> ComponentColorM...
>
> @mrserb, Thank you for bringing this up. Sorry I am not pretty clear about your suggestion on _Conversion via TestColorSpace wrapper vs ColorSpace w/o wrapper._ . In existing code `compareImages` (pixel value compare) function is local, are you suggesting to move this into wrapper?
Your `TestColorSpace` class is a wrapper on top of the actual color space. So you can compare the results of conversion using `TestColorSpace` vs using "actual color space" directly.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16895#discussion_r1441377540
More information about the client-libs-dev
mailing list