Re: Does object graphics have true-color? [message #50458 is a reply to message #50342] |
Fri, 29 September 2006 13:44  |
yy
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
Rick Towler wrote:
> Object graphics on a
>
> yy wrote:
>> In direct graphics, I can use the following to define my own colors:
>> cc=0.99*tanh((findgen(ncolors)/30-4.)/2.)/2+0.5
>> plots,[0,u],[0,v],[0,w], /t3d, $
>> color=256.^2*B(cc(c)*255.)+256.*G(cc(c)*255.)+R(cc(c)*255.)
>
> ummm. o.k.
>
>> Can I do the same thing in object graphics?
>> Does SetRGB in IDLgrPalette work in the
>> same way? Thank you!
>
> Unless you specify otherwise, object graphics uses an RGB color model so
> you can define your colors however you wish. You'll probably find it
> easier to simply define your colors as an RGB triplet instead of as an
> index into a palette.
>
> myPlot = OBJ_NEW('IDLgrPlot', FINDGEN(360), $
> SIN(FINDGEN(360)*!DTOR)*!RADEG, COLOR=[255,100,50]
> myModel = OBJ_NEW('IDLgrModel')
> myModel -> Add, myPlot
> XOBJVIEW, myModel, /BLOCK
> OBJ_DESTROY, myModel
>
>
> -Rick
I tried to use color to visualize the phase and intensity of a field by
the following definition:
; Define RGB value of the palette
red = phase*Intensity
green = (255-phase)*Intensity
blue = fltarr(128,128)
oPalette = OBJ_NEW('IDLgrPalette', red, green, blue)
; Use the palette to draw the picture
oImage = OBJ_NEW('IDLgrImage', BYTSCL(phase*intensity), $
PALETTE = oPalette)
The purpose of such a definition is: the intensity affects the
brightness of the image, and the phase affects the hue of the
image.
However, I think there is something wrong when I use this palette to
draw my picture. My problem is I don't know how to address the
color map I defined meaningfully. In this case, the data becomes
the multiplication of the phase and intensity, which I don't think
will use the palette correctly. But I don't know how to make this
correct.
Jingyi
|
|
|