log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- WROCC Newsletter Volume 41:11 reviewed (News:)
- WROCC March 2024 meeting o... Hughes and Peter Richmond (News:1)
- Rougol March 2024 meeting on monday with Bernard Boase (News:)
- Drag'n'Drop 13i2 edition reviewed (News:)
- South-West Show 2024 talks (News:4)
- February 2024 News Summary (News:1)
- Next developer fireside chat (News:)
- DDE31d released (News:)
- South-West Show 2024 Report (News:)
- South-West Show 2024 in pictures (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
The Icon Bar: Programming: Palette entry word deciphering
 
  Palette entry word deciphering
  (10:17 11/1/2001)
  Phlamethrower (15:32 11/1/2001)
    andrew (19:55 11/1/2001)
 
andrew Message #4709, posted at 10:17, 11/1/2001
Unregistered user Does there exist a SWI for converting GCOL numbers in palette entry words or does one have to manipulate the bits oneself?

Regards,

Andrew

  ^[ Log in to reply ]
 
Phlamethrower Message #4710, posted at 15:32, 11/1/2001, in reply to message #4709
Unregistered user Goes and consults PRM's....

Presuming what you're doing is getting an RGB value from the palette, then what you need is (unsurprisingly) OS_ReadPalette.

R0=logical colour
R1=type of colour (16=normal, 24=border, 25=pointer)

R2 and R3 will return the different flashing states of the colour, in this format:

Bits 0-6 value showing how colour was programmed
7 Supremacy bit
8-15 Red
16-23 Green
24-31 Blue

If you're after getting RGB from a GCOL value, then the format of GCOL is:

Bits 0-1 Tint bits 0-1
2-3 Red bits 2-3 (Other 2 in tint)
4-5 Green 2-3
6-7 Blue 2-3

If you want to convert a palette entry to GCOL, then use ColourTrans_ReturnGCOL:

R0=Palette entry (&BBGGRR00)
Returns GCOL in R0

To convert GCOL to palette though it looks like you'll have to do it manually. From BASIC (With g as the GCOL and c as the output)

c=((g AND 7)*17*256)+((g AND 3)*17*65536)+((g AND 48)*17*16384*4)+((g AND 3)*17*256*65536)+((g AND 192)*17*16*65536)

And from C:

c=((g & 7)*17*256)+((g & 3)*17*65536)+((g & 48)*17*16384*4)+((g & 3)*17*256*65536)+((g & 192)*17*16*65536)

I haven't tested these though so don't expect them to work.

[Edited by Phlamethrower at 15:33, 11/1/2001]

  ^[ Log in to reply ]
 
andrew Message #4711, posted at 19:55, 11/1/2001, in reply to message #4710
Unregistered user Yes, sorry what I mean is convering to a pallette entry word which is rather different than the GCOL format.
Manual it is, it seems!

Thanks.

  ^[ Log in to reply ]
 

The Icon Bar: Programming: Palette entry word deciphering