PdfPaint col = gs.getNonstrokeColor();
Rectangle bounds = currentShape.getBounds();
bounds.setSize((int) (bounds.width * scaling), (int) (bounds.height * scaling));//dont like this cast
if(col.isPattern()) {
PaintContext context = col.createContext(null, bounds, bounds, scalingTransform, null);
Raster raster = context.getRaster(bounds.x, bounds.y, bounds.width > 1 ? bounds.width : 1, bounds.height > 1 ? bounds.height : 1);
BufferedImage img = new BufferedImage(bounds.width > 1 ? bounds.width : 1, bounds.height > 1 ? bounds.height : 1, BufferedImage.TYPE_4BYTE_ABGR);
img.setData(raster);