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 / Brighten Bitmaps

Author
Message
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 10th Dec 2008 13:45
Hey Guys!

So, is there a way to brighten bitmaps? You can darken them with "Fade Bitmap", but is there a way to do the opposite?

TheComet

Peachy, and the Chaos of the Gems

Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 10th Dec 2008 15:53
The only way I can think of doing that is to load the bitmap into memblock or something, modify the pixels individualy and load it back.

Latch gave me some help when I wanted to change a color to another. Here the link to that thread.
http://forum.thegamecreators.com/?m=forum_view&t=140993&b=10

Instead of changing one color to another you can check each color and increase it's value to make it brighter.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 10th Dec 2008 16:57
@TheComet
Try the SET GAMMA command. This will brighten everything.



Enjoy your day.
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 11th Dec 2008 08:20
Cool, thanks! I will try it out tonight.

TheComet

Peachy, and the Chaos of the Gems

Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 11th Dec 2008 11:06 Edited at: 11th Dec 2008 22:07
@The Comet
I haven't really used the Bitmap to memblock commands yet, so I may have one or two of the parameters the wrong way round, but I think this might be useful for you:


There are four variables involved which you'll need to set, they're listed at the top of the code snippet.

MemNo and BitmapNo are the memblock to be created and the bitmap to be modified. Bitmap Header Size is the offset in bytes of the bitmap memblock (can't remember off the top of my head how big it is, but I think it's 8.) We then have BrightenAmount, which is any number between 0 and 255. A value of 0 will leave the image unchanged, a value of 255 will make the whole image go completely white.

I'm not sure how versatile this code snippet is, but it'll work with an RGB 24-bit bitmap.

Hope this helps!

[Edit] Just corrected a flaw in the code - I called "Read Memblock Byte" and it ought to have been "Memblock Byte".

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Dec 2008 23:55
Quote: "Try the SET GAMMA command. This will brighten everything"


Bear in mind though that setting the gamma only alters the RGB values on your monitor, and therefore only what you are seeing - NOT the actual data in the image you are viewing at the time.

If you were to save the brighter image you see onto disk, you wouldn't be saving anything different.

TDK

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Dec 2008 00:09
Quote: "If you were to save the brighter image you see onto disk, you wouldn't be saving anything different."

Not even if you saved bitmap 0?

A small program that works is better than a large one that doesn't.

DBC Challenge Rank: Rookie
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 18th Dec 2008 07:30
Wow, robert, that was cool! It didn`t work at the start, but you showed me the concept and I use TDK`s old code to import a bitmap and edit each pixel. It ran a bit slower than memblocks, but it worked!

Thanks everyone!

TheComet

Peachy, and the Chaos of the Gems

Login to post a reply

Server time is: 2025-06-07 20:52:18
Your offset time is: 2025-06-07 20:52:18