xxxxxxxxxx
76
// Template for letter sized printing
// To print letter size (8.5 x 11 inches) you need: 8.5 * 72 pixels 11 * 72 pixels
// However graphics should be within the rectangle
let img; // Declare variable 'img'.
let img2
let blue, red;
function preload() {
img = loadImage('assets/ammi_vintage.JPEG');
img2 = loadImage('assets/ammi_2022.jpeg');
}
function setup(){
createCanvas(8.5 * 72, 11 * 72); // letter size
pixelDensity(1); //this compensates for density of retina screens
// let blue = new Riso("blue"); //blue layer. The riso object takes one argument which is the ink color.
// let pink = new Riso("FLUORESCENTPINK");
let blue = new Riso("blue");
let red = new Riso("red");
let justCyan = extractCMYKChannel(img, "cyan"); //extract cyan from img
let justMagenta = extractCMYKChannel(img2, "magenta"); //extract magenta from img
blue.image(justCyan, 0, 0); //draw justCyan to blue layer
red.image(justMagenta, 0, 0); //draw justMagenta to red layer
background(255);
clearRiso();
//blue.fill(20);
// blue.rect(0.5 * 72, 0.5 * 72, 7.5*72, 10*72); //this rect extends to 0.5 inches from the edge of the page. It indicates the safe printing area of the page.
// blue.fill(200);
// blue.ellipse(width/2, height/2, 250,250);
// pink.fill(150);
// pink.noStroke();
// pink.ellipse(width/2-30, height/2-40, 300,300);
// let textGraphic = createGraphics(width, height);
// textGraphic.fill(0);
// textGraphic.textStyle(BOLD);
//textGraphic.textFont('Helvetica');
// textGraphic.textAlign(CENTER, CENTER);
// textGraphic.textSize(30);
// textGraphic.text('PRINT', width * 0.5, height * 0.5-15);
// textGraphic.text('& CODE', width * 0.5, height * 0.5+15);
//textGraphic.ellipse(width/2, height/2, 20,20);
// blue.cutout(textGraphic);
//pink.cutout(textGraphic);
//note the difference to the result if this is commented out or not. When it is off, the result will have two layers of ink on the overlap. When it is on, the pink will not print where the blue is.
//pink.cutout(blue);
drawRiso();{
// Displays the image at its actual size at point (0,0)
image(img, 0, 0, img.width/3, img.height/3);
// Displays the image at point (0, height/2) at half size
image(img2, 50, 50, img2.width/4, img2.height/4);
}
}
function mouseClicked(){
exportRiso();
}