Hi !
the 2px offset its weird ! dont know . cant explain it .
inlets = 1;
outlets = 2;
autowatch = 1;
mgraphics.init();
mgraphics.relative_coords = 0;
mgraphics.autofill = 0;
var curImage = new Image();
var width = box.rect[2] - box.rect[0];
var height = box.rect[3] - box.rect[1];
/************************/
function paint()
{
mgraphics.set_line_width(2.);
mgraphics.set_source_rgba(1., 0., 0., 1.);
with (mgraphics) {
translate(-2,-2); // HEEEEEEEEREEE I AM
push_group();
image_surface_draw(curImage); //draw old image
curImage.freepeer();
//add more shapes
set_source_rgb(Math.random(), Math.random(), Math.random());
set_line_width(5);
rectangle(0, 0, width- 5, height-5);
stroke();
rectangle(Math.random() * width, Math.random() * height, 50, 50);
set_source_rgb(Math.random(), Math.random(), Math.random());
fill();
//save as new image
curImage = new Image(pop_group());
//draw the new image
image_surface_draw(curImage);
}
post("image size = ", curImage.size, "\n");
}
/************************/
function bang()
{
mgraphics.redraw();
}
/************************/
a hack would be a translate . its offseting back these 2px .