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

logical units

jmloriot
Beginner
1,176 Views

On the screen, 

How do I go from "logical coordinates" (function rectangle) to "logical units" (function strectchblt).

thanks for the answer

 

0 Kudos
6 Replies
mecej4
Honored Contributor III
1,149 Views

I have to confess that, in the context of this forum (Fortran programming), I do not understand your question at all!

Is it related to some graphics library or display system?

0 Kudos
jmloriot
Beginner
1,119 Views

HI mecej4

I have the following program

x=100

y=100

i=rectangle($gfillinterior,int2(x),int2(y),int2(x)+100),int2(y)+100)

status=StretchBlt(hdcScreen,x,y,x+100,y+100,hDCCompatibleBitMap,1,1, bmp.bmWidth,bmp.bmHeight,SRCCOPY)

 

When executed on a screen, the upper left corner of the rectangle is not at the same position as the upper left corner of the bitmap image.

And the difference is not the same on different screens.

and I need them to be at the same position on all screens

in the documentation it says

strechtblt : x and y are n "logical units"

rectangle : x and y are in "logical coordinates"

I tried to relate "logical units" to the values of horsize and versize from getdevicecaps,

but so far I have not been able to find how to calculate the x an y in logical units from the values in logical coordinates

Thanks

Jean-Marc

0 Kudos
Arjen_Markus
Honored Contributor I
1,135 Views

In the context of graphical applications, I know of viewports, world coordinates and indeed device coordinates (pixels, if you like). Like mecej4, I have difficulty to understand your question. Could you tell us more about what you are doing? (Note: logical units in the context of Fortran are most often the numbers used to identify open files ...)

0 Kudos
andrew_4619
Honored Contributor II
1,124 Views

In the Windows SDK you would need to look a SetMapMode and GetMapMode as you first need to know what the logical units are.

0 Kudos
GVautier
New Contributor II
1,082 Views

The code may be like that

          hdcCompatibleBitMap=createcompatibledc(hdcScreen)
          oldbmp=selectobject(hdcCompatibleBitMap,hbitmap)
          ibid=getobject(hbitmap,sizeof(bmp),loc(bmp))
          ibid=stretchblt(hdcScreen,x,y,x+100,y+100,
     s                    hdcCompatibleBitMap,0,0,bmp.bmwidth,bmp.bmheight,
     s                    SRCCOPY)
          ibid=deleteobject(selectobject(hdcCompatibleBitMap,oldbmp))
          ibid=deletedc(hdcCompatibleBitMap)
0 Kudos
JohnNichols
Valued Contributor III
1,053 Views

@jmloriot  noted :: And the difference is not the same on different screens.

and I need them to be at the same position on all screens

--------------------------------------------------------------------------------------------------

If your user changes the scaling on the screen -  you can find it in settings, it makes windows forms do erratic things,  I spent most of the weekend fixing a program for this type of problem.  

As for a bitmap, that happens, sometimes you have trouble fixing it.  If you use a scaling technique on a bit map to zoom this is a common - unfixable end result.  

0 Kudos
Reply