getXStep(),
getYStep());
//anchor = getTransform().createTransformedShape(anchor).getBounds2D();
// now create a page bounded by the pattern's user space size
final PDFPage page = new PDFPage(getBBox(), 0);
// set the base paint if there is one
if (basePaint != null) {
page.addFillPaint(basePaint);
page.addStrokePaint(basePaint);
}
// undo the page's transform to user space
/*
AffineTransform xform =
new AffineTransform(1, 0, 0, -1, 0, getYStep());
//new AffineTransform(1, 0, 0, -1, 0, getBBox().getHeight());
page.addXform(xform);
*/
// now parse the pattern contents
PDFParser prc = new PDFParser(page, this.data, getResources());
prc.go(true);
int width = (int) getBBox().getWidth();
int height = (int) getBBox().getHeight();
// get actual image
Paint paint = new Paint() {
@Override
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform xform,
RenderingHints hints)
{
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel model = new ComponentColorModel(cs,
true,
false,
Transparency.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
Rectangle2D devBBox =
xform.createTransformedShape(getBBox()).getBounds2D();
double[] steps = new double[] { getXStep(), getYStep() };
xform.deltaTransform(steps, 0, steps, 0, 1);
int width = (int) Math.ceil(devBBox.getWidth());
int height = (int) Math.ceil(devBBox.getHeight());
BufferedImage img = (BufferedImage) page.getImage(width, height,
null, null,
false, true);
return new Type1PaintContext(model, devBBox,
(float) steps[0],