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.

Dark GDK / Weird memblock nooby problem (bug?)

Author
Message
Fatal Berserker
14
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 7th Sep 2010 09:04 Edited at: 7th Sep 2010 09:07
Hi, i decided to look at memblocks as i want to start up dbpro again from a long break doing websites, so i start to look in the documentation for commands to use, and i look around on the forums for tutorials.
However,
When i try loading an image, turning it into a memblock then turning that memblock back into an image and pasting the image, i get a different result (like Chinese whispers lol).

This is my code:



The result is:


The image on the right is how it is in the original file, and the image on the left is how it is after it has been saved into a memblock, and for the life of me i cant figure out why its different.

Thanks in advanced.

PS. Its in a loop because i was going to try and edit the pixels realtime.

Smoke me a kipper, ill be back for breakfast.

Attachments

Login to view attachments
marlou
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 7th Sep 2010 11:10
Use dbLoadImageEx instead of dbLoadImage.

The bottom half was chopped off then the image resized.

When you want to convert images to memblocks always load the images using dbLoadImageEx instead of dbLoadImage.

I just guessed the solution when i had the problem some months ago.

When a person has nothing but a dream, can he dare to dream.
Fatal Berserker
14
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 7th Sep 2010 12:23
Quote: "dbLoadImageEx"

Oh ok thankyou, but err, i dont see this in the documentation, is there some newer documentation that i should get or what?

And thanks that works perfectly.

Smoke me a kipper, ill be back for breakfast.
marlou
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 8th Sep 2010 03:34
There's no newer documentation. Just look around the source code and try out some things.
Who knows, maybe you'll find a dbMakeCompleteGameInstantly() function.

When a person has nothing but a dream, can he dare to dream.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 8th Sep 2010 20:59 Edited at: 8th Sep 2010 21:00
You can also try this: dbLoadImage has several versions, if you give it a flag then it will probably load your image correctly. From the help:

Quote: "void dbLoadImage ( char* szFilename, int iImage )
void dbLoadImage ( char* szFilename, int iImage, int iFlag )

A Texture Flag of zero will treat the image as a texture and load to fill a texture surface in memory. A value of one will preserve the image without adding mipmaps, scaling or filtering and so retaining its pixel perfect quality."

Login to post a reply

Server time is: 2024-11-19 18:41:10
Your offset time is: 2024-11-19 18:41:10