Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulate a spray

How can i simulate a spray like windows paint ? i think it create points random , what is your opinion?

like image 290
Hesam Qodsi Avatar asked May 25 '10 16:05

Hesam Qodsi


2 Answers

Yes, I would say it colors random pixels within a certain radius of the selection point. There's also probably a time delay between the coloring of one pixel and the other, because machines today are fast enough to be able to color every possible pixel (As long as the radius is small) before you could let go of the mouse button.

Also, I think the algorithm that Paint uses can select a pixel to paint even if it already has been painted, since sometimes you can end up with a painted circle with a few unpainted pixels inside.

like image 83
Jesse Jashinsky Avatar answered Oct 31 '22 19:10

Jesse Jashinsky


The pattern for spray paint would be semi-random. If you get out a can of Krylon and slowly spray a line on a wall, you end up with a wide solid line that fades out to the background with a gradient around the edges. Spray in one spot for ten seconds, and you get a big dot in the center in which the color is fully saturated, with a radial gradient to the background.

So- your variables for simulation include:

  • Time holding the "sprayer" (mouse button)
  • Motion of the "can" (mouse)
  • Speed of the "can" (fast moves make a light, unsaturated line. Slow moves make a thick, saturated line with a gradient)
  • spread pattern: is the spray focused like an airbrush, or big like a spray can?
  • "Distance": How far away is the "sprayer" from the "canvas"?
like image 40
Dave Swersky Avatar answered Oct 31 '22 17:10

Dave Swersky