- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On the screen,
How do I go from "logical coordinates" (function rectangle) to "logical units" (function strectchblt).
thanks for the answer
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 ...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the Windows SDK you would need to look a SetMapMode and GetMapMode as you first need to know what the logical units are.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page