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

C / C++ / MFC

 
GeneralRe: webcam implementation in vc++ Pin
Cyberizen12-Dec-04 19:20
Cyberizen12-Dec-04 19:20 
GeneralRe: webcam implementation in vc++ Pin
tspramod12-Dec-04 22:37
tspramod12-Dec-04 22:37 
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 
The mapping mode is a very funny thing in Windows. The thing which Peltzoid has forgotten to mention is that these two calls are mutually exclusive. You use the first or the second, but not both. Also, please forgive me if I am stating the obvious. I've used a very thick iron line in this bending process Smile | :)

Like Peltzoid says, the only thing you can do is determine how the logical points of the device context you draw to refer to the device points of the actual device. In short, how does (0,0) of the DC (which uses logical points) relate to the (0,0) of the actual device. The device point (0,0) is ALWAYS at the upper left hand corner of the device space. It does not change, ever.

For the example's sake, consider you have a window of measures 200 pixel width, 200 pixel heigth. SetViewportOrgEx allows, like stated, you to change the mapping of logical point (0,0) inside the device's space. If you command

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

the logical point (0,0) will refer to device point (100, 100) (cxClient = 200, cxClient/2 = 100) the exact center of the window. This call changed the mapping of logical point (0,0) to the device point(x,y) given as parameters. If you now called MoveTo(0,0) and LineTo(100, 0), the program would draw a horizontal line from the center of the window to the right hand edge.

In the other call, SetWindowOrgEx will allow you change the mapping of the logical point (x,y) inside the device's space. Following the same example, if you call

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

the logical point (-100,-100) (cxClient = 200, -cxClient = -200, -cxClient/2 = -100) will refer to device point (0,0). Doing simple math, where is logical point (0,0) now ? That's correct, in device point (100,100), which in our example is the centre of the window, again. This call changed the mapping of logical point (x,y), given as parameters to device point (0,0). If you used MoveTo(0,0) and LineTo(100, 0), you would again draw a line from the centre to the right hand edge.

The two calls were mutually exclusive: they did precisely the same thing. The changes done by the first one were overwritten with the second call.

Hope this helps you out Smile | :)

-Antti Keskinen

----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"

-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
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 
GeneralRe: Confused by the "Mapping Mode" Pin
PJ Arends12-Dec-04 9:55
professionalPJ Arends12-Dec-04 9:55 

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.