DMDX Help.

Only Clear Behind Keyword


    Frame will only clear the region of the screen immediately behind whatever display it generates leaving the rest of the screen not erased. Sets <NoErase> for that frame as well.

    For a demonstration I recently coded up this Unicode glyph displayer that progressively fills the screen up with Unicode characters (you will want to turn the Unicode option on for this test and make sure you're using a version of DMDX that's or later as several things were ironed out to get Unicode characters displaying correctly under all circumstances, older versions will toss a "RTF control word <\ > used, not supported" error after some time) and once the screen is full starts overwriting the existing characters with more.  Here we have to be a little careful to make frames wide enough to fully erase what was already drawn and while one could use the oversize options I've simply decided to put a couple of spaces before and after the <sprintf> %c character format specifier(s) in items 310 and 350 that have the <ocb> keywords in them as no matter what options one could choose for this task you're either going to wind up erasing nearby characters or not fully erase old ones as the variability in width between Unicode glyphs is rather large (I guess if you really cared about it you could examine the dimensions of the display with the <StoreCoords> keyword):

<fd 100> <cr> <zil> <ztr> <ntl>

+1 <!branchdiagnostics> "Unicode code point to start at? (decimal or hex with 0X prefix)" * <fbocb>;

1 <md .l. -1> <md .xd. 25> <md .yd. 20> <md set .u. = ~.zilliontext. - 1>
    <md yikwid> <xyjustification center> ;

~100 <md set .l. = ~.l. + 1> <md set .u. = ~.u. + 1>;
~1 <bi 110, ~.u. .ne. 0xd800> <! skip over high and low UTF-16 surrogate codes>;
~1 <md .u. 0xe000>;
~110 <emit U ~.u.> <bi 120, ~.u. .le. 0x10ffff>;
~1 <md .u. 1>     <! just in case someone sits through all the codes...>;
~120 <set c1 = ~.u.> <bi 200, ~.u. .lt. 0x10000>;
~1 <md set .w. = ~.u. - 0x10000> <! high endpoints will need to use a surrogate pair>;
~1 <set c2 = (~.w. .shr. 10) + 0xD800>
    <set c3 = (~.w. & 0x3ff) + 0xdc00>;

~200 <md set .xl. = (~.l. / ~.yd.) % ~.xd.>  <! determine where we draw>
    <md set .yl. = ~.l. % ~.yd.>;
~1 <md fxpset 5 .x. = ((100000/~.xd.) / 2) + ((100000/~.xd.) * ~.xl.)>
    <md fxpset 5 .y. = ((100000/~.yd.) / 2) + ((100000/~.yd.) * ~.yl.)>;

~300 <bi 350, ~.u. .gt. 0xffff> <! use one code or surrogate pair?>;
~1 <bi 310, (~.u. .ne. '\') .and. (~.u. .ne. '{') .and. (~.u. .ne. '}')>;
~1 <set c2 = '\'> <set c3 = ~.u.> <bu 350> <! cheat and use 2 for escaped RTF>;
310 <d 2> <ocb> <xy ~.x., ~.y.> "  %c  " <sprintf c1> <bu -100>;
350 <d 2> <ocb> <xy ~.x., ~.y.> "  %c%c  " <sprintf c2, c3> <bu -100>;

0 "end";

DMDX Index.