High Colour graphics

Anything QL Software or Programming Related.
Post Reply
User avatar
Andrew
QL Wafer Drive
Posts: 1047
Joined: Tue Jul 17, 2018 9:10 pm

High Colour graphics

Post by Andrew »

How can I convert a mode 16 (8 bits per pixel) or a mode 32 image to mode 33?
Both modes are 16 bits/pixel, but the actual value of the colour is different.


User avatar
pjw
QL Wafer Drive
Posts: 1626
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: High Colour graphics

Post by pjw »

I think you wrote somewhere that youd downloaded and studied all my code from Knoware. If that is the case you will have a toolkit called CV2NAT, which may do all you require. There are other toolkits too you may find useful: MBLK to move graphics data around, and some of the SBASIC routines to convert PICs to SPR and vice versa, as they show something of the layout of these structures, and padding and the like.


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
tofro
Font of All Knowledge
Posts: 3132
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: High Colour graphics

Post by tofro »

Just for completeness if you want to write something yourself:

I am (as always) a bit confused with mode designations. Looking into the Aurora technical guide names a MODE 16 with two pixels/byte (i.e. 16 colours), and names the 256-colour-mode MODE 256 (1 pixel/byte, with a complex calculation for the least significant bits). I have been (just like you) assuming up to now MODE 16 would be 256 colours. Maybe someone with an Aurora can clarify what is the truth.

For MODE 32 bit assignments are a bit weird (probably due to Intel byte order): (A pixel is one 16-bit word)

GGGBBBBBRRRRRGGG

(the most significant G bits are the ones at the end [G5-G3]!)

And for MODE 33 they look a bit more friendly: (A pixel is one 16-bit word)

BBBBBRRRRRGGGGGG


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
BSJR
Trump Card
Posts: 222
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: High Colour graphics

Post by BSJR »

Andrew wrote: Fri Jul 26, 2024 7:18 pm How can I convert a mode 16 (8 bits per pixel) or a mode 32 image to mode 33?
Both modes are 16 bits/pixel, but the actual value of the colour is different.
There is also the BMP program on Dilwyn site that has translate options for BMP, SCR or PIC files to and from any QL or GD2 mode. As a Viewer it converts anything into the current native mode (4 or High Colour) on the fly.
https://dilwyn.theqlforum.com/graphics/index.html

BSJR


User avatar
pjw
QL Wafer Drive
Posts: 1626
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: High Colour graphics

Post by pjw »

My assumption was that Andrew wanted to convert between formats on the fly, in which case CV2NAT - or some self-made routine would fit the bill. The included source code could be useful in the latter respect. In Wman2 for GD2 systems, there are already built-in routines to convert standard sprites of all modes into native GD2 sprites. One might also be able to make use of that..

If just a one-off conversion is wanted then, clearly, one of the viewers/converters such as BMP, QV or others would be better.

BSJR, I always intended to write something nice here about BMP ;) but life got in the way and I forgot. Sorry.


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
pjw
QL Wafer Drive
Posts: 1626
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: High Colour graphics

Post by pjw »

tofro wrote: Sat Jul 27, 2024 10:49 am <>
I am (as always) a bit confused with mode designations. Looking into the Aurora technical guide names a MODE 16 with two pixels/byte (i.e. 16 colours), and names the 256-colour-mode MODE 256 (1 pixel/byte, with a complex calculation for the least significant bits). I have been (just like you) assuming up to now MODE 16 would be 256 colours. Maybe someone with an Aurora can clarify what is the truth.
<>
In GD2 parlance mode 16 is 1 byte/pixel, ie 256 colours, grbgrbgx. I dont think I ever found a satisfactory conversion routine that would accurately convert between the other modes and mode 16, so I ended up using a lookup table instead. Others may have had better success.

As for the Aurora mode 16 you mention (1 byte/2 pixels) I never encountered it. Perhaps it has been superseded? These are the current official GD2 mode designations (for sprites, at least):

Code: Select all

        0       1 bit black&white
        3       1 bit palette mapped
        4       2 bit fixed gr palette
        7       2 bit palette mapped
        8       4 bit fixed irgb palette
        15      4 bit palette mapped
        16      8 bit fixed palette (equals Aurora palette)
        31      8 bit palette mapped
        32      16 bit QPC/QXL %gggbbbbbrrrrrggg format
        33      16 bit Q40 %gggggrrrrrbbbbbw format
        64      32 bit $RRGGBB00 format


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
tofro
Font of All Knowledge
Posts: 3132
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: High Colour graphics

Post by tofro »

pjw wrote: Sat Jul 27, 2024 1:53 pm As for the Aurora mode 16 you mention (1 byte/2 pixels) I never encountered it. Perhaps it has been superseded? These are the current official GD2 mode designations (for sprites, at least):
On second thought, I think the Aurora hardware seems to implement it, but there never weren't any drivers for it. Likely Nasta would know.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
BSJR
Trump Card
Posts: 222
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: High Colour graphics

Post by BSJR »

tofro wrote: Sat Jul 27, 2024 2:08 pm
pjw wrote: Sat Jul 27, 2024 1:53 pm As for the Aurora mode 16 you mention (1 byte/2 pixels) I never encountered it. Perhaps it has been superseded? These are the current official GD2 mode designations (for sprites, at least):
On second thought, I think the Aurora hardware seems to implement it, but there never weren't any drivers for it. Likely Nasta would know.
I assume some colour modes were proposed in '96 for Aurora that were never finalised in any drivers.
When the new GD2 standard was set in '98, the mode 16 was the same as mode 256 intended for Aurora, hence the confusion.

The GD2 Sprite modes 8 & 15 do use 1 byte for 2 pixels but like some other modes (1,3,4,7,31) they have not been seen in the wild yet. I have been experimenting with them and as Sprites they do work in SMSQ/E.

BSJR


Post Reply