comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » TV oddities
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
TV oddities [message #16167] Thu, 01 July 1999 00:00
Axel vom Endt is currently offline  Axel vom Endt
Messages: 9
Registered: March 1999
Junior Member
Hi,

I just ran into some odd behaviour with TVing an array to the PostScript
device. I get an additional column in color 255 on the right side of the
image. No problem occurs if the number of columns is even or the
X-Window evice is used.

I haven't found this on dejanews, so I thought it might be interesting.

The problem can be seen in the following piece of code:

-- cut here ---
; some test data
image = [$
[ 255B, 130B, 144B],$
[ 102B, 0B, 124B],$
[ 9B, 35B, 31B],$
[ 41B, 66B, 0B] ]

; set the plot position and ranges
position = [0.1, 0.1, 0.9, 0.9]
xsize = (position[2] - position[0]) * !D.X_VSize
ysize = (position[3] - position[1]) * !D.Y_VSize
xstart = position[0] * !D.X_VSize
ystart = position[1] * !D.Y_VSize

; use an inverted color table (otherwise the extra column would be
white...)
Loadct, 0
Tvlct, r, g, b, /GET
Tvlct, Reverse(r), Reverse(g), Reverse(b)

IF !D.NAME EQ 'PS' THEN DEVICE, Filename='test.ps', /Landscape, /Color

; plot the image, odd number of pixels in x
IF !D.NAME EQ 'PS' THEN $
TV, image, xstart, ystart, XSize=xsize, YSize=ysize $
ELSE $
TV, Congrid(image, xsize, ysize), xstart, ystart
Plot, [1], /nodata, /noerase, position=position, color=255,
title='wrong', $
xstyle=1, xrange=[0, (size(image))[1]], $
ystyle=1, yrange=[0, (size(image))[2]]

IF !D.NAME EQ 'PS' THEN Erase ELSE Window, 1

; skip the last column -> even number of pixels in x
image = image[0:(size(image))[1]-2, *]

IF !D.NAME EQ 'PS' THEN $
TV, image, xstart, ystart, XSize=xsize, YSize=ysize $
ELSE $
TV, Congrid(image, xsize, ysize), xstart, ystart
Plot, [1], /nodata, /noerase, position=position, color=255,
title='right', $
xstyle=1, xrange=[0, (size(image))[1]], $
ystyle=1, yrange=[0, (size(image))[2]]

IF !D.NAME EQ 'PS' THEN DEVICE, /Close

END
-- cut here ---
[Message index]
 
Read Message
Previous Topic: Re: xwindow question
Next Topic: More problems with singular value decomposition

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 10:50:28 PDT 2025

Total time taken to generate the page: 1.36133 seconds