[x]

deviantART

 

Flash painter by ~Zareste:iconZareste:


Creative Commons License
Some rights reserved. This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
Details
Submitted: May 14, 2008
File Size: 4.2 KB
Image Size: 21.1 KB
Resolution: 150×150
Comments: 18
Favourites & Collections: 34 [who?]

Views
Total: 3,415
Today: 5

Downloads
Total: 196
Today: 2

Embed


Thumb

Artist's Comments

You can change brush properties while the mouse button is down, by the way.
All it needs now is a color palette. The equations behind this thing are incredible. I was aiming to match Photoshop's brushes and make a Flash program that paints smoother and is more versatile than all the other internet painters. I'd like to use this to make a replacement for iScribble since they use censorship.

Full-screen painter: [link]
.fla file: [link]

The programming
When you click, there's a paint blot; when you drag, more blots. Most programs put a new blot on every pixel you move over, but then the blots overlap too fast and the stroke becomes too dark and solid, but mine follows Photoshop's example and keeps the blots evenly spaced a few pixels apart, giving a smooth stroke. The reason most programs don't do this is because it's hard as shit to code. With each mouse movement, it calculates the mouse's distance from the last blot using trigonometry (xDistance squared plus yDistance squared, then square-root the result for the exact distance) then puts down a new blot if the mouse is the right distance: Half the brush-radius.

This gets complicated when you make a fast stroke, because the mouse starts skipping pixels and you need multiple evenly-spaced blots between the current and previous mouse positions. So the program checks every pixel between the current and last mouse positions, and puts a blot on each correctly-distanced pixel.

The paint blot is a hidden bitmap that's defined at the start of the program, then when you click, it's copied to the visible bitmap (the screen). The blot bitmap is sized 2x the brush radius, and each pixel in it is scanned for its distance from the center pixel. For an aliased (blocky) look, pixels smaller than or equal to the radius would be colored while others are left transparent. A lot of oekaki programs and old MSPaint use this method, but a smooth anti-aliased blot is tricky. For anti-aliasing, you give each pixel an opacity value based on how much of the circle fills the pixel. If, for example, the circle radius is 4, and a pixel is a distance of 4, the pixel will get an opacity of 50% because the circle is only filling half of the pixel (hitting the middle). The pixel's distance ranges from 3.5 to 4.5, so if the radius were 3.7, the pixel would get a 30% opacity because 3.7 is .3 more than 3.5.
[x]

Devious Comments

love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0

Comments


Woah. This is pretty cool <3

--
I am very bad at life, but I make very good sandwiches!
very very neat! Will you be taking this any farther? Cause other colors or a reset key would be nifty additions!

--
The artist stands in the harshest position of his own art, right above it and inside of it all at once. So while othes look up and see the final product, they can only look down on their own works and view the insides that hold it.
This is looking much nicer than iScribble, I can't stand that program. It's a shame Flash can't access stuff like tablet pressure, otherwise you could have a full-fledged online painting program. It's awesome what AS3 can achieve!

--
Ooooh T-shirts! - [link]

Sketch Blog - [link]
Nice tool you've made here. :D
brilliant! now all i need is a tablet pc!

--
hands off my miniwheats!! o.O
Cool, its like a mini photoshop! =D

--
Ah, the roundness is pleasing.

I am a belly lover!
I am a maieusophile, are you?

You are? Awesome! Come and join us! [link]
Oh, you can push 'delete' to reset. I'll certainly be doing more with this, like making a multi-user setup and adding it to The Grid I've been promising

Come to think of it, maybe I could hack it into a forum so people could post with sketches

--
You can trust me. I'm not a copyright psycho
I see that you are playing with programing. Do you plan to make your own photoshop?

--
cutest animal in the world :iconfurrydanceplz: :iconfurrydanceplz:
[link]

as well as the greatest pregnancy joke =D [link]
Oh I've been doing this a while - did some DOS programming a long time ago. That sorta came to a close when GUI programming and class systems showed up, which I couldn't catch onto thanks to those god-awful programming books that spend 30 pages explaining something I could explain with a paragraph.

It's always been so hard just to alter some pixels on the frickin screen. If I could just control pixels, I could have done anything, but every language has 5,000 functions to draw squares and stars and the damn kitchen sink but you have to dig through the dark depths of the programming book if you want to make a red pixel. If I made a programming language, I would advertise it saying 'YOU CAN ACTUALLY CHANGE FUCKING PIXELS USING THIS LANGUAGE. HOLY SHIT. AFTER 40 YEARS OF COMPUTER SYSTEM ADVANCEMENT YOU NOW HAVE THE ABILITY TO MAKE A PIXEL' and everyone would use it

I'd like to make my own imaging system, sure. One to rule them all

--
You can trust me. I'm not a copyright psycho

Site Map