Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: webcam implementation in vc++ Pin
Antti Keskinen12-Dec-04 23:27
Antti Keskinen12-Dec-04 23:27 
GeneralRe: webcam implementation in vc++ Pin
Cyberizen13-Dec-04 5:30
Cyberizen13-Dec-04 5:30 
GeneralRe: webcam implementation in vc++ Pin
Antti Keskinen13-Dec-04 7:46
Antti Keskinen13-Dec-04 7:46 
GeneralRe: webcam implementation in vc++ Pin
tspramod13-Dec-04 20:04
tspramod13-Dec-04 20:04 
GeneralConfused by the "Mapping Mode" Pin
LiYS12-Dec-04 17:07
LiYS12-Dec-04 17:07 
GeneralRe: Confused by the "Mapping Mode" Pin
Antti Keskinen12-Dec-04 22:51
Antti Keskinen12-Dec-04 22:51 
QuestionHow to create a dialog like this? Pin
Arcrest12-Dec-04 15:26
Arcrest12-Dec-04 15:26 
AnswerRe: How to create a dialog like this? Pin
Prakash Nadar12-Dec-04 17:21
Prakash Nadar12-Dec-04 17:21 
GeneralRe: How to create a dialog like this? Pin
Arcrest13-Dec-04 17:22
Arcrest13-Dec-04 17:22 
Questiondefinition file? Pin
nm_11412-Dec-04 11:48
nm_11412-Dec-04 11:48 
AnswerRe: definition file? Pin
Jack Puppy12-Dec-04 13:38
Jack Puppy12-Dec-04 13:38 
AnswerRe: definition file? Pin
bmzhao12-Dec-04 14:18
bmzhao12-Dec-04 14:18 
Generaltable like structure(multiple collumns) Pin
Spiritofamerica12-Dec-04 9:46
Spiritofamerica12-Dec-04 9:46 
GeneralRe: table like structure(multiple collumns) Pin
PJ Arends12-Dec-04 10:17
professionalPJ Arends12-Dec-04 10:17 
GeneralRe: table like structure(multiple collumns) Pin
lisoft12-Dec-04 13:55
lisoft12-Dec-04 13:55 
GeneralRe: table like structure(multiple collumns) Pin
bmzhao12-Dec-04 14:11
bmzhao12-Dec-04 14:11 
GeneralCEdit select text highlight Pin
Anonymous12-Dec-04 8:26
Anonymous12-Dec-04 8:26 
GeneralRe: CEdit select text highlight Pin
PJ Arends12-Dec-04 9:14
professionalPJ Arends12-Dec-04 9:14 
QuestionCannot ever open fstream object in DLL? Pin
registering12-Dec-04 8:23
registering12-Dec-04 8:23 
AnswerRe: Cannot ever open fstream object in DLL? Pin
bmzhao12-Dec-04 14:04
bmzhao12-Dec-04 14:04 
GeneralRe: Cannot ever open fstream object in DLL? Pin
registering12-Dec-04 14:31
registering12-Dec-04 14:31 
GeneralConfused by the "Mapping Mode" Pin
LiYS12-Dec-04 4:41
LiYS12-Dec-04 4:41 
Hi all:
Recently I've been reading Charles Petzold's Programming Windows, but in the The GDI Mapping Mode chapter I encounter a few sentences for which I think they're contradict with each other. I'm sure It just because I'm just don't fully understand the priciple in it. But, for now it really confused me. So I  hope if someone had readed this book or have a understanding about Mapping Mode can show me the way! The following is the excerpt for the book that confused me!
*********************************************************
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.
For instance, suppose your client area is cxClient pixels wide and cyClient pixels high. If you want to define the logical point (0, 0) to be the center of the client area, you can do so by calling


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

The arguments to SetViewportOrgEx are always in terms of device units. The logical point (0, 0) will now be mapped to the device point (cxClient / 2, cyClient / 2). Now you can use your client area as if it had the coordinate system shown below.

00-y0|
00000|
0-----|----+x
00-x0|
00000|+y
(the origin shifted to the center, sorry for the zero because without them the coordinate will not be look like coordinate)


The logical x-axis ranges from -cxClient/2 to +cxClient/2, and the logical y-axis ranges from -cyClient/2 to +cyClient/2. The lower right corner of the client area is the logical point (cxClient/2, cyClient/2). If you want to display text starting at the upper left corner of the client area, which is the device point (0, 0), you need to use negative coordinates:


TextOut (hdc, -cxClient / 2, -cyClient / 2, "Hello", 5) ;

You can achieve the same result with SetWindowOrgEx as you did when you used SetViewportOrgEx:


SetWindowOrgEx (hdc, -cxClient / 2, -cyClient / 2, NULL) ;//ok know problem, the (-cxClient / 2, -cyClient / 2) is changed to the device point (0,0), I understand that

The arguments to SetWindowOrgEx are always in terms of logical units. After this call, the logical point (-cxClient / 2, -cyClient / 2) is mapped to the device point (0, 0), the upper left corner of the client area.

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) ;
//from what I'm understanding, after the logical point (0,0) mapped to veiwport center the SetWindowOrgEx (...) will make the point already in the upper left corner mapped to the device point (0,0) which is also at left corner (0,0)

This means that the logical point (-cxClient/2, -cyClient/2) is mapped to the device point (cxClient/2, cyClient/2), giving you a coordinate system that looks like this:




00000000000000-y|
0000000000000000|
00000000000-x-----|
(the origin shifted to the lower right corner, but I think it should be at the upper left corner, why why why?)

I don't know how's the origin shifted to lower right corner. given that If you change the window origin to (xWinOrg, yWinOrg), the logical point (xWinOrg, yWinOrg) will be mapped to the device point (0, 0)
I think the origin will shifted to the upper left corner.
Beside if you change the window origin to (xWinOrg, yWinOrg), the logical point (xWinOrg, yWinOrg) will be mapped to the device point (0, 0), then I think It will be no matters regarding how you specify you window origin because It always be shifted to device point (0,0) which is upper left corner and it contradict with the second picture.
GeneralRe: Confused by the "Mapping Mode" Pin
PJ Arends12-Dec-04 9:55
professionalPJ Arends12-Dec-04 9:55 
GeneralPrinting Output Pin
BRIMID12-Dec-04 4:14
BRIMID12-Dec-04 4:14 
GeneralRe: Printing Output Pin
PJ Arends12-Dec-04 9:31
professionalPJ Arends12-Dec-04 9:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.