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.

Code Snippets / Images + memblocks = magic [DBP / DBC enhanced]

Author
Message
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 23rd Jan 2006 19:51 Edited at: 23rd Jan 2006 19:53
Hello everyone.

As many others, I used to know nothing about memblocks. Since recently, I started diving into the memblock techniques. A couple of weeks ago, I completed a set of functions, that I thought I'd share to the community.

The functions are:
TransImageMemblocks(mem1,mem2,RetMem,TransColor,Range)
mem1 = the top memblock.
mem2 = the bottom memblock.
RetMem = the returned memblock that will be created.
TransColor = the color that should be transparent.
Range = The range that the transparent color can range in.

TransMapImageMemblocks(mem1,map,RetMem)
mem1 = the memblock that has to be edited.
map = the memblock image that contains the greyscales for the transparency.
RetMem = the returned memblock that will be created.

BlendImageMemblocks(mem1,mem2,RetMem, percentage#)
mem1 = the first memblock image.
mem2 = the second memblock image.
RetMem = the returned memblock that will be created.
percentage# = 0 will display the first memblock completely, 100 the second. If you give 50, the returned memblock will be a faded effect.

BlendImageMemblocks(mem1,mem2,RetMem,Map)
mem1 = the top memblock image.
mem2 = the bottom memblock image.
RetMem = the returned memblock that will be created.
Map = the memblock containing the greyscales for blending the images.
This function does the same as a program called ImageTrans

Note: These functions require equally sized memblock images. If the images are not sized equally, an error might occur. To prevent this, use the ResizeImage function:

ResizeImage(nr, FreeMem, NewX, NewY)
nr = the current image number(this has to be a free memblock number!).
FreeMem = the memblock number that is used for temporary data.
--> All memblocks are deleted automatically, the image nr stays.
NewX,NewY = the new size of the image.

And, ofcourse, the code:


---

An example of the BlendImageMemblocks and TransImageMemblocks:



Anyway, if anyone has some cool stuff for images, using memblocks, you're free to post it here!
Ofcourse, you're opinion on this is also welcome...

Greets

Sven B

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Jan 2006 10:46
Nice work And even better for sharing

If anyone wants more info on the technicalities behind memblock images, there are 2 tutorials that also include realtime screen transition examples...

http://members.thegamecreators.com/tutorialcity/html/newsletter_11.html

http://members.thegamecreators.com/tutorialcity/html/newsletter_10.html

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th Jan 2006 16:02
thx! It took a while to figure them out...

I already checked the tutorials you mensioned. Tutorialscity sure is a great site

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Jan 2006 22:10
Yes, I find that working out a memblock effect takes a while, but once you've done it the results are fantastic. Definitely worth putting the effort in

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Feb 2006 12:20
I think it was Kenmo who made an entire image library around the same time I started playing with image memblocks.

I did do some gradient blending effects that let you draw a line to determine how two images blended. I'll have to look for it now.

Here's a link for different conversions you might like.
http://www.easyrgb.com/math.php?MATH=M20#text20


Deadly Night Assassins

Login to post a reply

Server time is: 2024-11-23 07:15:41
Your offset time is: 2024-11-23 07:15:41