Description
An image with a background color will fail to be created properly. The problem appears to be in the call to ImageIO.write(), which does not put anything into the byte buffer.
The following works:
http://localhost:8080/rounded?c=blue&w=20&h=20&shadow=false&a=tl
A simple, rounded corner is produced in blue.
The following fails:
http://localhost:8080/rounded?c=blue&bc=red&w=20&h=20&shadow=false&a=tl
The only addition in the failing case is a non-transparent background color. The logged message is the following:
23:55:17.230 ERROR! [SocketListener0-0] org.apache.tapestry.contrib.services.impl.RoundedCornerService.service(RoundedCornerService.java:138) >42> Image generated had zero length byte array from parameters of:
[color:blue, bgColor:red, width:20, height:20, angle:tl, shadowWidth:-1, shadowOpacity:-1.0, side:null, wholeShadow: false, arcWidth: -1.0, arcHeight:-1.0
image: BufferedImage@4ca30b: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 20 height = 20 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0
Note that if the service code is modified such that the type is forced to PNG, then the second example does render properly (red background and all).