|
-
April 15th, 1999, 12:23 AM
#1
using RectVisible in OnDraw
In my MFC MDI I have come encountered the following problem:
Firstly, my program opens image files, process the data and display it, one row at a time - i.e it processes one row of data and then displays it on screen before processing the next row. The data processing is complex so displaying the whole image takes quiet a bit of time. So as to process only the rows of the image that will be displayed on screen I use RectVisible before processing each row. This saves some time when scrolling up and down, but when I scroll horizontally, all of the image rows visible on the screen need to be redrawn, even though it is only necessary to draw a little bit of the row. So the solution that I'm trying to implement now, is.... (btw, when processing the data, I have to process a whole row at a time, but I can print as much or as little as I like) ..... in OnDraw, I do a RectVisible on the whole row. If I find that the row needs to be redrawn I process the row data, and then I do RectVisible on smaller sections of this row and redraw only the necessary parts.
Could somebody tell me if this is an efficient method? Or could you tell me of another better way?
Thank you,
Sean.
-
April 15th, 1999, 03:22 AM
#2
Re: using RectVisible in OnDraw
You may use CDC::GetClipBox( LPRECT lpRect ) to konw the clipping rectangle. Don't draw outside this rectangle, because it will be clipped. More, if this method returns NULLREGION, don't do anything.
You may also you a Memory DC (see the article about CMemDC on this site).
HTH
K.
Ash to ash and clay to clay, if the enemy doesn't get you, your own folk may.
We're talking ****, 'cause life is a 'biz
You know it is
Everybody tryin' to get rich
God ****!
All I wanna do is live !
KoRn, Children of the Korn
-
April 15th, 1999, 03:44 AM
#3
Re: using RectVisible in OnDraw
Firstly thanks for the reply.
So, do you mean that if Idraw a row of image data to the screen, then when I scroll to the right or left I should use GetClipBox to tell me if a particular part of the row of data was covered(in which case I should redraw it) or uncovered( I should do nothing), or if it stayed the same (I should also do nothing)???
-
April 15th, 1999, 04:01 AM
#4
Re: using RectVisible in OnDraw
It is a generalway of drawing, doesn't matter you was scrolling before. The system tells you what part you should draw. And sometimes, OnDraw is called when nothing is to be drawn. So, don't draw in this case.
K.
Ash to ash and clay to clay, if the enemy doesn't get you, your own folk may.
We're talking ****, 'cause life is a 'biz
You know it is
Everybody tryin' to get rich
God ****!
All I wanna do is live !
KoRn, Children of the Korn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|