fang041797
asked on
Logic and Device coordinates
When I read Macrosoft Visual C++ Tutorials,
I found something I could not understand in the sample
"Scribble".
IF someone can help me with it I will be greatly appreciated.
There is a update() function designed, for efficience, when the user
draws a stoke in the view, this function will get the rectangle of
that stroke, and call CClienDC's LPtoDP() function, meanwhile sent
the rectangle (CRect) as the area needed to be update.
Then call InvalidateRect(..) to invalidate that rectangle.
Since the area on the screan is device context, so I understand
before invalidation the coordinates of rectangle need to be translated
from logic coordinates(read from file) to device coordinates.
The part I don't understand is that in the view's onDraw(CDC* ),
what the program codes in tutorials do is firstly using
CDC::GetClipBox(&rectClip)
CDC::LPtoDP(&rectClip).
According to my understanding, before the invalid(need to be updated)
area is sent the coordinats are conversed from LP to DP, later after
calling CDC::GetClipBox(&rectClip)
of rectClip( a rectangle) should also be device coordinates, why the
program has to call LPtoDP again to translate.
Are the coordinates changed back after the invalidation so when
the GetClipBox() is called the coordinates of that clip area still
has logic coordinates ?
Thanks a lot in advance,
Fang
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.