You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by vh...@apache.org on 2002/02/22 13:08:05 UTC
cvs commit: xml-batik/sources/org/apache/batik/ext/awt/image/rendered ProfileRed.java
vhardy 02/02/22 04:08:05
Modified: sources/org/apache/batik/ext/awt/image/rendered
ProfileRed.java
Log:
Fixed regression on color-Prof-BE-03. Now does not try to re-integrate alpha channel if there is none
Revision Changes Path
1.4 +30 -27 xml-batik/sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java
Index: ProfileRed.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/rendered/ProfileRed.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProfileRed.java 24 Jan 2002 21:35:32 -0000 1.3
+++ ProfileRed.java 22 Feb 2002 12:08:05 -0000 1.4
@@ -37,7 +37,7 @@
* on its source
*
* @author <a href="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
- * @version $Id: ProfileRed.java,v 1.3 2002/01/24 21:35:32 deweese Exp $
+ * @version $Id: ProfileRed.java,v 1.4 2002/02/22 12:08:05 vhardy Exp $
*/
public class ProfileRed extends AbstractRed {
private static final ColorSpace sRGBCS
@@ -171,7 +171,7 @@
img = imgComp;
imgCM = imgCompCM;
srcWR = wr.createWritableTranslatedChild(minX, minY);
- }
+ }
/**
* Now, the input image is using a component color
@@ -217,37 +217,40 @@
colorConvertOp.filter(newImg, sRGBImage);
/**
- * Integrate alpha back into the image
+ * Integrate alpha back into the image if there is any
*/
- DataBufferByte rgbData = (DataBufferByte)wr.getDataBuffer();
- byte[][] imgBanks = data.getBankData();
- byte[][] rgbBanks = rgbData.getBankData();
- byte[][] argbBanks = {rgbBanks[0], rgbBanks[1],
- rgbBanks[2], imgBanks[3]};
- DataBufferByte argbData = new DataBufferByte(argbBanks, imgBanks[0].length);
- srcWR = Raster.createBandedRaster(argbData, img.getWidth(), img.getHeight(),
- img.getWidth(), new int[]{0, 1, 2, 3},
- new int[]{0, 0, 0, 0}, new Point(0, 0));
- sRGBCompCM =
- new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
- new int[]{8, 8, 8, 8},
- true,
- false,
- Transparency.TRANSLUCENT,
- DataBuffer.TYPE_BYTE);
- sRGBImage = new BufferedImage(sRGBCompCM,
- srcWR,
- false,
- null);
-
+ if (imgCM.hasAlpha()){
+ DataBufferByte rgbData = (DataBufferByte)wr.getDataBuffer();
+ byte[][] imgBanks = data.getBankData();
+ byte[][] rgbBanks = rgbData.getBankData();
+
+ byte[][] argbBanks = {rgbBanks[0], rgbBanks[1],
+ rgbBanks[2], imgBanks[3]};
+ DataBufferByte argbData = new DataBufferByte(argbBanks, imgBanks[0].length);
+ srcWR = Raster.createBandedRaster(argbData, img.getWidth(), img.getHeight(),
+ img.getWidth(), new int[]{0, 1, 2, 3},
+ new int[]{0, 0, 0, 0}, new Point(0, 0));
+ sRGBCompCM =
+ new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ new int[]{8, 8, 8, 8},
+ true,
+ false,
+ Transparency.TRANSLUCENT,
+ DataBuffer.TYPE_BYTE);
+ sRGBImage = new BufferedImage(sRGBCompCM,
+ srcWR,
+ false,
+ null);
+
+ }
+
/*BufferedImage result = new BufferedImage(img.getWidth(),
- img.getHeight(),
- BufferedImage.TYPE_INT_ARGB);*/
+ img.getHeight(),
+ BufferedImage.TYPE_INT_ARGB);*/
BufferedImage result = new BufferedImage(sRGBCM,
argbWR.createWritableTranslatedChild(0, 0),
false,
null);
-
///////////////////////////////////////////////
// BUG IN ColorConvertOp: The following breaks:
// colorConvertOp.filter(sRGBImage, result);
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org