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.

DarkBASIC Professional Discussion / Add to bitmap image

Author
Message
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 25th Mar 2015 18:14
Hey all,

I'm halfway on my little app, a model to spritesheet application. It's very different than "SpriteMe" or "model-2-sprite", but I do need a function that captures the image frames and add them to a single image.

I know how to capture a single image, but how would I add the frames in a row and add additional rows to an image?

Thanks ahead!

Regards Sph!nx
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 25th Mar 2015 20:32 Edited at: 25th Mar 2015 20:39
Depending on how big the image is you could paste each frame (via sprites) to screen and use get image. You could paste image on image using imagekit or manipulate image data via memblocks. Also depends on what kind of result you want.

EDIT: I NEVER KNEW YOU COULD SAVE RENDER TARGETS?!!!!!!!

Okay, paste each frame to a render target

"Get in the Van!" - Van B
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 26th Mar 2015 14:15
Thanks for your reply.

I figured that much but what I'm looking for is actually applying it to the bitmap itself, because the exported sprite sheet could be bigger than the resolutions.

Regards Sph!nx
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 26th Mar 2015 22:54 Edited at: 26th Mar 2015 22:58
I believe this should work for all resolutions, Matrix Plugin Required

Converting it to a render target (if needed for reloading it for drawing):


Drawing to it: (if your just creating it and not amending it just make image to whatever size you need and then use this)


Then finally save it:


"Get in the Van!" - Van B
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 27th Mar 2015 15:03
Thanks Sasuke!

I need to finish up some GUI work en then I'll give this a try!

Regards Sph!nx
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 27th Mar 2015 18:40
Sasuke's code does not seem that hard but for some reason I constantly make a mess of things.

Here is the code for my frame images export function (this exports individual images from each frame, to get some insight in my code.


Any more help is appreciated!

I've also attached an image file for anyone interested in seeing the application GUI.

Regards Sph!nx

Attachments

Login to view attachments
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Mar 2015 21:43 Edited at: 27th Mar 2015 21:47
Here's an example of how you'd generate a sprite sheet for any amount of frames at any size:


Now if you're dealing with frames that are all different sizes there are algorithms for packing rectangles out there.

Also another method is visually editing the sprite sheet and placing where you want to the frames to be on it. Takes alitte more time but least you have more control and frames don't have to be uniform.

"Get in the Van!" - Van B
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 27th Mar 2015 21:48
Thank you very much Sasuke! I'll give it a go and try to implement it in my code.

Regards Sph!nx
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Mar 2015 21:56 Edited at: 27th Mar 2015 21:56
No problem and hope you success

It's fortunate you posted this thread cause I've just been playing around with generating or manipulating sprite sheets. Because of this thread and me playing around, I learned you could save Render Targets which I thought wasn't possible

"Get in the Van!" - Van B
Sph!nx
16
Years of Service
User Offline
Joined: 3rd Dec 2008
Location: The Netherlands
Posted: 28th Mar 2015 15:25 Edited at: 28th Mar 2015 15:25
Thanks again mate! It works perfectly. You are a great help.

I hope to release a demo in the next couple of weeks!

Regards Sph!nx

Login to post a reply

Server time is: 2025-05-14 10:34:11
Your offset time is: 2025-05-14 10:34:11