jpg@NRC3D.NRC.UAB.EDU (Jill Gemmill) (06/21/91)
Suppose I want to write a series of images into ONE window, one after another. Now, suppose these images are not all the same size. If the program sees that the next window is a different size, it would be nice to use a "prefsize()" with the new size to reshape the window. So far, it seems that window size is reconfigurable only if there is total freedom ( or total freedom given some fixed aspect ratio) in the new size -- but it's not possible to jump from one fixed size to another. Let's assume we like 1 image data point per pixel as our image mapping strategy, so exclude solutions that call for blowing up pixels to fill the window. My reading of the documentation was that prefsize should be called before winopen() - which disallows any resizing; OR that prefsize should be called after the winopen(), followed by winconstraints(). That approach does not seem to work. Can anyone think of way to do this without closing the window down and opening another one of a different fixed size? ------------------------------------------------------------------------------- Jill Gemmill Neurobiology Research Center INTERNET: jpg@nrc3d.nrc.uab.edu University of Alabama at Birmingham Volker Hall G82E PHONE: 205-934-7111 Birmingham Alabama 35294-0019 FAX: 205-934-6571 -------------------------------------------------------------------------------
dmlaur@phoenix.Princeton.EDU (David M. Laur) (06/22/91)
In article <9106202215.AA06603@nrc3d.nrc.uab.edu> jpg@NRC3D.NRC.UAB.EDU (Jill Gemmill) writes: > My reading of the documentation was that prefsize should be called >before winopen() - which disallows any resizing; OR that prefsize should be >called after the winopen(), followed by winconstraints(). That approach >does not seem to work. > Can anyone think of way to do this without closing the window >down and opening another one of a different fixed size? > voici ... /* -------------------------------------------------------- */ /* * resize a GL window * (if the window manager takes the hint) * to the specified new size (in pixels) * * note: * * - this routine assumes you want the lower-left corner of * the window to stay where it is, other logic is possible * * - windows may not be bigger than the screen (WxH), * although they may extend off the screen. * * - if your image is bigger than the screen (WxH) * you'll have to use a modified arg to lrectwrite; * this is trivial on a VGX using pixmode to set a stride, * but exceedingly painful on other IRIS's * * - for some applications this routine builds a window * which one pixel too big in x and y * * - resizing the window generates a REDRAW event * * * example call (request a 100x100 window): * * winresize( winget(), 100, 100); */ void winresize ( int wid, int width, int height ) { long x,y,w,h, XM, YM; XM = getgdesc(GD_XPMAX); YM = getgdesc(GD_YPMAX); w = (width > XM) ? XM : width; h = (height > YM) ? YM : height; getorigin(&x, &y); winposition(x, x+w, y, y+h); prefsize(w, h); /* re-disallow resize by user */ winconstraints(); /* warning: this will generate a REDRAW event for this window */ } /* -------------------------------------------------------- */