IDLgrPalette woes [message #48099] |
Tue, 28 March 2006 14:28  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
Hi Everyone,
What happens when you leave IDL programming for a few months and then
try to jump back into it? Well, the results aren't pretty. Hopefully
some of you will have the mental oil needed to make these IDL gears turn
again.
I simply want to display an image in living color using Object Graphics.
However, when I change the palette associated with the image, my image
goes all white. If I leave the palette alone (or load color table 0) I
will see the standard gray-scale colors. The following code demonstrates:
; Set up objects
window = obj_new('IDLgrWindow', DIMENSIONS = [100, 100])
view = obj_new('IDLgrView', VIEWPLANE_RECT = [0, 0, 100, 100])
model = obj_new('IDLgrModel')
image = obj_new('IDLgrImage', bytscl(dist(100)))
palette = obj_new('IDLgrPalette')
view -> add, model
model -> add, image
image -> setProperty, PALETTE = palette
; Load color table and display
palette -> LoadCT, 0
window -> draw, view
; At this point, the pattern looks as it should.
; Load a nice colorful table and display
palette -> LoadCT, 39
window -> draw, view
; Ack!! The entire plot is white. Where's the image?!
Further investigation has shown that I get this "whiteout" ANY time I
set the color table to a value other than 0. I also get this same
effect if I set any of red_values, green_values or blue_values of the
IDLgrPalette explicitly. I just want to add a little color to my plots,
but I can't for the life of me figure this one out.
-Mike
|
|
|