IDLgrImage drawing performance with IDLgrPalette [message #46224] |
Tue, 08 November 2005 11:05 |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
I stumbled upon this curiosity today and was wondering if I'm doing
something wrong or if this is an "IDL thing" I have found that IDL is
very slow at drawing indexed color images that use palettes to an RGB
device. Or at least it is very slow using my approach. I generally use
true color images so maybe I am missing something... Consider the
following:
pro test_palette
; read some image data, along with palette
imgData = READ_PNG(FILEPATH('africavlc.png', $
SUBDIRECTORY=['examples', 'data']), r, g, b)
imgDims = SIZE(imgData, /DIMENSIONS)
; create the image object w/o a palette and add to a model
oImg = OBJ_NEW('IDLgrImage', imgData)
oMod = OBJ_NEW('IDLgrModel')
oMod -> Add, oImg
; create a view and window
oView = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[0,0,imgDims[0], $
imgDims[1]])
oView -> Add, oMod
oWin = OBJ_NEW('IDLgrWindow', DIMENSIONS=imgDims)
; time drawing this image
t0 = SYSTIME(/SECONDS)
for n=0, 5 do oWin -> Draw, oView
print, SYSTIME(/SECONDS) - t0
; Add a palette to the image object
oPalette = OBJ_NEW('IDLgrPalette', r, g, b)
oImg -> SetProperty, PALETTE=oPalette
; time drawing image with palette
t0 = SYSTIME(/SECONDS)
for n=0, 5 do oWin -> Draw, oView
print, SYSTIME(/SECONDS) - t0
OBJ_DESTROY, [oWin, oView, oMod, oPalette]
end
And the output:
IDL> test_palette
0.00000000
27.626000
I had to cut the iterations down to 5 because I didn't have the patience
to sit thru the second test.
What am I missing?
IDL> print, !version
{ x86 Win32 Windows Microsoft Windows 6.1.1 Oct 11 2004 32 64}
-Rick
|
|
|