Update the AlphaRasterImage class constructor like below to fix the issue.
Existing:
=====
public AlphaRasterImage(String k, RenderedImage image) {
this(k, GraphicsUtil.getAlphaRaster(image));
}
Updated:
=====
/**
* Create a alpha channel image.
* Extracts the alpha channel from the RenderedImage and creates a new
bitmap image
* with the given data.
*
* @param k the key to be used to lookup the image
* @param image the image (must have an alpha channel)
*/
public AlphaRasterImage(String k, RenderedImage image) {
this(k, getAlphaRaster(image));
}
/**
*
*
* Fix for Alpha Raster Image Issue.
*
* Extracts the Alpha Raster for the given image.
*
*/
private static java.awt.image.Raster getAlphaRaster(RenderedImage image)
{
java.awt.image.Raster alphaRaster = GraphicsUtil.getAlphaRaster(image);
/*
* If alphaRaster is null from the above call, then create the image
with
* alpha channel and return the alphaRaster.
*/
if (alphaRaster == null)
{
BufferedImage bufferedImage = (BufferedImage)image;
int w = bufferedImage.getWidth();
int h = bufferedImage.getHeight();
int type = BufferedImage.TYPE_INT_ARGB;
BufferedImage bia = new BufferedImage(w,h,type);
Graphics2D g = bia.createGraphics();
ImageObserver imo = null;
g.drawImage(bufferedImage, 0, 0, imo);
g.dispose();
alphaRaster = GraphicsUtil.getAlphaRaster(bia);
}
return alphaRaster;
}
--
View this message in context:
http://apache-fop.1065347.n5.nabble.com/jira-Updated-FOP-2512-java-lang-NullPointerException-Parameter-alpha-must-not-be-null-tp42911p42965.html
Sent from the FOP - Dev mailing list archive at Nabble.com.