https://wiki.amigaos.net/w/index.php?title=Window_Display_Preservation&feed=atom&action=history Window Display Preservation - Revision history 2024-03-29T02:06:19Z Revision history for this page on the wiki MediaWiki 1.34.0 https://wiki.amigaos.net/w/index.php?title=Window_Display_Preservation&diff=9266&oldid=prev Steven Solie at 20:00, 5 December 2017 2017-12-05T20:00:56Z <p></p> <table class="diff diff-contentalign-left" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 20:00, 5 December 2017</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 102:</td> <td colspan="2" class="diff-lineno">Line 102:</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Allocate a BitMap structure with the Exec AllocMem() function. Then use the graphics function InitBitMap() to initialize the BitMap structure:</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Allocate a BitMap structure with the Exec AllocMem() function. Then use the graphics function InitBitMap() to initialize the BitMap structure:</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID InitBitMap( struct BitMap *bitMap, LONG depth, LONG width, LONG height );</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID InitBitMap( struct BitMap *bitMap, LONG depth, LONG width, LONG height );</div></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;/pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>InitBitMap() fills in fields in the BitMap structure describing how a linear memory area is organized as a series of one or more rectangular bit-planes.</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>InitBitMap() fills in fields in the BitMap structure describing how a linear memory area is organized as a series of one or more rectangular bit-planes.</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 110:</td> <td colspan="2" class="diff-lineno">Line 110:</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once you have allocated and initialized the BitMap structure, use the graphics library function AllocRaster() to allocate the memory space for all the bit planes.</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Once you have allocated and initialized the BitMap structure, use the graphics library function AllocRaster() to allocate the memory space for all the bit planes.</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>PLANEPTR AllocRaster( ULONG width, ULONG height );</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>PLANEPTR AllocRaster( ULONG width, ULONG height );</div></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;/pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The example listed in the next section shows how to allocate a BitMap structure, initialize it with InitBitMap() and use AllocRaster() function to set up memory for the bitplanes.</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The example listed in the next section shows how to allocate a BitMap structure, initialize it with InitBitMap() and use AllocRaster() function to set up memory for the bitplanes.</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 120:</td> <td colspan="2" class="diff-lineno">Line 120:</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The portion of the bitmap showing within a SuperBitMap window is controlled by the application. Initially, the window shows the bitmap starting from its origin (0,0) and clipped to fit within the window layer. The visible portion of the bitmap can be scrolled around within the window using the layers library ScrollLayer() function:</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>The portion of the bitmap showing within a SuperBitMap window is controlled by the application. Initially, the window shows the bitmap starting from its origin (0,0) and clipped to fit within the window layer. The visible portion of the bitmap can be scrolled around within the window using the layers library ScrollLayer() function:</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID ScrollLayer(LONG unused, struct Layer *layer, LONG dx, LONG dy)</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID ScrollLayer(LONG unused, struct Layer *layer, LONG dx, LONG dy)</div></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;/pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Pass this function a pointer to the window's layer in layer and the scroll offsets in dx and dy. (A pointer to the window's layer can be obtained from Window.RPort-&amp;gt;Layer.)</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Pass this function a pointer to the window's layer in layer and the scroll offsets in dx and dy. (A pointer to the window's layer can be obtained from Window.RPort-&amp;gt;Layer.)</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 128:</td> <td colspan="2" class="diff-lineno">Line 128:</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>When rendering operations are performed in a SuperBitMap window, any rendering that falls outside window boundaries is done in the application's bitmap. Rendering that falls within window bounds is done in the screen's bitmap. Before performing an operation such as a save on the application bitmap, the graphics library function SyncSBitMap() should be called:</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>When rendering operations are performed in a SuperBitMap window, any rendering that falls outside window boundaries is done in the application's bitmap. Rendering that falls within window bounds is done in the screen's bitmap. Before performing an operation such as a save on the application bitmap, the graphics library function SyncSBitMap() should be called:</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID SyncSBitMap(struct Layer *layer)</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID SyncSBitMap(struct Layer *layer)</div></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;/pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Pass this function a pointer to the window's layer. SyncSBitMap() copies the window contents to the corresponding part of the application bitmap, bringing it up to date. (If no rendering operations have been performed this call is not necessary.)</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Pass this function a pointer to the window's layer. SyncSBitMap() copies the window contents to the corresponding part of the application bitmap, bringing it up to date. (If no rendering operations have been performed this call is not necessary.)</div></td> </tr> <tr> <td colspan="2" class="diff-lineno">Line 136:</td> <td colspan="2" class="diff-lineno">Line 136:</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Similarly, after making any changes to the application bitmap such as loading a new one, the window's layer should be locked and the CopySBitMap() function should be called.</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Similarly, after making any changes to the application bitmap such as loading a new one, the window's layer should be locked and the CopySBitMap() function should be called.</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID CopySBitMap(struct Layer *)</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>VOID CopySBitMap(struct Layer *)</div></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>&lt;/syntaxhighlight&gt;</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>&lt;/pre&gt;</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This function copies the new information in the appropriate area of the underlying bitmap to the window's layer.</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This function copies the new information in the appropriate area of the underlying bitmap to the window's layer.</div></td> </tr> </table> Steven Solie https://wiki.amigaos.net/w/index.php?title=Window_Display_Preservation&diff=9249&oldid=prev Daniel Jedlicka: SuperBitMap Window Example: code rewritten for OS4 by Doug Stastny 2017-12-03T11:50:19Z <p>SuperBitMap Window Example: code rewritten for OS4 by Doug Stastny</p> <a href="//wiki.amigaos.net/w/index.php?title=Window_Display_Preservation&amp;diff=9249&amp;oldid=7473">Show changes</a> Daniel Jedlicka https://wiki.amigaos.net/w/index.php?title=Window_Display_Preservation&diff=7473&oldid=prev Steven Solie: Created page with "= Preserving the Window Display = The layers library is what allows the display and manipulation of multiple overlapping rectangles, or ''layers''. Intuition uses the layers ..." 2014-04-11T19:01:26Z <p>Created page with &quot;= Preserving the Window Display = The layers library is what allows the display and manipulation of multiple overlapping rectangles, or &#039;&#039;layers&#039;&#039;. Intuition uses the layers ...&quot;</p> <p><b>New page</b></p><div>= Preserving the Window Display =<br /> <br /> The layers library is what allows the display and manipulation of multiple overlapping rectangles, or ''layers''. Intuition uses the layers library to manage its windows, by associating a layer to each window.<br /> <br /> Each window is a virtual display. When rendering, the application does not have to worry about the current size or position of its window, and what other windows might be partly or fully obscuring its window. The window's RastPort is the handle to the its virtual display space. Intuition and graphics library rendering calls will recognize that this RastPort belongs to a layer, and act accordingly.<br /> <br /> As windows are moved, resized, rearranged, opened, or closed, the on-screen representation changes. When part of a window which was visible now needs to appear in a new location, the layers library will move that imagery without involving the application. However, when part of a window that was previously obscured is revealed, or when a window is made larger, the imagery for the newly-visible part of the window needs to be redrawn. Intuition, through layers, offers three choices for how this is managed, trading off speed, memory usage, and application complexity.<br /> <br /> * The most basic type of window is called ''Simple Refresh''. When any graphics operation takes place in this kind of window, the visible parts are updated, but rendering to the obscured parts is discarded. When the window arrangement changes to reveal a previously obscured part of such a window, the application must refresh that area.<br /> <br /> * Alternately, a window may be made ''Smart Refresh'', which means that when rendering occurs, the system will not only update the visible parts of the window, but it will maintain the obscured parts as well, by using off-screen buffers. This means that when an obscured part of the window is revealed, the system will restore the imagery that belongs there. The application needs only to refresh parts of the window that appear when the window is made bigger. Smart Refresh windows use more memory than Simple Refresh windows (for the storage of obscured areas), but they are faster.<br /> <br /> * The third kind of window is called ''SuperBitMap''. In such a window, the system can refresh the window even when it is sized bigger. For this to work, the application must store a complete bitmap for the window's maximum size. Such a window is more work to manage, and uses yet more memory. SuperBitMap windows are used less often than the other two types.<br /> <br /> Intuition helps your application manage window refresh. First, Intuition will take care of redrawing the window border and any system and application gadgets in the window. Your application never has to worry about that. Second, Intuition will notify your application when it needs to refresh its window (by sending the IDCMP_REFRESHWINDOW event). Third, Intuition provides functions that restrict your rendering to the newly-revealed (damaged) areas only, which speeds up your refresh rendering and makes it look cleaner.<br /> <br /> The Intuition, layers, and graphics libraries work together to make rendering into and managing windows easy. You obtain your windows through Intuition, which uses the Layers library to manage the overlapping, resizing, and re-positioning of the window layers. The layers library is responsible for identifying the areas of each window that are visible, obscured but preserved off-screen, or obscured and not preserved. The rendering functions in the graphics library and Intuition library know how to render into the multiple areas that layers library establishes.<br /> <br /> Note that you may not directly manipulate layers on an Intuition screen. You cannot create your own layers on an Intuition screen, nor can you use the layers movement, sizing, or arrangement functions on Intuition windows. Use the corresponding Intuition calls instead. Some other Layers library calls (such as the locking calls) are sometimes used on Intuition screens and windows.<br /> <br /> = Damage Regions =<br /> <br /> The layers library and Intuition maintain a ''damage region'' for each window, which is the part of the window whose imagery is in need of repair, or refreshing. Several things can add areas of the window to the damage region:<br /> <br /> * Revealing an obscured part of a Simple Refresh window adds that area to the damage region<br /> * Sizing a Simple or Smart Refresh window bigger along either axis adds the new area to the damage region<br /> * Resizing a Simple or Smart Refresh window (smaller or bigger) adds the old and new border areas, and the areas occupied by certain gadgets (those whose position or size depend on window size) to the damage region.<br /> <br /> = Refreshing Intuition Windows =<br /> <br /> When the user or an application performs an Intuition operation which causes damage to a window, Intuition notifies that window's application. It does this by sending a message of the class IDCMP_REFRESHWINDOW to that window's IDCMP.<br /> <br /> In response to this message, your application should update the damaged areas. Rendering proceeds faster and looks cleaner if it is restricted to the damaged areas only. The BeginRefresh()/EndRefresh() pair achieve that. The application should call BeginRefresh() for the window, and then do its rendering. Any rendering that would have gone into undamaged areas of the window is automatically discarded; only the area in need of repair is affected. Finally, the application should call EndRefresh(), which removes the restriction on rendering, and informs the system that the damage region has been dealt with. Even if your application intends to do no rendering, it must at least call BeginRefresh()/EndRefresh(), to inform the system that the damage region is no longer needed. If your application never needs to render in response to a refresh event, it can avoid having to call BeginRefresh()/EndRefresh() by setting the WFLG_NOCAREREFRESH flag or the WA_NoCareRefresh tag in the OpenWindowTagList() call.<br /> <br /> Note that by the time that your application receives notification that refresh is needed, Intuition will have already refreshed your window's border and all gadgets in the window, as needed. Thus, it is unnecessary to use any of the gadget-refreshing functions in response to an IDCMP_REFRESHWINDOW event.<br /> <br /> Operations performed between the BeginRefresh()/EndRefresh() pair should be restricted to simple rendering. All of the rendering functions in Intuition library and Graphics library are safe. Avoid RefreshGList() or RefreshGadgets(), or you risk deadlocking the computer. Avoid calls that may lock the LayerInfo or get complicated in Intuition, since BeginRefresh() leaves the window's layer or layers locked. Avoid AutoRequest() and EasyRequest(), and therefore all direct or indirect disk related DOS calls. See the [[Intuition_Gadgets|Intuition Gadgets]] section for more information on gadget restrictions with BeginRefresh() and EndRefresh().<br /> <br /> == Simple Refresh ==<br /> <br /> For a Simple Refresh window, only those pixels actually on-screen are maintained by the system. When part of a Simple Refresh window is obscured, the imagery that was there is lost. As well, any rendering into obscured portions of such a window is discarded.<br /> <br /> When part of the window is newly revealed (either because the window was just made larger, or because that part used to be obscured by another window), the application must refresh any rendering it wishes to appear into that part. The application will learn that refresh is needed because Intuition sends an IDCMP_REFRESHWINDOW event.<br /> <br /> == Smart Refresh ==<br /> <br /> If a window is of the Smart Refresh type, then the system will not only preserve those pixels which are actually on-screen, but it will save all obscured pixels that are within the current window's size. The system will refresh those parts of the window revealed by changes in the overlapping with other windows on the screen, without involving the application. However, any part of the window revealed through the sizing of the window must be redrawn by the application. Again, Intuition will notify the application through the IDCMP_REFRESHWINDOW event.<br /> <br /> Because the obscured areas are kept in off-screen buffers, Smart Refresh windows are refreshed faster than Simple Refresh windows are, and often without involving the application. Of course, for the same reason, they use more display memory.<br /> <br /> == SuperBitMap Refresh ==<br /> <br /> The SuperBitMap refresh type allows the application to provide and maintain bitmap memory for graphics in the window. The bitmap can be any size as long as the window sizing limits respect the maximum size of the bitmap.<br /> <br /> SuperBitMap windows have their own memory for maintaining all obscured parts of the window up to the size of the defined bitmap, including those parts outside of the current window. Intuition will update all parts of the window that are revealed through changes in sizing and changes in window overlapping. The application never needs to redraw portions of the window that were revealed by sizing or positioning windows in the screen.<br /> <br /> SuperBitMap windows require the application to allocate a bitmap for use as off-screen memory, instead of using Intuition managed buffers. This bitmap must be as large as, or larger than, the inner window's maximum dimensions (that is, the window's outside dimensions less the border sizes).<br /> <br /> SuperBitMap windows are almost always WFLG_GIMMEZEROZERO, which renders the borders and system gadgets in a separate bitmap. If the application wishes to create a SuperBitMap window that is not GimmeZeroZero, it must make the window borderless with no system gadgets, so that no border imagery is rendered by Intuition into the application's bitmap.<br /> <br /> = Intuition Refresh Events =<br /> <br /> When using a Simple Refresh or a Smart Refresh windows, the program may receive refresh events, informing it to update the display. See the above discussion for information on when refresh events are sent.<br /> <br /> A message of the class IDCMP_REFRESHWINDOW arrives at the IDCMP, informing the program of the need to update the display. The program must take some action when it receives a refresh event, even if it is just the acceptable minimum action described below.<br /> <br /> On receiving a refresh event, BeginRefresh() must be called, then the program should redraw its display, and, finally, call EndRefresh(). The minimum required action is to call the BeginRefresh()/EndRefresh() pair. This allows Intuition and the Layers library keep things sorted and organized.<br /> <br /> = Optimized Window Refreshing =<br /> <br /> Bracketing the display updating in the BeginRefresh()/EndRefresh() pair automatically restricts all rendering to the &quot;damaged&quot; areas.<br /> <br /> &lt;syntaxhighlight&gt;<br /> VOID BeginRefresh( struct Window *window );<br /> VOID EndRefresh ( struct Window *window, LONG complete );<br /> &lt;/syntaxhighlight&gt;<br /> <br /> These functions makes sure that refreshing is done in the most efficient way, only redrawing those portions of the window that really need to be redrawn. The rest of the rendering commands are discarded.<br /> <br /> Operations performed between the BeginRefresh()/EndRefresh() pair should be restricted to simple rendering. All of the rendering functions in Intuition library and Graphics library are safe. Calls to RefreshGadgets() are not permitted. Avoid calls that may lock the LayerInfo, or get complicated in Intuition, since BeginRefresh() leaves the window's layer or layers locked. Avoid AutoRequest(), and therefore all direct or indirect disk related DOS calls. See [[Intuition_Gadgets|Intuition Gadgets]] for more information on gadget restrictions with BeginRefresh()/EndRefresh().<br /> <br /> Certain applications do not need to receive refresh events, and can avoid having to call BeginRefresh() and EndRefresh() by setting the WFLG_NOCAREREFRESH flag or the WA_NoCareRefresh tag in the OpenWindowTagList() call.<br /> <br /> The EndRefresh() function takes a boolean value as an argument (complete in the prototype above). This value determines whether refreshing is completely finished. When set to FALSE, further refreshing may be performed between subsequent BeginRefresh()/ EndRefresh() pairs. Set the boolean to TRUE for the last call to EndRefresh().<br /> <br /> It is critical that applications performing multiple BeginRefresh() and EndRefresh() pairs using EndRefresh(win,FALSE) hold layers locked through the entire process. The layer lock may only be released after the final call to EndRefresh(win,TRUE). See [[Layers_Library|Layers Library]] for more details.<br /> <br /> The procedures outlined in this section take care of refreshing what is inside the window. Another function named RefreshWindowFrame() refreshes window borders, including the title region and gadgets:<br /> <br /> &lt;syntaxhighlight&gt;<br /> VOID RefreshWindowFrame( struct Window *window );<br /> &lt;/syntaxhighlight&gt;<br /> <br /> Applications can use this function to update window borders after overwriting them with graphics.<br /> <br /> = Setting up a SuperBitMap Window =<br /> <br /> SuperBitMap windows are created by setting the WFLG_SUPER_BITMAP flag, or by specifying the WA_SuperBitMap tag in the OpenWindowTagList() call. A pointer to an allocated and initialized BitMap structure must be provided.<br /> <br /> A SuperBitMap window requires the application to allocate and initialize its own bitmap. This entails allocating a BitMap structure, initializing the structure and allocating memory for the bit planes.<br /> <br /> Allocate a BitMap structure with the Exec AllocMem() function. Then use the graphics function InitBitMap() to initialize the BitMap structure:<br /> <br /> &lt;pre&gt;<br /> VOID InitBitMap( struct BitMap *bitMap, LONG depth, LONG width, LONG height );<br /> &lt;/pre&gt;<br /> <br /> InitBitMap() fills in fields in the BitMap structure describing how a linear memory area is organized as a series of one or more rectangular bit-planes.<br /> <br /> Once you have allocated and initialized the BitMap structure, use the graphics library function AllocRaster() to allocate the memory space for all the bit planes.<br /> <br /> &lt;pre&gt;<br /> PLANEPTR AllocRaster( ULONG width, ULONG height );<br /> &lt;/pre&gt;<br /> <br /> The example listed in the next section shows how to allocate a BitMap structure, initialize it with InitBitMap() and use AllocRaster() function to set up memory for the bitplanes.<br /> <br /> = Graphics and Layers Functions for SuperBitMap Windows =<br /> <br /> The portion of the bitmap showing within a SuperBitMap window is controlled by the application. Initially, the window shows the bitmap starting from its origin (0,0) and clipped to fit within the window layer. The visible portion of the bitmap can be scrolled around within the window using the layers library ScrollLayer() function:<br /> <br /> &lt;pre&gt;<br /> VOID ScrollLayer(LONG unused, struct Layer *layer, LONG dx, LONG dy)<br /> &lt;/pre&gt;<br /> <br /> Pass this function a pointer to the window's layer in layer and the scroll offsets in dx and dy. (A pointer to the window's layer can be obtained from Window.RPort-&amp;gt;Layer.)<br /> <br /> When rendering operations are performed in a SuperBitMap window, any rendering that falls outside window boundaries is done in the application's bitmap. Rendering that falls within window bounds is done in the screen's bitmap. Before performing an operation such as a save on the application bitmap, the graphics library function SyncSBitMap() should be called:<br /> <br /> &lt;pre&gt;<br /> VOID SyncSBitMap(struct Layer *layer)<br /> &lt;/pre&gt;<br /> <br /> Pass this function a pointer to the window's layer. SyncSBitMap() copies the window contents to the corresponding part of the application bitmap, bringing it up to date. (If no rendering operations have been performed this call is not necessary.)<br /> <br /> Similarly, after making any changes to the application bitmap such as loading a new one, the window's layer should be locked and the CopySBitMap() function should be called.<br /> <br /> &lt;pre&gt;<br /> VOID CopySBitMap(struct Layer *)<br /> &lt;/pre&gt;<br /> <br /> This function copies the new information in the appropriate area of the underlying bitmap to the window's layer.<br /> <br /> For more information about bitmaps and layers, see the [[Graphics_Primitives|Graphics Primitives]] and [[Layers_Library|Layers Library]]. Also see the &amp;lt;graphics/clip.h&amp;gt;, &amp;lt;graphics/gfx.h&amp;gt;, &amp;lt;graphics/layers.h &amp;gt; files in the SDK.<br /> <br /> == SuperBitMap Window Example ==<br /> <br /> This example shows how to implement a superbitmap, and uses a host of Intuition facilities. Further reading of other Intuition and graphics chapters may be required for a complete understanding of this example.<br /> <br /> &lt;pre&gt;<br /> ;/* lines.c - Execute me to compile me with SAS C 5.10<br /> LC -b1 -cfistq -v -y -j73 lines.c<br /> Blink FROM LIB:c.o,lines.o TO lines LIBRARY LIB:LC.lib,LIB:Amiga.lib<br /> quit<br /> <br /> ** lines.c -- implements a superbitmap with scroll gadgets<br /> ** This program requires V37, as it uses calls to OpenWindowTags(),<br /> ** LockPubScreen().<br /> */<br /> <br /> /* Enforces use of new prefixed Intuition flag names */<br /> #define INTUI_V36_NAMES_ONLY<br /> <br /> #include &amp;lt;exec/types.h&amp;gt;<br /> #include &amp;lt;exec/memory.h&amp;gt;<br /> #include &amp;lt;intuition/intuition.h&amp;gt;<br /> <br /> #include &amp;lt;clib/exec_protos.h&amp;gt;<br /> #include &amp;lt;clib/layers_protos.h&amp;gt;<br /> #include &amp;lt;clib/graphics_protos.h&amp;gt;<br /> #include &amp;lt;clib/intuition_protos.h&amp;gt;<br /> <br /> /* Random number function in amiga.lib (see amiga.lib.doc) */<br /> UWORD RangeRand( unsigned long maxValue );<br /> <br /> #ifdef LATTICE<br /> int CXBRK(void) { return(0); } /* Disable Lattice CTRL/C handling */<br /> int chkabort(void) { return(0); } /* really */<br /> #endif<br /> <br /> #define WIDTH_SUPER (800)<br /> #define HEIGHT_SUPER (600)<br /> <br /> #define UP_DOWN_GADGET (0)<br /> #define LEFT_RIGHT_GADGET (1)<br /> #define NO_GADGET (2)<br /> <br /> #define MAXPROPVAL (0xFFFFL)<br /> <br /> #define GADGETID(x) (((struct Gadget *)(msg-&amp;gt;IAddress))-&amp;gt;GadgetID)<br /> <br /> #define LAYERXOFFSET(x) (x-&amp;gt;RPort-&amp;gt;Layer-&amp;gt;Scroll_X)<br /> #define LAYERYOFFSET(x) (x-&amp;gt;RPort-&amp;gt;Layer-&amp;gt;Scroll_Y)<br /> <br /> /* A string with this format will be found by the version command.<br /> ** This will allow users to give version numbers with error reports.<br /> */<br /> UBYTE vers[] = &amp;quot;$VER: lines 37.2&amp;quot;;<br /> <br /> struct Library *GfxBase;<br /> struct Library *IntuitionBase;<br /> struct Library *LayersBase;<br /> <br /> struct Window *Win = NULL; /* window pointer */<br /> struct PropInfo BotGadInfo = {0};<br /> struct Image BotGadImage = {0};<br /> struct Gadget BotGad = {0};<br /> struct PropInfo SideGadInfo = {0};<br /> struct Image SideGadImage = {0};<br /> struct Gadget SideGad = {0};<br /> <br /> <br /> /* Prototypes for our functions */<br /> VOID initBorderProps(struct Screen *myscreen);<br /> VOID doNewSize(void);<br /> VOID doDrawStuff(void);<br /> VOID doMsgLoop(void);<br /> VOID superWindow(struct Screen *myscreen);<br /> <br /> <br /> /*<br /> ** main<br /> ** Open all required libraries and get a pointer to the default public screen.<br /> ** Cleanup when done or on error.<br /> */<br /> VOID main(int argc, char **argv)<br /> {<br /> struct Screen *myscreen;<br /> <br /> /* open all of the required libraries for the program.<br /> **<br /> ** require version 37 of the Intuition library.<br /> */<br /> <br /> if (IntuitionBase = OpenLibrary(&amp;quot;intuition.library&amp;quot;,37L))<br /> {<br /> if (GfxBase = OpenLibrary(&amp;quot;graphics.library&amp;quot;,33L))<br /> {<br /> if (LayersBase = OpenLibrary(&amp;quot;layers.library&amp;quot;,33L))<br /> {<br /> /* LockPubScreen()/UnlockPubScreen is only available under V36<br /> ** and later... Use GetScreenData() under V34 systems to get a<br /> ** copy of the screen structure...<br /> */<br /> if (NULL != (myscreen = LockPubScreen(NULL)))<br /> {<br /> superWindow(myscreen);<br /> UnlockPubScreen(NULL,myscreen);<br /> }<br /> CloseLibrary(LayersBase);<br /> }<br /> CloseLibrary(GfxBase);<br /> }<br /> CloseLibrary(IntuitionBase);<br /> }<br /> }<br /> <br /> <br /> /*<br /> ** Create, initialize and process the super bitmap window.<br /> ** Cleanup if any error.<br /> */<br /> VOID superWindow(struct Screen *myscreen)<br /> {<br /> struct BitMap *bigBitMap;<br /> WORD planeNum;<br /> WORD allocatedBitMaps;<br /> <br /> /* set-up the border prop gadgets for the OpenWindow() call. */<br /> initBorderProps(myscreen);<br /> <br /> /* The code relies on the allocation of the BitMap structure with<br /> ** the MEMF_CLEAR flag. This allows the assumption that all of the<br /> ** bitmap pointers are NULL, except those successfully allocated<br /> ** by the program.<br /> */<br /> if (bigBitMap = AllocMem(sizeof(struct BitMap), MEMF_PUBLIC | MEMF_CLEAR))<br /> {<br /> InitBitMap(bigBitMap, myscreen-&amp;gt;BitMap.Depth, WIDTH_SUPER, HEIGHT_SUPER);<br /> <br /> allocatedBitMaps = TRUE;<br /> for (planeNum = 0;<br /> (planeNum &amp;lt; myscreen-&amp;gt;BitMap.Depth) &amp;amp;&amp;amp; (allocatedBitMaps == TRUE);<br /> planeNum++)<br /> {<br /> bigBitMap-&amp;gt;Planes[planeNum] = AllocRaster(WIDTH_SUPER, HEIGHT_SUPER);<br /> if (NULL == bigBitMap-&amp;gt;Planes[planeNum])<br /> allocatedBitMaps = FALSE;<br /> }<br /> <br /> /* Only open the window if the bitplanes were successfully<br /> ** allocated. Fail silently if they were not.<br /> */<br /> if (TRUE == allocatedBitMaps)<br /> {<br /> /* OpenWindowTags() and OpenWindowTagList() are only available<br /> ** when the library version is at least V36. Under earlier<br /> ** versions of Intuition, use OpenWindow() with a NewWindow<br /> ** structure.<br /> */<br /> if (NULL != (Win = OpenWindowTags(NULL,<br /> WA_Width, 150,<br /> WA_Height, 4 * (myscreen-&amp;gt;WBorTop + myscreen-&amp;gt;Font-&amp;gt;ta_YSize + 1),<br /> WA_MaxWidth, WIDTH_SUPER,<br /> WA_MaxHeight, HEIGHT_SUPER,<br /> WA_IDCMP, IDCMP_GADGETUP | IDCMP_GADGETDOWN |<br /> IDCMP_NEWSIZE | IDCMP_INTUITICKS | IDCMP_CLOSEWINDOW,<br /> WA_Flags, WFLG_SIZEGADGET | WFLG_SIZEBRIGHT | WFLG_SIZEBBOTTOM |<br /> WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_CLOSEGADGET |<br /> WFLG_SUPER_BITMAP | WFLG_GIMMEZEROZERO | WFLG_NOCAREREFRESH,<br /> WA_Gadgets, &amp;amp;(SideGad),<br /> WA_Title, &amp;amp;vers[6], /* take title from version string */<br /> WA_PubScreen, myscreen,<br /> WA_SuperBitMap, bigBitMap,<br /> TAG_END)))<br /> {<br /> /* set-up the window display */<br /> SetRast(Win-&amp;gt;RPort,0); /* clear the bitplanes */<br /> SetDrMd(Win-&amp;gt;RPort,JAM1);<br /> <br /> doNewSize(); /* adjust props to represent portion visible */<br /> doDrawStuff();<br /> <br /> /* process the window, return on IDCMP_CLOSEWINDOW */<br /> doMsgLoop();<br /> <br /> CloseWindow(Win);<br /> }<br /> }<br /> <br /> for (planeNum = 0; planeNum &amp;lt; myscreen-&amp;gt;BitMap.Depth; planeNum++)<br /> {<br /> /* free only the bitplanes actually allocated... */<br /> if (NULL != bigBitMap-&amp;gt;Planes[planeNum])<br /> FreeRaster(bigBitMap-&amp;gt;Planes[planeNum], WIDTH_SUPER, HEIGHT_SUPER);<br /> }<br /> FreeMem(bigBitMap,sizeof(struct BitMap));<br /> }<br /> }<br /> <br /> /*<br /> ** Set-up the prop gadgets--initialize them to values that fit<br /> ** into the window border. The height of the prop gadget on the side<br /> ** of the window takes the height of the title bar into account in its<br /> ** set-up. note the initialization assumes a fixed size &amp;quot;sizing&amp;quot; gadget.<br /> **<br /> ** Note also, that the size of the sizing gadget is dependent on the<br /> ** screen resolution. The numbers given here are only valid if the<br /> ** screen is NOT lo-res. These values must be re-worked slightly<br /> ** for lo-res screens.<br /> **<br /> ** The PROPNEWLOOK flag is ignored by 1.3.<br /> */<br /> VOID initBorderProps(struct Screen *myscreen)<br /> {<br /> /* initializes the two prop gadgets.<br /> **<br /> ** Note where the PROPNEWLOOK flag goes. Adding this flag requires<br /> ** no extra storage, but tells the system that our program is<br /> ** expecting the new-look prop gadgets under 2.0.<br /> */<br /> BotGadInfo.Flags = AUTOKNOB | FREEHORIZ | PROPNEWLOOK;<br /> BotGadInfo.HorizPot = 0;<br /> BotGadInfo.VertPot = 0;<br /> BotGadInfo.HorizBody = -1;<br /> BotGadInfo.VertBody = -1;<br /> <br /> BotGad.LeftEdge = 3;<br /> BotGad.TopEdge = -7;<br /> BotGad.Width = -23;<br /> BotGad.Height = 6;<br /> <br /> BotGad.Flags = GFLG_RELBOTTOM | GFLG_RELWIDTH;<br /> BotGad.Activation = GACT_RELVERIFY | GACT_IMMEDIATE | GACT_BOTTOMBORDER;<br /> BotGad.GadgetType = GTYP_PROPGADGET | GTYP_GZZGADGET;<br /> BotGad.GadgetRender = (APTR)&amp;amp;(BotGadImage);<br /> BotGad.SpecialInfo = (APTR)&amp;amp;(BotGadInfo);<br /> BotGad.GadgetID = LEFT_RIGHT_GADGET;<br /> <br /> SideGadInfo.Flags = AUTOKNOB | FREEVERT | PROPNEWLOOK;<br /> SideGadInfo.HorizPot = 0;<br /> SideGadInfo.VertPot = 0;<br /> SideGadInfo.HorizBody = -1;<br /> SideGadInfo.VertBody = -1;<br /> <br /> /* NOTE the TopEdge adjustment for the border and the font for V36.<br /> */<br /> SideGad.LeftEdge = -14;<br /> SideGad.TopEdge = myscreen-&amp;gt;WBorTop + myscreen-&amp;gt;Font-&amp;gt;ta_YSize + 2;<br /> SideGad.Width = 12;<br /> SideGad.Height = -SideGad.TopEdge - 11;<br /> <br /> SideGad.Flags = GFLG_RELRIGHT | GFLG_RELHEIGHT;<br /> SideGad.Activation = GACT_RELVERIFY | GACT_IMMEDIATE | GACT_RIGHTBORDER;<br /> SideGad.GadgetType = GTYP_PROPGADGET | GTYP_GZZGADGET;<br /> SideGad.GadgetRender = (APTR)&amp;amp;(SideGadImage);<br /> SideGad.SpecialInfo = (APTR)&amp;amp;(SideGadInfo);<br /> SideGad.GadgetID = UP_DOWN_GADGET;<br /> SideGad.NextGadget = &amp;amp;(BotGad);<br /> }<br /> <br /> <br /> /*<br /> ** This function does all the work of drawing the lines<br /> */<br /> VOID doDrawStuff()<br /> {<br /> WORD x1,y1,x2,y2;<br /> WORD pen,ncolors,deltx,delty;<br /> <br /> ncolors = 1 &amp;lt;&amp;lt; Win-&amp;gt;WScreen-&amp;gt;BitMap.Depth;<br /> deltx = RangeRand(6)+2;<br /> delty = RangeRand(6)+2;<br /> <br /> pen = RangeRand(ncolors-1) + 1;<br /> SetAPen(Win-&amp;gt;RPort,pen);<br /> for(x1=0, y1=0, x2=WIDTH_SUPER-1, y2=HEIGHT_SUPER-1;<br /> x1 &amp;lt; WIDTH_SUPER;<br /> x1 += deltx, x2 -= deltx)<br /> {<br /> Move(Win-&amp;gt;RPort,x1,y1);<br /> Draw(Win-&amp;gt;RPort,x2,y2);<br /> }<br /> <br /> pen = RangeRand(ncolors-1) + 1;<br /> SetAPen(Win-&amp;gt;RPort,pen);<br /> for(x1=0, y1=0, x2=WIDTH_SUPER-1, y2=HEIGHT_SUPER-1;<br /> y1 &amp;lt; HEIGHT_SUPER;<br /> y1 += delty, y2 -= delty)<br /> {<br /> Move(Win-&amp;gt;RPort,x1,y1);<br /> Draw(Win-&amp;gt;RPort,x2,y2);<br /> }<br /> }<br /> <br /> /*<br /> ** This function provides a simple interface to ScrollLayer<br /> */<br /> VOID slideBitMap(WORD Dx,WORD Dy)<br /> {<br /> ScrollLayer(0,Win-&amp;gt;RPort-&amp;gt;Layer,Dx,Dy);<br /> }<br /> <br /> /*<br /> ** Update the prop gadgets and bitmap positioning when the size changes.<br /> */<br /> VOID doNewSize()<br /> {<br /> ULONG tmp;<br /> <br /> tmp = LAYERXOFFSET(Win) + Win-&amp;gt;GZZWidth;<br /> if (tmp &amp;gt;= WIDTH_SUPER)<br /> slideBitMap(WIDTH_SUPER-tmp,0);<br /> <br /> NewModifyProp(&amp;amp;(BotGad),Win,NULL,AUTOKNOB | FREEHORIZ,<br /> ((LAYERXOFFSET(Win) * MAXPROPVAL) /<br /> (WIDTH_SUPER - Win-&amp;gt;GZZWidth)),<br /> NULL,<br /> ((Win-&amp;gt;GZZWidth * MAXPROPVAL) / WIDTH_SUPER),<br /> MAXPROPVAL,<br /> 1);<br /> <br /> tmp = LAYERYOFFSET(Win) + Win-&amp;gt;GZZHeight;<br /> if (tmp &amp;gt;= HEIGHT_SUPER)<br /> slideBitMap(0,HEIGHT_SUPER-tmp);<br /> <br /> NewModifyProp(&amp;amp;(SideGad),Win,NULL,AUTOKNOB | FREEVERT,<br /> NULL,<br /> ((LAYERYOFFSET(Win) * MAXPROPVAL) /<br /> (HEIGHT_SUPER - Win-&amp;gt;GZZHeight)),<br /> MAXPROPVAL,<br /> ((Win-&amp;gt;GZZHeight * MAXPROPVAL) / HEIGHT_SUPER),<br /> 1);<br /> }<br /> <br /> /*<br /> ** Process the currently selected gadget.<br /> ** This is called from IDCMP_INTUITICKS and when the gadget is released<br /> ** IDCMP_GADGETUP.<br /> */<br /> VOID checkGadget(UWORD gadgetID)<br /> {<br /> ULONG tmp;<br /> WORD dX = 0;<br /> WORD dY = 0;<br /> <br /> switch (gadgetID)<br /> {<br /> case UP_DOWN_GADGET:<br /> tmp = HEIGHT_SUPER - Win-&amp;gt;GZZHeight;<br /> tmp = tmp * SideGadInfo.VertPot;<br /> tmp = tmp / MAXPROPVAL;<br /> dY = tmp - LAYERYOFFSET(Win);<br /> break;<br /> case LEFT_RIGHT_GADGET:<br /> tmp = WIDTH_SUPER - Win-&amp;gt;GZZWidth;<br /> tmp = tmp * BotGadInfo.HorizPot;<br /> tmp = tmp / MAXPROPVAL;<br /> dX = tmp - LAYERXOFFSET(Win);<br /> break;<br /> }<br /> if (dX || dY)<br /> slideBitMap(dX,dY);<br /> }<br /> <br /> /*<br /> ** Main message loop for the window.<br /> */<br /> VOID doMsgLoop()<br /> {<br /> struct IntuiMessage *msg;<br /> WORD flag = TRUE;<br /> UWORD currentGadget = NO_GADGET;<br /> <br /> while (flag)<br /> {<br /> /* Whenever you want to wait on just one message port */<br /> /* you can use WaitPort(). WaitPort() doesn't require */<br /> /* the setting of a signal bit. The only argument it */<br /> /* requires is the pointer to the window's UserPort */<br /> WaitPort(Win-&amp;gt;UserPort);<br /> while (msg = (struct IntuiMessage *)GetMsg(Win-&amp;gt;UserPort))<br /> {<br /> switch (msg-&amp;gt;Class)<br /> {<br /> case IDCMP_CLOSEWINDOW:<br /> flag = FALSE;<br /> break;<br /> case IDCMP_NEWSIZE:<br /> doNewSize();<br /> doDrawStuff();<br /> break;<br /> case IDCMP_GADGETDOWN:<br /> currentGadget = GADGETID(msg);<br /> break;<br /> case IDCMP_GADGETUP:<br /> checkGadget(currentGadget);<br /> currentGadget = NO_GADGET;<br /> break;<br /> case IDCMP_INTUITICKS:<br /> checkGadget(currentGadget);<br /> break;<br /> }<br /> ReplyMsg((struct Message *)msg);<br /> }<br /> }<br /> }<br /> &lt;/pre&gt;</div> Steven Solie