xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r499611 - in /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image: GraphicsUtil.java rendered/Any2LsRGBRed.java
Date Wed, 24 Jan 2007 23:17:51 GMT
Author: cam
Date: Wed Jan 24 15:17:50 2007
New Revision: 499611

URL: http://svn.apache.org/viewvc?view=rev&rev=499611
Log:
1. Moved missing convertToLsRGB method to Commons.

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java?view=diff&rev=499611&r1=499610&r2=499611
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/GraphicsUtil.java Wed
Jan 24 15:17:50 2007
@@ -38,6 +38,7 @@
 import java.awt.image.SinglePixelPackedSampleModel;
 import java.awt.image.WritableRaster;
 
+import org.apache.xmlgraphics.image.rendered.Any2LsRGBRed;
 import org.apache.xmlgraphics.image.rendered.Any2sRGBRed;
 import org.apache.xmlgraphics.image.rendered.BufferedImageCachableRed;
 import org.apache.xmlgraphics.image.rendered.CachableRed;
@@ -135,6 +136,26 @@
         ColorModel cm = makeLinear_sRGBCM(premult);
         WritableRaster wr = cm.createCompatibleWritableRaster(width, height);
         return new BufferedImage(cm, wr, premult, null);
+    }
+
+    /**
+     * This method will return a CacheableRed that has it's data in
+     * the linear sRGB colorspace. If <tt>src</tt> is already in
+     * linear sRGB then this method does nothing and returns <tt>src</tt>.
+     * Otherwise it creates a transform that will convert
+     * <tt>src</tt>'s output to linear sRGB and returns that CacheableRed.
+     *
+     * @param src The image to convert to linear sRGB.
+     * @return    An equivilant image to <tt>src</tt> who's data is in
+     *            linear sRGB.
+     */
+    public static CachableRed convertToLsRGB(CachableRed src) {
+        ColorModel cm = src.getColorModel();
+        ColorSpace cs = cm.getColorSpace();
+        if (cs == ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB))
+            return src;
+
+        return new Any2LsRGBRed(src);
     }
 
     /**

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java?view=diff&rev=499611&r1=499610&r2=499611
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java
(original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/rendered/Any2LsRGBRed.java
Wed Jan 24 15:17:50 2007
@@ -1,23 +1,23 @@
 /*
-
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
-package org.apache.batik.ext.awt.image.rendered;
 
+/* $Id$ */
+
+package org.apache.xmlgraphics.image.rendered;
 
 import java.awt.Point;
 import java.awt.Rectangle;
@@ -32,7 +32,7 @@
 import java.awt.image.SinglePixelPackedSampleModel;
 import java.awt.image.WritableRaster;
 
-import org.apache.batik.ext.awt.image.GraphicsUtil;
+import org.apache.xmlgraphics.image.GraphicsUtil;
 import org.apache.xmlgraphics.image.rendered.AbstractRed;
 import org.apache.xmlgraphics.image.rendered.Any2sRGBRed;
 import org.apache.xmlgraphics.image.rendered.CachableRed;
@@ -43,7 +43,8 @@
  * new image.
  *
  * @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
- * @version $Id$ */
+ * @version $Id$
+ */
 public class Any2LsRGBRed extends AbstractRed {
 
     boolean srcIssRGB = false;



---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message