Help me understand the viewport and the window coordinate

Im learning win32 API with "Programming Windows 5th" by Charles Petzold. In the GDI section, im quite confused about the SetViewportOrgEX() and SetWindowOrgEx() when it come into example. Here what the book say:

"Windows provides the functions SetViewportOrgEx and SetWindowOrgEx for changing the viewport and window origins. These functions have the effect of shifting the axes so that the logical point (0, 0) no longer refers to the upper left corner. Generally, you'll use either SetViewportOrgEx or SetWindowOrgEx but not both.

Here's how the functions work: If you change the viewport origin to (xViewOrg, yViewOrg), the logical point (0, 0) will be mapped to the device point (xViewOrg, yViewOrg). If you change the window origin to (xWinOrg, yWinOrg), the logical point (xWinOrg, yWinOrg) will be mapped to the device point (0, 0), which is the upper left corner. Regardless of any changes you make to the window and viewport origins, the device point (0, 0) is always the upper left corner of the client area. "

Here what im confused:

"What you probably don't want to do (unless you know what's going to happen) is to use both function calls together:

SetViewportOrgEx (hdc, cxClient / 2, cyClient / 2, NULL) ;
SetWindowOrgEx (hdc, -cxClient / 2, -cyClient / 2, NULL) ;

This means that the logical point (-cxClient/2, -cyClient/2) is mapped to the device point (cxClient/2, cyClient/2)"

After the first function, the logical point (0,0) is set to the device point, which is the center of the client area, it means that the point (-cxClient / 2, -cyClient / 2) is the upper left corner of the client, right? So the second function sets that logical point to the device point (0,0), which is the upper left corner, not the device point (cxClient/2, cyClient/2). Am i right? please help me clear it.

More detail about this with some figures can be found on this page:
Topic archived. No new replies allowed.