Allegro and photoshop bmp's

General FreeBASIC programming questions.
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Allegro and photoshop bmp's

Postby Ophelius » Feb 26, 2006 2:01

I'm trying to get Allegro to display a BMP drawn in photoshop. It displays it fine when drawn in Paint. Is it something to do with layers or the palette? Here's my code:

Code: Select all

'$include: "allegro.bi"

#define SCR_W         800
#define SCR_H         600

dim shared VBuffer as BITMAP ptr

allegro_init

install_keyboard()

set_color_depth 16

if (set_gfx_mode(GFX_AUTODETECT, SCR_W, SCR_H, 0, 0) <> 0) then
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0)
      end 1
end if

VBuffer = load_bmp("temp3.bmp",0)

do
   
  poll_keyboard()
      if( key(KEY_ESC) <> 0 )then
       exit do
     end if
     
  clear_bitmap(VBuffer)
 
  vsync()
   
  blit(VBuffer,screen,0,0,0,0,SCR_W,SCR_H)

loop

destroy_bitmap(VBuffer)
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0)
allegro_exit


The image is a 16-bit 800x600 image. Thanks for any help
D.J.Peters
Posts: 8189
Joined: May 28, 2005 3:28
Contact:

Re: Allegro and photoshop bmp's

Postby D.J.Peters » Feb 26, 2006 3:10

Ophelius wrote:The image is a 16-bit 800x600 image. Thanks for any help

Sorry but it seams to be an mistak a bitmap in *.bmp format has 8bit with a color palette or is in RGB 24bit not 16bit.

Joshy
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Postby Ophelius » Feb 26, 2006 3:22

that would explain why it works for images made in Paint, which saves them as 24-bit images. But it still won't work through PS after I converted the image to 24 bit. Anyone else have a clue?
D.J.Peters
Posts: 8189
Joined: May 28, 2005 3:28
Contact:

Postby D.J.Peters » Feb 26, 2006 3:27

Load the saved PS *.bmp in Paint and save it again as 24 bit (without compresion) and use 24 or 32 bit in Allegro too.

Joshy
tunginobi
Posts: 655
Joined: Jan 10, 2006 0:44
Contact:

Postby tunginobi » Feb 26, 2006 3:28

16-bit bitmaps and FreeBASIC are a world of pain. Avoid this combination.

As for Allegro, it's been too long since I last used it, so I can't give you any useful advice in that regard.
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Postby Ophelius » Feb 26, 2006 3:29

oops, works now, thanks

Return to “General”

Who is online

Users browsing this forum: No registered users and 15 guests