[futurebasic] unexpected palette colours

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2005 : Group Archive : Group : All Groups

From: Victor Maslen <victor.maslen@...>
Date: Thu, 15 Dec 2005 16:53:15 +1100
I am a not-so-young FBI and FBII person who hasn't posted a message 
to the FutureBasic mailing list for some time. However, I continue to 
take an interest in the current postings. I am currently trying to 
find why, in a program designed to mimic the change of colours with 
orientation of an optically variable device somewhat similar to a 
hologram, my colours differ from those found experimentally.  In 
probing this matter, I have written a small test program and I would 
like to discuss the following excerpt.

RESOURCES "TwoColTab.rsrc"
DIM myColourTable&,storeCtable&,myWindow&,myPalette&
myColourTable& = FN GETCTABLE(129)
storeCtable& = FN GETCTABLE(130)
WINDOW #1,"ColourTableTest",(0,0) - (400,400)
myWindow& = WINDOW(_wndPointer)
myPalette& = FN NEWPALETTE(8,myColourTable&,_pmAnimated,0)
pmPointer& = [myPalette&]
numEntries% = pmPointer&.pmEntries%
pmPointer& = pmPointer& + 16
FOR I% = 1 TO numEntries%
   r% = pmPointer&.red%
   g% = pmPointer&.green%
   b% = pmPointer&.blue%
   usage% = pmPointer&.ciusage%
   tolerance% = pmPointer&.citolerance%
   pmPointer& = pmPointer& + 16
NEXT I%

The resource file "TwoColTab.rsrc" contains two colour tables, the 
R,G and B components of which are multiples of 16384.  This was 
created with the use of ResEdit.  Examination of the colour tables 
myColourTable& and storeCTable& indicate that the R,G and B values 
agree with those in the resource file.  However, the situation 
changes when I use FN NEWPALETTE to create a palette from 
MyColourTable&, despite the fact that I have called for a tolerance 
of zero (= exact colour). The changes are the same whether the usage 
is _pmTolerant or _pmAnimated. Typically, an R,G or B value of 32768 
moves to 32896 which, I note, is a multiple of both 257 and of 64. 
Again, 16384 moves to 16448, which is again a multiple of 257 and 64. 
Why is this so?

I would greatly appreciate an explanation of why I am experiencing 
this situation.  Alternatively, reference to somewhere where I might 
place my query would also be welcome

Victor Maslen

 




I

--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...