The correct way to implement a large scrolled canvas



Hope I can explain this clearly enough! :)

Assume I want to create (say) a vector drawing program allowing the user
to draw shapes on a drawing area that resides within a scrolled window. 

I understand the standard way of doing this (i.e. create a drawing area
of an appropriate size, then insert it in to a scrolled window) but it strikes
me that this is an inefficient way of doing things for a large drawing area,
as the complete drawing area needs to be maintained in memory, even 
though only a small part of it is visible at any time.   This seems to be the
way that most programs of this sort work (for example - dia).

Would it be better to create a small drawing area which is always the same
size of the parent window, then attach scrollbars which (via callbacks)
then *dynamically* draw the required part of the image on the drawing 
area...   If so, are there any examples of this method, as I've not been able 
to find any....

-- 
David J. Singer
doc deadvirgins org uk
"Time flies like an arrow, fruit flies like a banana"




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]