Showing bitmaps

Hello,

I have a question for all you graphics programmers out there:

Situation:
Linux OS with framebuffer device - 320x240 8bpp. Console application (no
SDL yet:() tries to draw two bitmap images pixel by pixel to the
framebuffer. The final result is that colors on first image are corrupt,
when I write the colors from second image to the framebuffer palette.

Procedure:
read bmp1
set color palette from bmp1
draw bmp1
read bmp2
set color palette from bmp2
draw bmp2

How can one display several 8 bpp BMP images on screen so that they all
retain its correct colors?

Thank you,
Hinko–
?ETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: @Hinko_Kocevar
Http: www.cetrtapot.si

If I understand you correctly you want multiple bmps on the screen at the
same time and your screen resolution is 8bpp? If that is the case you will
need to pre-process your bmp files so they all have a common palette.

Ken Rogoway
Homebrew Software
http://www.homebrewsoftware.com/> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of hinko.kocevar at cetrtapot.si
Sent: Thursday, April 03, 2008 6:49 AM
To: sdl at lists.libsdl.org
Subject: [SDL] showing bitmaps

Hello,

I have a question for all you graphics programmers out there:

Situation:
Linux OS with framebuffer device - 320x240 8bpp. Console application (no SDL
yet:() tries to draw two bitmap images pixel by pixel to the framebuffer.
The final result is that colors on first image are corrupt, when I write the
colors from second image to the framebuffer palette.

Procedure:
read bmp1
set color palette from bmp1
draw bmp1
read bmp2
set color palette from bmp2
draw bmp2

How can one display several 8 bpp BMP images on screen so that they all
retain its correct colors?

Thank you,
Hinko


CETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: hinko.kocevar at cetrtapot.si
Http: www.cetrtapot.si


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.5/1356 - Release Date: 4/2/2008
4:14 PM

No virus found in this outgoing message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.5/1356 - Release Date: 4/2/2008
4:14 PM

Ken Rogoway wrote:

If I understand you correctly you want multiple bmps on the screen at the
same time and your screen resolution is 8bpp?

Correct.

If that is the case you will

need to pre-process your bmp files so they all have a common palette.

I see. I was afraid of that.

Thank you.

Regards,
Hinko–
?ETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: @Hinko_Kocevar
Http: www.cetrtapot.si

Quoting “hinko.kocevar at cetrtapot.si” <hinko.kocevar at cetrtapot.si>:

Ken Rogoway wrote:

If I understand you correctly you want multiple bmps on the screen at the
same time and your screen resolution is 8bpp?

Correct.

If that is the case you will

need to pre-process your bmp files so they all have a common palette.

I see. I was afraid of that.

i have similar issues creating a low colour version of my game using the
existing high colour gfx png’s.

if the surface is 8bit then all images have to share the same pallette as the
screen surface to display images, good dithering when converting can produce
effective results, but i think just converting them to bmp is a bit of a slack
ware way of making sure they work ok.

i have attempted this… ( and failed )

  1. get a base pallette image (8bit), load it and use its pallete to then load
    all other pngs into 8 bit surface

  2. use imagemajic to convert all my high colour images using a base pallette (
    means duplicate gfx and might as well be to bmp )

  3. load all my pngs into 32 bit surfaces then convert them to 8bit surfaces
    using a specified pallete. ( same as 1 ? ?!? )

dont have the code to hand on how i tried this, but i’m sure it was very, very
wrong…