FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Responsive Form, Games
(Moderator: REAS)
   Simple Painter
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Simple Painter  (Read 3319 times)
Squillis

Squillis WWW
Simple Painter
« on: Nov 21st, 2003, 12:57am »

This is simple painter I created for my pixel city project.  The cell size is variable.
 
http://robotican.org/misc/cells_of_mine
 
Will be using it to create and submit building drawings to a mysql db for this page:
 
http://robotican.org/pixel_test/test.php
 
Squillis

Squillis WWW
Re: Simple Painter
« Reply #1 on: Jan 5th, 2004, 11:02pm »

Added some features and sped some things up.
 
http://robotican.org/pixel_test/cells_of_mine/
 
Source: http://robotican.org/pixel_test/cells_of_mine/cells_of_mine.pde
 
's' - rectangle tool
'd' - fill tool
'f' - normal paint
 
'space' - clear screen
« Last Edit: Mar 14th, 2005, 7:35am by Squillis »  
Kevin Pfeiffer
Guest
Email
Re: Simple Painter
« Reply #2 on: Jan 16th, 2004, 1:31am »

> Added some features and sped some things up.  
   
> http://www.robotican.org/cells/p5/cells.jsp  
   
I got "Applet failed"
 
But it's late and maybe the browser (Konqueror) is as tired as I am...
 
-K
 
zach


Re: Simple Painter
« Reply #3 on: Jan 16th, 2004, 6:02pm »

cool - works for me...
 
have you seen this?
 
you might really enjoy it:
http://www.ifi.ntnu.no/~dags/pip.html
 
- zach
 
rgovostes

rgovostes
Re: Simple Painter
« Reply #4 on: Jan 16th, 2004, 6:14pm »

zach: that link doesn't seem to work for me.
 
Squillis: If one moves the mouse too quickly, it leaves gaps in the drawing. Here are some suggestions for fixing this:
 
1. Draw lines from point to point, using the Bresenham line algoritthm.
2. Use an array of booleans for quickly changing whether or not you've drawn on a square in the grid. When the mouse button is released, go through each square marked as 'true' and fill it with color.
3. Let the user draw a 1x1 line (the 'pencil tool' found in most graphic apps), and connect points drawn by it with Processing's built in line-drawing functions. When the mouse button is released, find every square that was drawn in and fill it with color.
4. Have all drawings occur on a small, 1:1 picture in Processing, then blow it up to whatever dimensions you need it.
 
You could also look into Bresenham's circle drawing algorithm for doing circles.
« Last Edit: Jan 16th, 2004, 6:16pm by rgovostes »  
Squillis

Squillis WWW
Re: Simple Painter
« Reply #5 on: Jan 17th, 2004, 4:53am »

Thanks for the feedback.  So, after every loop if the cell has changed, mark true all the cells in between start and finish even if it's only one cell?  If that's the case, wouldn't diagonals drawn quickly would become two cells thick by default?
 
Thanks again.  I'm new to all this and just coming up with what I can.  All suggestions are welcome. :]
 
Edit:  I might need to explain my approach.  I'm using a Cell object because each cell will contain both color and href information to be stored in a database.
« Last Edit: Jan 17th, 2004, 4:56am by Squillis »  
grrrr


Re: Simple Painter, fill, save?
« Reply #6 on: Oct 26th, 2004, 7:32pm »

i did something more raw, visitors can draw over my drawing:
http://grrrr.net/feat_you/you_2.html
 
now i would like to add a fill-tool
and a way to submit the drawings (as png or gif) to my server
 
did anybody do something simlar?
i like cells of mine but cant find the fill-tool
(the other links dont work)
« Last Edit: Nov 25th, 2004, 5:59pm by grrrr »  
fjen

WWW
Re: Simple Painter
« Reply #7 on: Oct 29th, 2004, 2:53pm »

hi grrr,
 
here's a pointer to a thread about saving images to a server from processing:
 
http://processing.org/discourse/yabb/board_Integrate_action_dis_play_num_1090838754.html
 
the fill-tool you've been asking about is probably something like the bucket-tool in photoshop that's called a floodfill algorithm, here's an example:
 
http://www.florianjenett.de/p55/flood_fill.zip
 
/F
« Last Edit: Oct 29th, 2004, 2:53pm by fjen »  
grrrr


Arrrrgh2 Painter
« Reply #8 on: Nov 25th, 2004, 5:49pm »

thank you for the flood-tool...
now my applet has 3colors and 3tools(pencil, flood, invert)
see at:
http://grrrr.net/feat_you/you_1.html
 
but im still not skilled enough to build a save-to-server-button
 
Squillis

Squillis WWW
Re: Simple Painter
« Reply #9 on: Mar 14th, 2005, 7:34am »

Sorry about the dead links.  Tomcat was killing my little 400mhz server.  This is the last version I have.  
 
http://robotican.org/pixel_test/cells_of_mine/
 
Oh, and check out the bucket tool in this version.  It's much shorter than the above link, and it appears to work.
« Last Edit: Mar 14th, 2005, 7:46am by Squillis »  
Pages: 1 

« Previous topic | Next topic »