Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / Gradient/Alpha Paint with Undo

Author
Message
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Dec 2014 02:06
Requires the attached brush or similar

opacity# should be set as a percentage
SpriteLimit is however many your machine can handle



Attachments

Login to view attachments
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 2nd Dec 2014 06:44
That's pretty cool! Lots of sprites to have floating around, but it makes for nice undo code.

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Dec 2014 11:55
Quote: "That's pretty cool! Lots of sprites to have floating around, but it makes for nice undo code."


Thanks man!
I'm trying to code a simple terrain editor with texture splatting, and I wanted to have control over the alpha maps without having to exit to a paint program.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 2nd Dec 2014 14:14
Neat.

You might even be able to squeeze in a get image/save image option in there somewhere.

That logic should fit neatly into an editor with lots of brushes to choose from.



Powered by Free Banners
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Dec 2014 15:28
Quote: "That logic should fit neatly into an editor with lots of brushes to choose from."


That's definitely something worth looking into. Brush sizes should be easy with SIZE SPRITE.

I tried once using a second image for a second brush option, but the sprites holding the first image always wanted to be on top. This may be because the sprite all shared one image, but I know nothing about controlling the draw order of the sprites.

I'm wondering if each sprite should have its own brush image, perhaps copied from a memblock..? Seems like a lot of images though.

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 2nd Dec 2014 17:06 Edited at: 2nd Dec 2014 23:56
Ok, it looks like SET SPRITE DIFFUSE easily takes care of the color palette. Here's a version with color selection using the center mouse button:





Attachments

Login to view attachments
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 4th Dec 2014 00:19
Not to beat a thread horse, but I think over the weekend I'll try to recode this thing so that when you release the draw button, the current sprites are simply put to an image, and then the sprite count starts over. The undo routine would then include all previous images in addition to the current sprites.

If someones tries it before me, let's have the results!
Perhaps a universal function or even plugin could result from this.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 4th Dec 2014 07:43
Seems like a good change. Another feature that would be cool would be to interpolate sprites between the mouse positions if the user moves the mouse very quickly - you could afford to use the sprites much more densely since you don't have to keep so many around.

Quote: "I tried once using a second image for a second brush option, but the sprites holding the first image always wanted to be on top."

This is irrelevant if you do that rewrite, but I bet that's due to draw call batching. Loading a new image for each sprite like you said would probably fix it - or, you could atlas all the sprites into one image and use SET SPRITE TEXTURE COORD to select the one you wanted.

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 4th Dec 2014 15:14
Quote: " or, you could atlas all the sprites into one image and use SET SPRITE TEXTURE COORD to select the one you wanted."



Whoa, that's slick!
Another option could be to make it an animated sprite and use SET SPRITE FRAME.

I'm also thinking that instead of having a paint window inside a window like most apps, make the canvas the whole window, and have the window resize to the user's specs. The tools & menus could be opened/closed with the tab key.

Other easy options: cropping, resize, blur, brightness, contrast, noise, blend with another image, saturate/desaturate, colorize, color shift, possibly even kaleidoscope!

Login to post a reply

Server time is: 2024-03-28 22:19:57
Your offset time is: 2024-03-28 22:19:57