Object graphic and direct graphics [message #22477] |
Mon, 20 November 2000 23:55  |
Thomas Launey
Messages: 25 Registered: September 1999
|
Junior Member |
|
|
Hello,
I am using object graphics in a Direct graphic program because I need the
alpha channel for some fancy image manupulation. Basically, I grab
(TVRD(true=3)) the image from a direct graphic window, put it in an
IDLgrImage, do some processing, draw it in a IDLgrBuffer, grab it from
the buffer and TV it to the Direct graphic (Widget_draw). It work fine
for most images but I recently discovered that some particular image
dimensions induce a shift of the image (vertical and/or horizontal).
For me, image dimensions that are roughly multiples of 15 produce the
problem.I wonder if there is a rational explanation for this behavior and
if this can be reproduced on different system, with different IDL
version.
I am using 5.2 on Win95.
Any comment greatly appreciated, I learn more from this newsgroup than
from any documentation. At least until I buy DF's new book ;-)
Thomas Launey
Laboratory for Memory and Learning, Brain Science Institute, RIKEN
Saitama, JAPAN
e-mail: t_launey@brain.riken.go.jp
Below is a simple program that show this strange behavior
; NAME: Test_bug
;
; PURPOSE: Test display problem when moving RGB data between
; Object graphic (OG) and Direct graphics (DG)
; RGB image is grabbed from a DG window, Drawn in IDLgrBuffer
; Then grabbed from buffer and TV-ed back in the DG window.
; Both the original and the grabbed image are displayed.
;
; KEYWORDS: Xsize, Ysize: as it says
; Verbose: display information about objects and RGB images
; OBSERVATIONS:
; For SOME image size, the image is shifted after each grab-paste.
; This shift is observed for values Xsize and/or Ysize of
; [13:15],30,60,[119:126],[238:241],480
;
; IDL Version 5.2 (Win32 x86). Research Systems, Inc.
Pro Test_bug, Xsize=Xsize, ysize=ysize, verbose=verbose
Device, Get_Screen_Size=screenSize
If keyword_set(Xsize) then ImageXsize=Xsize>2 Else
ImageXsize=ScreenSize[0]/10
If keyword_set(Ysize) then ImageYsize=Ysize>2 Else ImageYsize=ImageXsize
obuffer = OBJ_NEW('IDLgrBuffer', DIMENSIONS=[ImageXsize,ImageYsize],
quality=2)
oview = OBJ_NEW('IDLgrView', viewplane_rect=[0,0,ImageXsize,ImageYsize],$
dimensions=[ImageXsize,ImageYsize])
omodel = OBJ_NEW('IDLgrModel')
oimage = OBJ_NEW('IDLgrImage', INTERLEAVE=2)
omodel -> Add, oimage
oview -> Add, omodel
oContainer = Obj_New('IDL_Container')
oContainer->Add, oBuffer
oContainer->Add, oView
oContainer->Add, oModel
oContainer->Add, oimage
loadct,5, /silent ; give some color to the image
savewin=!D.window
Window, /free, xsize=ImageXsize, ysize=ImageYsize, title="original image"
image= BESELJ(SHIFT(DIST(ImageXsize), ImageXsize/2, $
ImageYsize/2)/2, 0)*256
TV, image
Window, /free, xsize=ImageXsize, ysize=ImageYsize, title="test window"
testwin=!d.window
TV, image
Direct_grabbed = TVRD(true=3)
;*** load the grayscale LUT, otherwise strange things happen when TV-ing
; the RGB image.
loadct,0, /silent
For i=0,30 do Begin
;*** set grabbed image as the data in oimage
oimage -> SetProperty, data=Direct_grabbed
oBuffer -> Draw, oview ;*** Draw image into oBuffer
;*** grab image from the graphic buffer object
oBuffer -> GetProperty, image_data=Object_grabbed
;*** true=1 since Object_grabbed is [3,Xsize,Ysize]
tv, Object_grabbed, true=1
;*** grab image from the direct grahic window
Direct_grabbed = TVRD(true=3)
EndFor
If keyword_set(verbose) then begin
Help, Direct_grabbed
Help, Object_grabbed
oview -> GetProperty, All=all
Print, string(10B), "IDLgrView properties"
print, "dimensions: " ,all.dimensions
print, "location: " ,all.location
print, "view_rect: ",all.VIEWPLANE_RECT,string(10B)
obuffer -> GetProperty, All=all
Print, "IDLgrbuffer properties"
print, "dimensions: " ,all.dimensions
print, "screen dim: " ,all.SCREEN_DIMENSIONS
print, "resolution: ",all.resolution
EndIf
obj_destroy, oContainer
wset, savewin
End
|
|
|
Re: Object graphic and direct graphics [message #22599 is a reply to message #22477] |
Tue, 21 November 2000 17:00  |
Thomas Launey
Messages: 25 Registered: September 1999
|
Junior Member |
|
|
Hello,
Thanks for testing the program. I did more testing and it does not seem
to be related to the screen resolution setting... More about this later.
By the way, since it seems that this problem and several others have been
fixed in new IDL version, I am gradually coming to the idea of updating
(5.2 ->5.4). However, several post in this group concerning stability,
new bugs, licensing problems... make me wonder if its really worth the
the paperworks I will have to do for this.
Anyone willing to share his/her experience about updating?
cheers
Thomas Launey
Lab. for Memory and Learning
Brain Science Institute, RIKEN
Saitama, Japan
>> I am using object graphics in a Direct graphic program because I need the
>> alpha channel for some fancy image manupulation. Basically, I grab
>> (TVRD(true=3)) the image from a direct graphic window, put it in an
>> IDLgrImage, do some processing, draw it in a IDLgrBuffer, grab it from
>> the buffer and TV it to the Direct graphic (Widget_draw). It work fine
>> for most images but I recently discovered that some particular image
>> dimensions induce a shift of the image (vertical and/or horizontal).
>> For me, image dimensions that are roughly multiples of 15 produce the
>> problem.I wonder if there is a rational explanation for this behavior and
>> if this can be reproduced on different system, with different IDL
>> version.
>> I am using 5.2 on Win95.
>
> Whatever this problem is, it appears to have disappeared
> in IDL 5.3.1 on WinNT 4.0. The program appears to work
> normally. :-)
>
> Cheers,
>
> David
>
>
--
|
|
|
Re: Object graphic and direct graphics [message #22602 is a reply to message #22599] |
Tue, 21 November 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Rikagaku (t_launey@brain.riken.go.jp) writes:
> Thanks for testing the program. I did more testing and it does not seem
> to be related to the screen resolution setting... More about this later.
> By the way, since it seems that this problem and several others have been
> fixed in new IDL version, I am gradually coming to the idea of updating
> (5.2 ->5.4). However, several post in this group concerning stability,
> new bugs, licensing problems... make me wonder if its really worth the
> the paperworks I will have to do for this.
> Anyone willing to share his/her experience about updating?
Yes, always update. It's always worth it. ... Really. :-)
I don't mean to suggest you should be the first on your
block to update, but I have never, ever thought I would
be better off with an older version of IDL, ever. As a
rule the IDL X.X.1 versions are about as stable as you
are likely to get.
Yes, there are bugs and problems with new versions.
But, most of the time, old bugs are fixed, too.
And that is the *real* value in updating.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: Object graphic and direct graphics [message #22617 is a reply to message #22477] |
Tue, 21 November 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Rikagaku (t_launey@brain.riken.go.jp) writes:
> I am using object graphics in a Direct graphic program because I need the
> alpha channel for some fancy image manupulation. Basically, I grab
> (TVRD(true=3)) the image from a direct graphic window, put it in an
> IDLgrImage, do some processing, draw it in a IDLgrBuffer, grab it from
> the buffer and TV it to the Direct graphic (Widget_draw). It work fine
> for most images but I recently discovered that some particular image
> dimensions induce a shift of the image (vertical and/or horizontal).
> For me, image dimensions that are roughly multiples of 15 produce the
> problem.I wonder if there is a rational explanation for this behavior and
> if this can be reproduced on different system, with different IDL
> version.
> I am using 5.2 on Win95.
Whatever this problem is, it appears to have disappeared
in IDL 5.3.1 on WinNT 4.0. The program appears to work
normally. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|