The image is clipped after convolve
Here is my code snippet:
class cursorextends JComponent{
GeneralPath cursor =new GeneralPath();
int width;
int height;
int gkRadius = 5;
public cursor(){
setBackground(Color.black);
cursor.moveTo(0.0f, 0.0f);
cursor.lineTo(0.0f, 20.0f);
cursor.lineTo(4.0f, 16.0f);
cursor.lineTo(5.0f, 17.0f);
cursor.lineTo(10.0f, 26.0f);
cursor.lineTo(12.0f, 26.0f);
cursor.lineTo(13.0f, 25.0f);
cursor.lineTo(8.0f, 14.0f);
cursor.lineTo(14.0f, 14.0f);
cursor.closePath();
width = cursor.getBounds().width;
height= cursor.getBounds().height;
}
publicvoid paint(Graphics _g){
super.paint(_g);
BufferedImage im2;
Graphics2D g2d;
im2 =new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
g2d = im2.createGraphics();
//Set the background to black
g2d.setBackground(getBackground());
g2d.clearRect(0,0,width,height);
g2d.setPaint(Color.gray);
g2d.fill(cursor);
// Blur the image
ConvolveOp blur =new ConvolveOp(new GaussianKernel(gkRadius));
BufferedImage im = blur.filter(im2,null);
Graphics2D g = (Graphics2D)_g;
g.drawImage(im, null,null);
}
}
Before i add the convolve operation, the generated image im
looks fine. However after i blur it, the generated image im2
is clipped. The width and height is different before the blurred operatoin.
Does anyone tell me why and what's the modification?

