Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Bitmaps
Page 1 of 1

PostPosted: Sat Jan 06, 2001 4:07 pm
by Lomax
Hi all.

I am considering writing a small app which
loads in a bmp file and allows the user to alter the palette of the image and saves the file out again.

Specifically i want to be able to display all the colors the image uses (256 colors or less) and then be able to realtime alter individual colors (which updates each pixel containing those colors in realtime) with some form as slider.

Sounds straighforward on paper, but heres were i am stuck.

When I load in the bmp, how do i read in and then store all the colors in the image?

Using some form of array?

How would I update the image whilst the colors are being updated?

Hopefully I have explained myself well enough, and that someone can give some help and how to go about this.

Thanks

John

PostPosted: Sat Jan 06, 2001 7:19 pm
by ajones
You're going to need to read the bitmap file itself, not just bitblt it to the screen. You'll need to find the format description - I kow it's on the web someplace, but I just did a quick search and can't find a link on my machine - so you'll have to search for it.

When you read the file you'll probably store the RGB values in arrays, and the bitmap itself in another array. It would probably be easier to do the color swapping if you "expanded" the bitmap as you put it in the array. I mean instead of storing three pallet entries in a a byte (the way an 8-bit bitmap is stored in he file) store one pixel per array element - that will make updateing the screen easier (Pike doesn't do this and the bitmasks are ugly). As far as actually just changing the color in the bitmap all you have to do is change the pallet entry - the bitmap just references the entry so that would change the color.

Hmm, if you don't want to do any other editing I'd just copy the file you want to edit to a temp file, then read the pallet. Make any changes wanted right in the temp file then display the changes by bitblt-ing from the temp file. That should all be pretty easy.

Sorry about rambling, hope it makes some sense. Good luck, Tony

PostPosted: Sun Jan 07, 2001 10:11 am
by darwin
I am already in contact with Justin about bmp reading. If you need the BMP format specifications (what tony was searching, I think):
http://www.daubnet.com/formats/BMP.html
This is a very usefull link.

The bmp saves, if it is 8 bit format (or lower) a color table - if it has more colors (24 bit) it is more problematic - but in the bmp format is a value that tells you how many colors it use.
If you work with bmps, you should read the file directly. I am convinced, that this is the best way - especially for 8 bit images - if you read the color values in an integer array, every pixel will need 32 bit - if you don't work in hex mode (what I wouldn't suggest, because it slows down the code). That means, you'll need 4 byte, for each pixel. That is too much for larger images (>200x200).
Justin is working on a BMP reader. Currently I have no time to work out some code... :(

Eike

http://www.strange-phenomenom.de/newp/pocketc.htm

PostPosted: Sun Jan 07, 2001 11:10 am
by Justinespinosa
I have done a bmp reader file. It's not finished yet, you can read only 4-bits and 8-bits bitmaps but if you let me just two hours, i will send you a file with explainations. you will be able to read the palette an d to save it. it's really easy in fact. I've done too a color.pc source code that allows you to store colors in one a pointer and then you can use my functions to set th pen ,brush , text and bk color. i've also made functions that sets the color a little bit darker or a little bit lighter of the selected one, for the one who want to draw 3D shading (like Windows9x buttons ).
send you every thing until 16h (GMT+1)


J.Espinosa

OUTS Softwares

PostPosted: Sun Jan 07, 2001 11:32 am
by Lomax
Thanks you guys. I really only need to deal with 256 colors or less, and dont want any higher support.

Seems much harder than I first thought.
(I am a real newbie :))

Still I am willing to give it a shot.

Justin if you are willing to send me any info (Which would be great)
Please mail them to

john.lomax@totalise.co.uk

Thanks for your help.

John.

PostPosted: Thu Mar 10, 2005 3:38 am
by otakribut1
justin,
can i have a copy of the source code--for this bitmap reading. thank you very much.
my email = otakribut1@yahoo.com