gen.commentln("%FOPBeginGraphics2D");
gen.saveGraphicsState();
// Clip to the image area.
gen.writeln("newpath");
gen.defineRect(fx, fy, fwidth, fheight);
gen.writeln("clip");
// transform so that the coordinates (0,0) is from the top left
// and positive is down and to the right. (0,0) is where the
// viewBox puts it.
gen.concatMatrix(sx, 0, 0, sy, fx, fy);