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 › some kind of masking
Page Index Toggle Pages: 1
some kind of masking (Read 715 times)
some kind of masking
Aug 14th, 2005, 6:22am
 
hello list,

is there any way to mask shapes beign drawn by Processing? For example, I want to draw lines randomly, and mask these lines, to make them form a determined shape.

bye,
andrei
Re: some kind of masking
Reply #1 - Aug 14th, 2005, 9:28pm
 
nope, can't do it unfortunately. probably not until after 1.0.
Re: some kind of masking
Reply #2 - Aug 17th, 2005, 9:36am
 
Well, if i understand correctly, then this worked for me:

Code:

PImage m;

void setup()
{
size(200,200);
background(0);
smooth();
m = loadImage("mask.gif");
}

void draw()
{
stroke(255,0,0);
line(random(200),random(200),random(200),random(200));
image(m,0,0);
}


Where mask.gif is filled white with a section cut out of it (transparent)
Re: some kind of masking
Reply #3 - Aug 17th, 2005, 3:42pm
 
hm, i guess it depends on what you want to do. you can use an image as a mask or set a mask on that when drawing.. but there's no way to really mask a set of geometry.

so you might be able to do something like make a new PGraphics3, then draw lines into it, then call its mask() function to shape it using another image, then call image() to draw that PGraphics3 back to the drawing surface.. buuut that might be a bit much.
Page Index Toggle Pages: 1