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 / [DBP] IMAGEBLOCK example

Author
Message
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 18th Mar 2010 08:03 Edited at: 18th Mar 2010 08:24
DarkBasic Pro

Hi all

Some days ago I was trying to find an easy way to pack files (in this case image files) in a single file, and found a very little information and no examples in the help file of DBPro.

Maximilian told me that with the Enhancements Expansion Pack we can make it easy and fast, and it's real (Yesterday I bought it and I'm waiting to download). But I want to pack only image files, and the IMAGEBLOCK command is enough for me and is included in the image DBPro commands.

Also, I don't want to encrypt the data at this moment. All I want is to hide the images to the mid-level-user eyes and the IMAGEBLOCK command works nice if we use a patch. Thanks to Pixel Paint for his patch contribution!

If it's useful to someone it will be nice.

Ok, there we go.

The example is divided in two projects. The first shows how to create the packed file and the second how to load and use this file. I added the three image files of the example, and the projects are in the post in a rar file to download, but you can use whatever image files you like if you rename to use with this source code whit image_1.jpg, image_2.jpg and image_3.jpg (if the files you use are .jpg files!)

The project files are auto-commented. So, here is the source of the project 1, to create the packed file.



And here the source of project 2. REMEMBER to copy the created file My_file.idt whit project 1 in the proyect 2 folder!




See you.

JavierTF

Attachments

Login to view attachments
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 18th Mar 2010 08:37 Edited at: 18th Mar 2010 08:37
I am sorry, I have forgotten to include DB's version in the title, but I know neither change it nor erase it. Surely the post will be erased...
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Mar 2010 01:18
Usually, yes, but as this is a command I'm looking into for bugs right now, I thought I'd leave it.

Hey, no one said that I have to be totally consistent!

JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 19th Mar 2010 20:27
Thanks!
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 30th Mar 2010 02:56
Nice code !! JavierTF...I`ll keep it down my pillow

cheers.

I'm not a grumpy grandpa
GreenDixy
15
Years of Service
User Offline
Joined: 24th Jul 2008
Location: Toronto
Posted: 2nd Apr 2010 12:37 Edited at: 2nd Apr 2010 12:38
this is cool question can it load/store other files not just images? what i mean is instead of images is there another command to store other files? like a FILEBLOCK

===================
No life, Lots of love, 2 Kids, God save me LOL
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 8th Apr 2010 03:21
Hi unixfr3ak

Sorry! I have been one week without connection...

Nop, this example is only for image files. Take a look to the WRITE FILEBLOCK, READ FILEBLOCK and related to pack/unpack other files.

JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 9th Apr 2010 20:43
Upsss! Thanks Chafari!

luskos
16
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 20th May 2010 14:58 Edited at: 20th May 2010 15:04
Ok i managed to compile your example and all is ok, but is there a way to make my game to load images from the created imageblock only?
Using the imageblock still needs to provide the images.

What exactly is packed in imageblock, ain`t it packing the images?

EDIT: Sorry, it was just as it should be.I was using some wrong imageblock which was strangely just 8bits in size.Thank you anyway, very good snippet!

Where there is a will, there is a way.
I often edit my posts, that`s who i am

Login to post a reply

Server time is: 2024-05-04 01:40:51
Your offset time is: 2024-05-04 01:40:51