RodBird
Feb 24, 2011
=Flushing strategies= //Rod Bird// [[toc]] ---- ==Intro== Flush is a command that perplexes quite a few folks. I hope to clarify its use and help you choose the most appropriate drawing and flushing strategy for your project. The Help File is very clearly worded, as you read this document refresh your mind on each of the noted graphics commands. The main purpose of flush is to preserve the drawn graphics so that they may be redrawn instantly should the program window be minimised or covered by another window. If the graphics have not been flushed you will be looking at a blank white window when it is restored or uncovered. For the more adventurous flush allows multiple graphic scenes to be flicked on and off screen. ==The drawing history past and present== Liberty drawing commands do more than paint pixels on the screen, the drawing commands you issue are stored in memory. The commands are recorded sequentially and grouped together in SEGMENTS. You form a segment by issuing a FLUSH command. Realise that this recording is always on. From the moment the program starts and immediately after a flush command, a new CURRENT SEGMENT is in play. <span style="font-family: Calibri,sans-serif; font-size: 15px; line-height: 17px;">Flushed segments are the past, only they will be restored if the screen is minimized or covered by another window. The current segment is the present, drawing will be lost unless flushed into the past or preserved in another way.</span>. [[code format="vbnet"]] 'code here [[code]] ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Naming and numbering**</span>== <span style="margin: 0px; padding: 0px;">Segments are identified by an ever increasing number. The first segment created will be numbered 1, the next 2 and so on. If we delete segments it makes no difference, the next segment will be numbered one higher than the last. Liberty allows us to establish the number of a segment and store that in an appropriate variable name by issuing a SEGMENT name, command.</span> == == == == ==Managing segments== Segments can be deleted with DELSEGMENT (name), redrawn individually with REDRAW (name) or all remaining undeleted segments redrawn with the command REDRAW. Redraw (name) will paint the named segment to the front of the screen, this appears to change the Z order of the drawing. Redraw will appear to restore the Z order and paint all remaining segments in original order. You can erase all segments by issuing a CLS command. This deletes all segments, and clears the current segment. You can clear the current segment by issuing a DISCARD command. ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Decouple the screen in your mind**</span>== <span style="margin: 0px; padding: 0px;">Only the redraw and cls command have any impact on what you see on the screen, other commands act only on the segments held in memory. Delsegment (name) will have no impact on the screen, discard will have no impact on the screen but the segment (name) will be deleted and the current segment will be wiped clean. Decouple the screen and the drawing history in your mind.</span> ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Memory management**</span>== <span style="margin: 0px; padding: 0px;">It is important to mange segments as they consume memory. Even if you don’t use flush it is important to manage the current segment memory with discard.</span> ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Start with a clean sheet**</span>== When you start, start with a clean sheet, use DISCARD. Think what is in your current segment, think what you have flushed already . You might use CLS if you wanted to start completely fresh. <span style="margin: 0px; padding: 0px;">[[image:scr1.png]][[image:mu1.png]]</span> <span style="margin: 0px; padding: 0px;">Memory use is zero and there are no forgotten drawing commands.</span> ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Third Part Title**</span>== <span style="margin: 0px; padding: 0px;">Text here.</span> ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Third Part Title**</span>== <span style="margin: 0px; padding: 0px;">Text here.</span> ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Third Part Title**</span>== <span style="margin: 0px; padding: 0px;">Text here.</span> ==<span style="font-size: 1.3em; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">**Third Part Title**</span>== <span style="margin: 0px; padding: 0px;">Text here.</span> [[code format="vbnet"]] 'code here [[code]]