I am wondering there are any tricks to managing the color table in an 8-bit Z buffer. I read "Graphics without Graphics Windows" on the coyote website as well as comments in cgSetColorState. Both indicate why there are problems.
Say I want to create several graphics, each with independent color choices. The last graphic seems to determine how all others will appear. An example is below. I can set the pixel depth to 24 and things work fine. The Pixel depth is 8-bits by default, though, which was making things not working out the way I wanted. Made me curious...
Below is an example.
=============
How It Should Look
=============
;Create window and positions
window, /Free, XSize=400, YSize=600
pos = cgLayout([1,3])
;Create data
data1 = cgDemoData(1)
data2 = cgDemoData(13)
data3 = cgDemoData(21)
;Draw plots and images
cgPlot, data1, AXISCOLOR='Grey', POSITION=pos[*,0], TITLE='Time Series', XTITLE='Time (s)', YTITLE='Data', COLOR='Purple'
cgImage, data2, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Purple'}, POSITION=pos[*,1], TITLE='Hurricane Gilbert', XTITLE='Lat', YTITLE='Lon', CTINDEX=15
cgImage, data3, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Blue'}, POSITION=pos[*,2], TITLE='Red Blood Cells', XTITLE='Height (um)', YTITLE='Length (um)', CTINDEX=3
===========
Z Buffer Example
===========
;Set up the Z Buffer
xsize = 400
ysize = 600
thisDevice = !D.Name
Set_Plot, 'Z'
Device, Get_Pixel_Depth=thisDepth
Device, Set_Pixel_Depth=8, Set_Resolution=[xsize, ysize], Z_Buffer=0
cgErase, 'White'
;Create data
data1 = cgDemoData(1)
data2 = cgDemoData(13)
data3 = cgDemoData(21)
;Create window and positions
window, /Free, XSize=xsize, YSize=ysize
pos = cgLayout([1,3])
;Draw plots and images
cgPlot, data1, AXISCOLOR='Grey', POSITION=pos[*,0], TITLE='Time Series', XTITLE='Time (s)', YTITLE='Data', COLOR='Purple'
cgImage, data2, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Purple'}, POSITION=pos[*,1], TITLE='Hurricane Gilbert', XTITLE='Lat', YTITLE='Lon', CTINDEX=15
cgImage, data3, /NOERASE, /AXES, AXKEY={AXISCOLOR: 'Blue'}, POSITION=pos[*,2], TITLE='Red Blood Cells', XTITLE='Height (um)', YTITLE='Length (um)', CTINDEX=3
;Save the buffer
img = cgSnapShot()
wDelete, !D.Window
;Reset the device
Device, Set_Pixel_Depth=thisDepth, Z_Buffer=1
Set_Plot, thisDevice
;Display the contents of the buffer
window, /Free, XSize=xsize, YSize=ysize
cgImage, img
|