Color problem on Mac, not Windows - something about 239? [message #17677] |
Tue, 02 November 1999 00:00 |
David Hirsch
Messages: 3 Registered: June 1999
|
Junior Member |
|
|
I'm finding something strange, and I did a brief search of Fanning's site
and the newsgroup archive without success. It only occurs on the Mac, not
on Windows. Here are the symptoms:
I'm trying to use object graphics to display an image, and then change the
display of certain colors by modifying the IDLgrPalette. Specifically, I
want to make certain color values red. This seems to work fine, as long as
the color value I choose is less than or equal to the value 239. If the
value is 240 or greater, then although I've done everything the same, the
displayed color is white, not red.
Here is a program that demonstrates the problem. It should be run on a
grayscale or indexed TIFF image (i.e., m x n pixels), such as the one in
RSI/IDL 5.2/examples/data/examples.tif. If it exhibits the problem, the
square will flash red and white, once per second.
Any help will be greatly appreciated. BTW, I'm on an iMac 233, with
"Millions" of colors.
David Hirsch
========== Problem Demo Program Follows ============
; This demonstrates that the value 239 is somehow special -
; Changes to color table indices greater than 239 do not seem to
; work.
; This behavior is exhibited on the Mac (iMac 233, "Millions" of
; colors), but not on Windows
Pro ColorDemo
Device, Decomposed=0
grayTiffFile = Dialog_Pickfile(/Read, Filter="*.tif")
grayTiff = Read_Tiff(grayTiffFile)
;stretch scale to range to 255
max = Max(grayTiff)
grayTiff = grayTiff * (255/max)
mywindow = OBJ_NEW('IDLgrWindow', DIMENSIONS=[200,200], Color_Model=1)
rval = (gval = (bval = (INDGEN(256))))
myPalette = OBJ_NEW('IDLgrPalette', rval, gval, bval)
myWindow->SetProperty, Palette=myPalette
myview = OBJ_NEW('IDLgrView', View=[0,0,200,200])
mymodel = OBJ_NEW('IDLgrModel')
myimage = OBJ_NEW('IDLgrImage', grayTiff)
myview -> Add, mymodel
mymodel -> Add, myimage
mywindow -> Draw, myview
Wait, 1
i=0
while (i lt 3) do begin
rval = (gval = (bval = (INDGEN(256))))
rval[239] = 255
gval[239] = 0
bval[239] = 0
grayTiff[50:100, 50:100] = 239
Obj_Destroy, myPalette
myPalette = OBJ_NEW('IDLgrPalette', rval, gval, bval)
myImage->SetProperty, Data=grayTiff
myWindow->SetProperty, Palette=myPalette
;Draw to the window:
mywindow -> Draw, myview
Wait, 1
rval = (gval = (bval = (INDGEN(256))))
rval[240] = 255
gval[240] = 0
bval[240] = 0
grayTiff[50:100, 50:100] = 240
Obj_Destroy, myPalette
myPalette = OBJ_NEW('IDLgrPalette', rval, gval, bval)
myImage->SetProperty, Data=grayTiff
myWindow->SetProperty, Palette=myPalette
mywindow -> Draw, myview
Wait, 1
i=i+1
endwhile
Obj_Destroy, myWindow
Obj_Destroy, myview
Obj_Destroy, myPalette
Obj_Destroy, mymodel
Obj_Destroy, myImage
End
|
|
|