- if ((width > 0) && (height > 0)) {
- return image.getSubimage(0, 0, width, height + 6);
+ if ((width > 0) && (height > 0) && (image != null)) {
+ /*
+ System.err.println(String.format("%d %d %d %d", width, y + 1,
+ rasterWidth, rasterHeight));
+ */
+
+ if ((rasterWidth > width) || (rasterHeight > y + 1)) {
+ resizeImage(Math.max(width, rasterWidth),
+ Math.max(y + 1, rasterHeight));
+ }
+ return image.getSubimage(0, 0, width, y + 1);