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 & HelpPrograms › Filling an area with colour help!
Page Index Toggle Pages: 1
Filling an area with colour help! (Read 647 times)
Filling an area with colour help!
Apr 27th, 2010, 4:52am
 
Hello!

I'm kind of new to Processing, and I've chosen something a lot harder than I originally thought to do my assignment on!

What I'm trying to do is make a pixel art program (if anyone doesn't know what this is, it's using blocks of colour - like pixels - to create an image, like images by eBoy), so what I've done is used an array to make 10x10 grid squares on the screen. Now what I want to do, is when a user selects a colour to be able to click inside the grid square and fill it with the chosen colour. I have absolutely no idea where to even start with this, if anyone could help I'd be really grateful!

Thank you !
Re: Filling an area with colour help!
Reply #1 - Apr 27th, 2010, 6:24am
 
To fill a square with a color, use:
Code:
fill(yourColor);
rect(posX, posY, squareSize, squareSize);

where posX and posY are the top-left corner of your square (margin + multiple of squareSize).
Page Index Toggle Pages: 1