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 › Blur on basic shapes.
Page Index Toggle Pages: 1
Blur on basic shapes. (Read 970 times)
Blur on basic shapes.
May 24th, 2007, 2:28pm
 
Hi folks,

i just started to work with processing today and want to write some applications to create random compositions. I allready did similar things in flash but stopped because postscript does not support the blur features in flash which kinda sucks.  I allready wrote a little drawing script which saves the whole composition as a .pdf which works fine for postproduction in illustrator. My questin is if there is an "easy" way to get a blur effect on basic shapes such as ellipses or rectangles? I didnt really find anything about it.

Thx!
Re: Blur on basic shapes.
Reply #1 - May 26th, 2007, 1:32pm
 
Hi,

Interesting question, since I also post process my PDF's in Illustrator for these simple effects.

Have you seen this: http://processing.org/reference/filter_.html Then you could blur inside processing and export a hi-res bitmap composition to PDF.

You could also try and export to a SVG format with the proSVG library. I haven't used proSVG, so I don't know if and how it would work. But I'm gonna experiment with it Smiley

Check out:
http://www.texone.org/prosvg/

http://en.wikipedia.org/wiki/SVG_filter_effect

http://www.w3schools.com/svg/filter1.svg
Re: Blur on basic shapes.
Reply #2 - May 26th, 2007, 1:44pm
 
okay, thats another possibility if the way with PDF does not work. I am really confident about it though because it can display and export transparency which postscript could not. So I think blur should work too.

But How do I blur basic shapes?
Re: Blur on basic shapes.
Reply #3 - May 26th, 2007, 2:13pm
 
Thrown together from some documentation examples. But how to blur multiple individual shapes with different blur settings, anyone?

Quote:


PGraphics pg;

void setup() {
 size(200, 200);
 noLoop();
 pg = createGraphics(200, 200, P3D);
}

void draw() {
 pg.beginDraw();
 pg.background(100);
 pg.noStroke();
 pg.fill(200);
 pg.ellipse(100,100,100,100);
 pg.filter(BLUR, 6);
 pg.endDraw();
 image(pg, 0, 0);
}

Re: Blur on basic shapes.
Reply #4 - May 29th, 2007, 2:15am
 
If I understand your question correctly... you'd like to be able to draw each of your separate shapes with its own unique amount of blur?

Strictly speaking, it can't be done.  That is, the primitive shapes themselves don't have blur settings.  It's not until they're rasterized that you can apply the pixel-based blur.

However, you're on the right track to a work-around: render each shape into a "scratch" image (like the "pg" you create in the last source you posted), then blur that scratch image accordingly, then composite that image onto the main drawing surface with individual image() calls.

So you have 90% of the idea there, all you'd need is just repeat it for each shape.  Say you're drawing 10 ellipses, you'd have 10 sets of "ellipse(); filter(); image();" within draw().
Re: Blur on basic shapes.
Reply #5 - May 29th, 2007, 10:31am
 
Thanks for the info davbol.

It's the vectors >> rasterization part I (and moka) was trying to avoid inside processing.

But rasterizing and filtering in Processing is much easier and just as good for printing simple compositions.
Re: Blur on basic shapes.
Reply #6 - May 29th, 2007, 3:16pm
 
yeah, although my idea was to run the program in a small window to save performance and than size it up in illustrator which would not work with rasterized shapes. I will ignore blur on my first projects I quess.

I have another question though. right now every single image is named the same way through

beginRecord(PDF, "everything.pdf");

is there a possibility in processing to make a prompt so you can give an individual name to every render?

I seriously didnt find anything about that. Thanks for your help so far!
Re: Blur on basic shapes.
Reply #7 - May 29th, 2007, 3:44pm
 
You're welcome. Use date- timestamps to create unique ascending file names. You could also include the year(), month() and millis() etc.

Something like this:

Quote:

String timestamp = day() + "-" + hour() + minute() +  second();
beginRecord(PDF, "everything_" + timestamp + ".pdf");
Re: Blur on basic shapes.
Reply #8 - May 29th, 2007, 4:25pm
 
thanks, I think that should work for now. Allthough I would rather like to give them a name than random numbers. Would get really hard to find a certain one in a bigger amount of images.
Page Index Toggle Pages: 1