Curious how to write a painting program


Here we mingle, introduce ourselves, our thoughts and ideas and have caring discussions.

Posts: 5

Joined: Wed May 28, 2014 8:36 pm

Post Tue Apr 26, 2016 12:47 am

Curious how to write a painting program

Recently I've been really curious about trying to write my own painting program, but i don't know how to start

I remembered that you wrote verve from scratch, and I thought maybe you'd have insights about what steps I should take to make my own painter? I feel like it would be really fun to do, but, again, I have no idea what to do.

do you remember the steps you took to make verve what it is? especially things like how to have multiple layers and do brush effects?
User avatar

Site Admin

Posts: 7293

Joined: Sun Nov 10, 2013 1:38 pm

Post Tue Apr 26, 2016 9:50 am

Re: Curious how to write a painting program

What's your programming background, what language are you planning to use and how advanced is your command of it?

To give you a brief history of my experience... when I resumed programming on my own after many years of not programming at all and then coding plugins for 3d apps and later some afterFX filters, I would start writing little games. Playing with refresh on buffers to create simple motion blur effects, I realized again how simple it would be to make a painter by simply not clearing at all. Then I realized that painting with different colors at different alpha values would create certain blending troubles, so I came up with a simple solution to fill an extra buffer with the current color and only paint alpha values on that, blend that buffer with the final image and only merge it down after a stroke has finished. I'm almost certain this is how one would normally do that. This was many, many years before Verve.
In Verve things work very differently, though, creating extra challenges you should not have to fight with, if you "just" want to make a neatly digital painter. :)

For multiple layers it's best to first of all create a layer class. The class should have fields for image and various parameters such as x,y offset, possible effects values (color treatments) and what ever else may be relevant to each single layer. Then it should have methods for its drawing. They should support the various blending modes you'd like to offer (replace, add, multiply, overlay...what ever...).
Later on you'd have a display routine that would loop through all the layers in your array and call their drawing method.

Though I currently still do that all the time in Verve, I will later on optimize it to create temporary combinations without having to redraw them all the time. That's tricky, because if you paint on a layer in the middle of the set and different blend modes are on top, they can't just be combined without having to be recomputed. Unless, hmmm....I might think of some faster solutions there. Anyway...not relevant to you right now. ;)

Brush is a wide open topic. You can think up any wild way to make a brush work. I've written a lot of different systems, only a few of them are actually in Verve right now. Years ago I wrote some crazy particle based brushes that were extraordinarily brilliant for hair and fur and all sorts of vegetation, hehehe. But there's no end to what you could come up with. I have some hidden possibilities in Verve right now, which I will bring to light real soon that are also really, really fun and powerful. c:!

Most complicated there are the way you process strokes! If you are not on a supercomputer, hehehe, you may have to interpolate stroke coordinates between the frames of you capturing the pointer (mouse, pen or touch). But I think you'll be thrilled by the time you get to those troubles, hahaha, so... let's talk more then! :ugeek:

Good luck already and I'm also happy to help you, but don't expect to get my fluids routine! ;)
Here to help! :D
System Info: AMD Radeon RX Vega 10, AMD Ryzen 7 (2.3 Ghz), Windows 11
Taron.de | Twitter | Pinterest | YouTube
User avatar

Posts: 1102

Joined: Fri Jul 25, 2014 11:12 am

Post Wed Apr 27, 2016 11:39 am

Re: Curious how to write a painting program

Very interesting reading and a peek under the hood. Thank you for details, Taron! :beer:
After I read all difficulties you described and met during development I am pretty sure I don´t want to create a new painting program.. :) ..And the question is - why to do that when we have Verve! ;)
User avatar

Site Admin

Posts: 7293

Joined: Sun Nov 10, 2013 1:38 pm

Post Wed Apr 27, 2016 11:54 am

Re: Curious how to write a painting program

That's exactly the thing. If you feel something in your heart, this pull from a sense of joy and fascination, you should always pursue that, BUT it's best to have some kind of a sense of "why", too.
My most dominant motivation comes from always having wanted the ideal paint program for my kind of painting process. Not like Verve is there all the way, but it surely is getting there more than any other I've ever worked/played with.
SO, if you feel a certain desire that you could've never quite gotten satisfied by what's out there and you have a vague idea what it should be able to do, by all means, go for it and try writing it yourself. It's the most powerful motivation. But that doesn't make the process much easier, hehehe. And every now and then the thing you've wanted came from some other misconception and has always been there.
The danger of being able to program is that you might think you could create solutions that were actually no problem for the computer, but for yourself. It's tough to be really sure, but it's worse to find out about it later, haha. :PP

Yet, it really is a very rewarding fun to create tools! :ugeek: :bounce:
...but the real fundamental fun is really in using them and learning more about your own artistic understanding, if your heart is in it! c:!
Here to help! :D
System Info: AMD Radeon RX Vega 10, AMD Ryzen 7 (2.3 Ghz), Windows 11
Taron.de | Twitter | Pinterest | YouTube

Posts: 5

Joined: Wed May 28, 2014 8:36 pm

Post Thu Apr 28, 2016 12:13 pm

Re: Curious how to write a painting program

sorry for taking a bit to reply, I had a lot of college work to do

very interesting stuff to read about here.

I have experience in c++ and a few other languages, I guess I understand what you mean about the draw method and loop thing.

the delta change thing seems really neat, I doubt it would be TOO difficult to make as long as you didn't care about optimization shortcuts of having to re-render the further items in the stack

anyway im still really interested in this stuff, but i guess i need more experience to really understand it
User avatar

Site Admin

Posts: 7293

Joined: Sun Nov 10, 2013 1:38 pm

Post Thu Apr 28, 2016 12:26 pm

Re: Curious how to write a painting program

To do it properly, you wouldn't just have a delta, but collect the previous delta as well and use it to produce a proper curve that would follow your mouse. I found that using the halfway points between the actual mouse locations stays still true to the stroke and allows to keep the curve as tight to the current mouse location as possible. But that's just stroke considerations. At the end it's quite fascinating how deep the demands of a "simple painter" can go! :geek:

Cool, well, hope you're studying subjects your passionate about so that you use your time well! Don't worry about promptly replying here! ;) ...I'll be around! 8-)
Here to help! :D
System Info: AMD Radeon RX Vega 10, AMD Ryzen 7 (2.3 Ghz), Windows 11
Taron.de | Twitter | Pinterest | YouTube
User avatar

Posts: 4085

Joined: Mon Mar 24, 2014 9:58 am

Post Thu Apr 28, 2016 11:25 pm

Re: Curious how to write a painting program

Surrely a long way to home! ;)

Bon courage!

Maybe a new way will be to see what is the new paradigme of "quantic computer" for new investigation of visual art! ;)
Is beautiful that please without concept!
http://moiscript.weebly.com/ https://schmoll8.wixsite.com/magicavox
Latop: Geforce GTX 950M, Intel Quad Core i7, Windows 10, 8 Gigas, 2.4ghz

Return to Community [feedback, bug reports, discussions, etc...]

Who is online

Users browsing this forum: No registered users and 4 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software