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 Discussion / Area of Larger Memblock to Smaller Memblock

Author
Message
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 2nd Jul 2009 05:20
Here's my function:



What it does it takes an image like this:


and takes only a part of it like this:


The only problem with it is it runs terribly slow if I repeatedly use it. Is there any way I could get this to run faster?
Brick Break
User Banned
Posted: 2nd Jul 2009 05:23
I don't work much with memblocks, but if it's for a sidescroller, which is what it looks like, then couldn't you just move the image around?

Permanoobs are awesome.
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 2nd Jul 2009 05:31
It's a little complicated to explain but I'll try

I only want part of the picture showing and I'm goin to add images on tops of it, and then combine them all into one image using the memblock. Plus the whole image is larger then the screen. so I can just paste it onto the screen and see the whole thing.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 2nd Jul 2009 05:37
if ur going larger to smaller, then heres what you do:

either:
if its an external file and its a bitmap then use load bitmap filename$,1

OR

otherwise make an offscreen bitmap the size of the larger image and put the image onto it

step 2:
make the SCREEN be the size of the smaller image OR make another offscreen bmp if its a weird size (one the screen wont support)

step 3:
use copy bitmap from-bmp,x1,y1,x2,y2,to-bmp,nx1,ny1,nx2,ny2 to copy it over, then just use get image to get the smaller image

pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 2nd Jul 2009 06:23 Edited at: 2nd Jul 2009 06:23
the problem with that is I need to put the piece that I'm taking out back into the original image with the updates on it. Btw isn't get image kinda slow?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 2nd Jul 2009 07:33 Edited at: 2nd Jul 2009 07:35
im not sure, run tests comparing it to ur current solution

so after the image is pasted use delete image to remove the saved image and then get an image in the now vacant slot of the original image

also dont unless you plan to use this many times, go ahead and delete the bitmaps after ur done with em to save memory

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 2nd Jul 2009 11:01
Quote: ". Btw isn't get image kinda slow? "

Yes if you are going to use it repeatedly. So far I haven't been able to find a workaround yet.

Dll maybe?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 2nd Jul 2009 17:27 Edited at: 8th Jul 2009 18:35
Quote: "The only problem with it is it runs terribly slow if I repeatedly use it. Is there any way I could get this to run faster? "

You should never have to run it repeatedly. The problem isn't this function's speed, it's your coding method. What exactly are you trying to do with this?
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Jul 2009 16:20
Quote: "Yes if you are going to use it repeatedly. So far I haven't been able to find a workaround yet."

I'm pretty sure MAKE MEMBLOCK FROM BITMAP then MAKE IMAGE FROM MEMBLOCK is faster than GET IMAGE but I haven't tested.

TGC Forum - converting error messages into sarcasm since 2002.
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Jul 2009 21:59
Quote: "but I haven't tested."


surprisingly it isn't... Get image is at least 3 times faster...

TheComet


Make the path of your enemies easier with Waypoint Pro!

Login to post a reply

Server time is: 2024-05-20 12:02:28
Your offset time is: 2024-05-20 12:02:28