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

Home » Public Forums » archive » pixmap problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
pixmap problem [message #36253] Wed, 27 August 2003 12:40 Go to next message
Steve Ready is currently offline  Steve Ready
Messages: 6
Registered: July 2000
Junior Member
Folks,

I am hoping someone can shed some light on this problem.

I am creating a large image in graphics memory with WINDOW,/PIXMAP and
drawing to it using the PLOTS routine. I have discovered that if I specify a
pixmap size larger than a particular value, dependent on the graphics card,
I am able to allocate the graphics memory with no problem but am not able to
draw to it. I have verified this on an WinXP and Win2K machine, both with
32mb graphics cards. Sample demo test code follows with typical output. This
is slightly modified code from RSI website for testing available graphics
memory size. Any clues?

Thanks, Steve

Steve Ready
Sr. Member of the Research Staff
Electronic Materials Lab
Palo Alto Research Center
3333 Coyote Hill Rd.
Palo Alto, CA 94034
Voice: 650-812-4135
FAX: 650-812-4105
Email: ready@parc.com
http://www.parc.com/ready

;*********************************************************** ***
PRO test_pixmap_size

cnt = 40L
increment = 100
off=3000
i = 1

; Catch when the creation of a pixmap
; fails, and report the previous
; pixmap dimensions that succeeded.

CATCH, errStat
IF (errStat NE 0) THEN BEGIN
x = ((i-1)*increment)+off
y = x
PRINT, 'Suggested maximum pixmap size: ', x, ' by ', y
RETURN
ENDIF

; Loop through potential pixmap dimensions.
FOR i=1,cnt DO BEGIN

x = (i*increment)+off
y = (i*increment)+off
print, 'Trying: ', x, ' by ', y

WINDOW, /PIXMAP, /FREE, XSIZE=x, YSIZE=y
plots,[.5,.5],[.5,.5],/normal
print, total(tvrd())
WDELETE, !D.WINDOW

ENDFOR
END
;*********************************************************** ***

Result is:

IDL> test_pixmap_size
Trying: 3100 by 3100
255.000
Trying: 3200 by 3200
255.000
Trying: 3300 by 3300
255.000
Trying: 3400 by 3400
255.000
Trying: 3500 by 3500
0.000000
Trying: 3600 by 3600
0.000000
Trying: 3700 by 3700
0.000000
Trying: 3800 by 3800
0.000000
Trying: 3900 by 3900
0.000000
Trying: 4000 by 4000
0.000000
Trying: 4100 by 4100
0.000000
Trying: 4200 by 4200
0.000000
Trying: 4300 by 4300
0.000000
Trying: 4400 by 4400
0.000000
Trying: 4500 by 4500
0.000000
Trying: 4600 by 4600
0.000000
Trying: 4700 by 4700
0.000000
Trying: 4800 by 4800
0.000000
Trying: 4900 by 4900
Suggested maximum pixmap size: 4800 by 4800
Re: Pixmap problem [message #45312 is a reply to message #36253] Tue, 30 August 2005 13:17 Go to previous message
MA is currently offline  MA
Messages: 15
Registered: August 2005
Junior Member
Thanks David,
I'm going to do that. Way easier. :-)
Re: Pixmap problem [message #45314 is a reply to message #36253] Tue, 30 August 2005 11:39 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
MA writes:

> I'm trying to solve a problem using a pixmap image and would be
> grateful for some advice. I have a plot with ~5500 irregular boxes
> (POLYFILL plot). I want to make the plot clickable, so I can retrieve
> and alter the information associated with each of the boxes. I'd like
> to use a pixmap as a lookup table in which to save a unique index for
> each box. On clicking the plot, I should then be able to find the index
> corresponding to the clicked box by looking at the same pixel in the
> pixmap.
> My problem is the following: I have ~ 5500 boxes (indeces), but
> POLYFILL only accepts color tables (8 bits - maximum of 256 unique
> indeces), or so it seems. Is there any way to get my pixmap image to be
> in 24 bit color, so I can use 3x8 bits to construct my indeces from?
> The 'TrueColor' keyword in 'device, COPY...' should then allow me to
> retrieve the 2x8 bit information. I've been playing around a bit with
> the decomposed setting, but without much luck.

Here is what I would do. I wouldn't use a pixmap. I would
use an integer array the same size as your window:

selectArr = IntArr(!D.X_Size, !D.Y_Size)

I would load your selection array with your polygon "numbers"
like this:

s = Size(selectArr, /Dimensions)
FOR j=0L, NPOLYGONS-1 DO
indices = PolyFillV(xpoly[j], ypoly[j], s[0], s[1])
selectArr[indices] = j
ENDFOR

Then, to find the polygon number, take your location in the
display window and directly access your selection array:

polygonNumber = selectArr[event.x, event.y]

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Reading and Writing Files
Next Topic: CURVEFIT question

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

Current Time: Wed Oct 08 14:56:21 PDT 2025

Total time taken to generate the page: 0.00575 seconds