We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › save as PDF - absolute beginner :)
Page Index Toggle Pages: 1
save as PDF - absolute beginner :) (Read 578 times)
save as PDF - absolute beginner :)
Nov 25th, 2007, 7:12pm
 
Hello guys I´m just playing with processing for the first day and i can´t figure out how to combine the pointillize code with the pdf code to save my artwork as a pdf.

maybe you can tell me what´s wrong Smiley
thanx a lot!!!

import processing.pdf.*;

PImage a;

void setup()

{
 a = loadImage("ceausescu_31.jpg");
 size(500,500);
 noStroke();
 background(255);
 smooth();
}

void draw()
{
 float pointillize = map(mouseX, 0, width, 2, 38);
 int x = int(random(a.width));
 int y = int(random(a.height));
 color pix = a.get(x, y);
 fill(pix, 126);
 ellipse(x, y, pointillize, pointillize);
}

void mousePressed() {
 beginRecord(PDF, "Lines.pdf");
 background(255);
}

void mouseReleased() {
 endRecord();
 background(255);
}

Re: save as PDF - absolute beginner :)
Reply #1 - Nov 25th, 2007, 7:23pm
 
this works for me? what do you mean is the problem? if the problem is that the pdf just turns out white, you need to remove the background(255) from mousePressed and mouseReleased.

Slm
Re: save as PDF - absolute beginner :)
Reply #2 - Nov 25th, 2007, 7:34pm
 
Thanx for the quick answer, kontrol. Yes it works :)
Page Index Toggle Pages: 1