Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28441 Discussions

Quickwin graphics: get size of and undo a clipregion

dboggs
New Contributor I
214 Views

I use Quickwin to create a graphics window which is then sent to a 3rd-party routine to draw in. I find, by trial and error, that the routine is unable to use more than the top 1000 pixel rows or so; it rescales the vertical coordinate and apparently sets a clipping region (SETCLIPRGN). For example, if I create the window 800 wide by 1200 high, it creates its picture in the top of my window and leaves an empty strip about 400 pixels high across the bottom. If I want to access this strip, say to add some text below the picture, I have to call SETCLIPRGN to set a new clipping region to the full size of the window. Iow, I want to remove the 3rd party's clip region. Is there a way?

Also, I need to know exactly how high the clip region is. If I draw a line from the upper left to the lower right corner of the window, it will be clipped APPROXIMATELY 400 pixel rows from the bottom, but I only know this by measuring the height of the visible line on the screen. How can I determine programmatically the exact boundary of the clip region? Ideally there would be a routine such as GETCLIPRGN but there is not.

0 Kudos
1 Reply
dboggs
New Contributor I
214 Views

I have found a way to discover the height of the clip region, but it's brute-force cumbersome.

I go to the lower left pixel in the window, and examine its color using GETPIXEL, which returns the color or -1 if it is outside the clip region. So I just move upwards one pixel at a time until the color is > 0; I am then at the first pixel inside the clip region.

It's actually quite simple, but is it the best way? It took me an hour of coding to get here, and I stumbled upon the GETPIXEL routine by accident.

0 Kudos
Reply