Dilwyn Jones wrote:
> It's from the file format for a 24-bit .BMP file. There are routines
> to port BMP to MODE 32 and 33 but not AFAIK to convert mode 32 screens
> to 24-bit PC format.

The BMP format originates from Win16 platforms, so my earlier
explanations regarding sizes don't apply. An int is 16 bit there. Long
however is still 32bit.

> It's to write a routine to convert the screen dumps from Launchpad
> running in MODE 32 so I can use them in an information web page for
> that program.

For the sake of completeness, when running QPC in windows mode you can
just copy the contents of the current window to the clipboard by
pressing ALT+Print.

> Here's the information I have:

> Assuming the QL mode 32 image colour word is at address "addr", I
> think it should convert to 24-bit format as follows:

> blue=8*(PEEK(addr)&&31)
> red =PEEK(addr+1)&&248

Those are 5 bit, i.e. from 0 to 31.

> green=(PEEK(addr)&&224)||((PEEK(addr+1)&&7)*4)
                                             *8
This is 6 bit, i.e. from 0 to 63.

Conversion to 8 bit is needed, of course.

> The .BMP file equivalent long word would then be built as follows:
> POKE bmp_addr,blue
> POKE bmp_addr+1,green
> POKE bmp_addr+2,red
> POKE bmp_addr+3,0 : rem unused but must be 0

IIRC BMP data is 24 bit, i.e. without the 0.

> QL_bytes = pixel_width*pixel_height : REMark width should be even?

Every BMP single screen line must be padded to a 4 byte boundary.

Marcel

Reply via email to