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

Q about graphics window setup

WSinc
New Contributor I
789 Views

I have a QUICKWIN graphics setup, where I want the shape of an object to be exact.

For example, if I draw a circle, I want it to come out looking like a circle, not an ellipse.

And a square should look like a square, not a rectangle.

So this means setting up the proper parameters for SETWINDOW.

What is the easiest way to do that ?

0 Kudos
26 Replies
andrew_4619
Honored Contributor II
546 Views

Look at the QuickWin samples in (on my system) C:\Program Files (x86)\Intel\Composer XE\Samples\en_US\Fortran

 

0 Kudos
WSinc
New Contributor I
546 Views

Well, I know how to do the subroutine calls, but

the problem is getting the right parameters, so that i get an accurate portrayal of the geometric figures.

Other than trial and error, of course.

for example:

is the pixel size exactly square?

 

How many pixels are in the default window?

0 Kudos
dboggs
New Contributor I
546 Views

Re aspect ratio problems: I admire your concern, which I share, and note that unfortunately a lot of people (youngsters) nowadays just don't seem to care.

But...have you actually tried it? I do it a lot (Quickwin that is) and never had any trouble--a circle always looked circular, no matter what size my window was. It could possibly be hardware dependent, though (my pixels are square, maybe not yours; just measure one of your windows to find out).

If you have tried it and find that the results are not right, post your code here along with a screen cap and then maybe someone here can help you.

0 Kudos
WSinc
New Contributor I
546 Views

Hi Dale -

Is that your name ? I used to know a Dale Boggs.

anyway, I did try it -

The default pixel allocation is 768 x 1024, a 3 to 4 ratio,

 

so that means with square pixels, my viewport limits should be

that, ratio, i.e. 15 by 20, or 90 by 120, whatever coords I want to use.

 

However, it still is not quite right, so I surmise I dont have "square" pixels.

I probably should just get a tape measuare, and see what the correction has to be.

 

The Fortran gurus really dont address this issue, unfortunately - - -

0 Kudos
dboggs
New Contributor I
546 Views

Is the aspect ratio of your monitor 4:3? That would be an older, TV-like tube. Most newer monitors are 1.6:1 or 1.78:1. For these, the "normal" resolution would be, e.g., 1680x1050 or 1366x768. But screen resolutions are set by software in the video card driver, not the hardware of your video screen. There is a user-configurable setting for your video card that usually enables quite a range of resolutions, and one of them should match the aspect ratio of your monitor.

My own monitor measures 18.6" wide x 11.6" high, that is an aspect ratio of 1.6. I use it at a resolution of 1680x1050, which is also an aspect ratio of 1.6. Hence, square pixels.

 

0 Kudos
dboggs
New Contributor I
546 Views

p.s. My name is Daryl, not Dale. No, I do not have a brother named Dale. Nor do I have another brother Daryl.

0 Kudos
GVautier
New Contributor II
546 Views
Hello In windows, getting the real display size and aspect ratio is quite impossible. It's only possible to get the resolution of the display mode in pixel and compute the aspect ratio. But you are not sure that the monitor used to display this resolution has "square" pixels ie 4/3 resolution on a 16/9 monitor may be enhanced to a full screen display with pixels deformation. The only way is to allow the user to manually set the real display size to allow the software to compute the exact aspect ratio if the default output is distorted. CAD softwares as Autocad proceed this way to let the user to calibrate the display and optionally allowing exact measurement on screen. .
0 Kudos
WSinc
New Contributor I
546 Views

It appears to be hardware dependent - -

so I guess I have to bring a tape measure with me, and draw a square of say 600 X 600 pixels,

and see how that comes out, and adjust accordingly.

 

Thanks for your suggestions ! !

0 Kudos
Steven_L_Intel1
Employee
546 Views

I agree with Daryl that Windows should take car of this for you if you ask for a square or a circle, with the same dimensions for width and height, you should get that. 

0 Kudos
WSinc
New Contributor I
546 Views

That would be very difficult though -

because we are dependent upon whatever device on the user end being used to display it.

 

The only way around that is to have s "standardized" hardware display, but I dont see why 

we would get that in the near future.

0 Kudos
dboggs
New Contributor I
546 Views

#8: "But you are not sure that the monitor used to display this resolution has "square" pixels ie 4/3 resolution on a 16/9 monitor may be enhanced to a full screen display with pixels deformation."

Quite true, but that's the whole idea I was trying to describe. If you pick a resolution aspect ratio that matches your screen aspect ration, then Windows will not distort the pixels, and they will be square. Then displayed circles will be round and squares will be square.

So Bill can draw a "square" and measure it to see if it really is square, and make an adjustment if he wants. But the result--if the adjustment is hard-coded in his program--will be subject to distortion when others use it on their own screen, or if Bill later makes an adjustment on his screen, or gets a new screen, etc. It is probably better just to manually set a screen resolution that matches the screen shape.

0 Kudos
GVautier
New Contributor II
546 Views
Hello If the precision matters for you, you must allow the user to calibrate the display but the implementation will be more complicated for you especially fo circles. If precision is less important, you can inform your users about the fact that the resolution aspect ratio must match the display aspect ratio in order to avoid deformations.
0 Kudos
LRaim
New Contributor I
546 Views

With reference to some answers. 
​I have never used QUICKWIN but I have application parts which draw graphics in Windows using GDI+ for 2D and OpenGL for 3D (both called from C++), but I have never identified such a problem and a circle is usually a circle. On a screen, pixels introduce 'discontinuous' geometry (and an image is always a bitmap) so a circle with a diameter of 10 pixels cannot appear as drawn with a compass on a paper sheet.  
 

 

 

0 Kudos
WSinc
New Contributor I
546 Views

Well, "pixel" size might even be different for PRINTED documents than

it is for a graphic display device.

For example, if I were going to make a document for a formal presentation.

 

I am wondering if that is defined formally anywhere ?

 

For example, a circle might look like a circle on a graphic display, but

would the aspect ratio be the SAME when I print it out?

 

This was formerly an issue when I worked at JPL - - but maybe some standardization

has taken place since then. The actual number of pixels would be consistent of course,

so the issue is:  "How big is a pixel?"

0 Kudos
Steven_L_Intel1
Employee
546 Views

You shouldn't have to worry about the shape of a pixel. 

0 Kudos
WSinc
New Contributor I
546 Views

As far as I know, that is not standardized.

 

If it is, it would be nice to see some reference literature.

0 Kudos
andrew_4619
Honored Contributor II
546 Views

A pixel is a 'point' not a shape. The pixel per inch In X and Y are what are important not the pixel shape.

0 Kudos
WSinc
New Contributor I
546 Views

Well, then then X and Y pixels per inch have not been defined anywhere,

unless that is hardware dependent.

On a digital movie screen, one pixel would take up a good fraction of

an inch, I assume.

And it isnt even certain that the X and Y ratios are the same.

One would have to know that, to assure that the aspect ratio is correct.

Otherwise a 500 x 500 square would not have the right dimensions, for example.

 

0 Kudos
Steven_L_Intel1
Employee
546 Views

You said earlier that you want the "shape" to be exact. Now you want the dimensions to be exact? That's a lot harder, because Windows doesn't know the physical dimensions of the display, only the number of pixels in X and Y. Unless there's something seriously wrong with the display, if you draw a circle it should be a circle.

0 Kudos
WSinc
New Contributor I
583 Views

Well, when I draw a 600 x 600 square, on the screen, 

it does not quite come out right.

Off by about 10 per cent.

0 Kudos
Reply