ZealOS/docs/System/Gr/SpriteBitMap.html
2021-07-03 02:51:43 -04:00

861 lines
108 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.05">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</style>
</head>
<body>
<pre style="font-family:courier;font-size:10pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics/Sprite;Sprites&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_EXIT</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_MAIN_MENU</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_COLOR</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_DITHER_COLOR</span><span class=cF0> </span><span class=cFE>3</span><span class=cF0>
<a name="l7"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_WIDTH</span><span class=cF0> </span><span class=cFE>4</span><span class=cF0>
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_PT</span><span class=cF0> </span><span class=cFE>5</span><span class=cF0>
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_LINE</span><span class=cF0> </span><span class=cFE>6</span><span class=cF0>
<a name="l10"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_ARROW</span><span class=cF0> </span><span class=cFE>7</span><span class=cF0>
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_RECT</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_CIRCLE</span><span class=cF0> </span><span class=cFE>9</span><span class=cF0>
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_TEXT</span><span class=cF0> </span><span class=cFE>10</span><span class=cF0>
<a name="l14"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_BOX</span><span class=cF0> </span><span class=cFE>11</span><span class=cF0>
<a name="l15"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_DIAMOND</span><span class=cF0> </span><span class=cFE>12</span><span class=cF0>
<a name="l16"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_FLOOD_FILL</span><span class=cF0> </span><span class=cFE>13</span><span class=cF0>
<a name="l17"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_FLOOD_FILL_NOT</span><span class=cF0> </span><span class=cFE>14</span><span class=cF0>
<a name="l18"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_POLYLINE</span><span class=cF0> </span><span class=cFE>15</span><span class=cF0>
<a name="l19"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_POLYPT</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>
<a name="l20"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_COPY</span><span class=cF0> </span><span class=cFE>17</span><span class=cF0>
<a name="l21"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_DELETE</span><span class=cF0> </span><span class=cFE>18</span><span class=cF0>
<a name="l22"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_PASTE</span><span class=cF0> </span><span class=cFE>19</span><span class=cF0>
<a name="l23"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_PASTE_TRANSPARENT</span><span class=cF0> </span><span class=cFE>20</span><span class=cF0>
<a name="l24"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_FIND_AND_REPLACE</span><span class=cF0> </span><span class=cFE>21</span><span class=cF0>
<a name="l25"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_TRIM_TO_EXTENTS</span><span class=cF0> </span><span class=cFE>22</span><span class=cF0>
<a name="l26"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_ADD_OUTLINE</span><span class=cF0> </span><span class=cFE>23</span><span class=cF0>
<a name="l27"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_ETCH</span><span class=cF0> </span><span class=cFE>24</span><span class=cF0>
<a name="l28"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_UNDO</span><span class=cF0> </span><span class=cFE>25</span><span class=cF0>
<a name="l29"></a>#</span><span class=cF1>define</span><span class=cF0> </span><span class=cF3>SPBM_SAVE_GR</span><span class=cF0> </span><span class=cFE>26</span><span class=cF0>
<a name="l30"></a>
<a name="l31"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrInit4</span><span class=cF0>()
<a name="l32"></a>{
<a name="l33"></a> </span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>&quot;ST_SPRITE_BITMAP_MENU&quot;</span><span class=cF0>,
<a name="l34"></a>
<a name="l35"></a> </span><span class=cF6>&quot;Exit\0&quot;</span><span class=cF0>
<a name="l36"></a> </span><span class=cF6>&quot;Main Menu\0&quot;</span><span class=cF0>
<a name="l37"></a> </span><span class=cF6>&quot;Color\0&quot;</span><span class=cF0>
<a name="l38"></a> </span><span class=cF6>&quot;Dither Color\0&quot;</span><span class=cF0>
<a name="l39"></a> </span><span class=cF6>&quot;Width\0&quot;</span><span class=cF0>
<a name="l40"></a> </span><span class=cF6>&quot;Point\0&quot;</span><span class=cF0>
<a name="l41"></a> </span><span class=cF6>&quot;Line\0&quot;</span><span class=cF0>
<a name="l42"></a> </span><span class=cF6>&quot;Arrow\0&quot;</span><span class=cF0>
<a name="l43"></a> </span><span class=cF6>&quot;Rect\0&quot;</span><span class=cF0>
<a name="l44"></a> </span><span class=cF6>&quot;Circle\0&quot;</span><span class=cF0>
<a name="l45"></a> </span><span class=cF6>&quot;Text\0&quot;</span><span class=cF0>
<a name="l46"></a> </span><span class=cF6>&quot;Text Box\0&quot;</span><span class=cF0>
<a name="l47"></a> </span><span class=cF6>&quot;Text Diamond\0&quot;</span><span class=cF0>
<a name="l48"></a> </span><span class=cF6>&quot;Flood Fill\0&quot;</span><span class=cF0>
<a name="l49"></a> </span><span class=cF6>&quot;Flood Fill Not Color\0&quot;</span><span class=cF0>
<a name="l50"></a> </span><span class=cF6>&quot;PolyLine\0&quot;</span><span class=cF0>
<a name="l51"></a> </span><span class=cF6>&quot;PolyPoint\0&quot;</span><span class=cF0>
<a name="l52"></a> </span><span class=cF6>&quot;Copy\0&quot;</span><span class=cF0>
<a name="l53"></a> </span><span class=cF6>&quot;Delete\0&quot;</span><span class=cF0>
<a name="l54"></a> </span><span class=cF6>&quot;Paste\0&quot;</span><span class=cF0>
<a name="l55"></a> </span><span class=cF6>&quot;Paste Transparent\0&quot;</span><span class=cF0>
<a name="l56"></a> </span><span class=cF6>&quot;Find and Replace\0&quot;</span><span class=cF0>
<a name="l57"></a> </span><span class=cF6>&quot;Trim to Extents\0&quot;</span><span class=cF0>
<a name="l58"></a> </span><span class=cF6>&quot;Add Outline\0&quot;</span><span class=cF0>
<a name="l59"></a> </span><span class=cF6>&quot;Etch\0&quot;</span><span class=cF0>
<a name="l60"></a> </span><span class=cF6>&quot;Undo\0&quot;</span><span class=cF0>
<a name="l61"></a> </span><span class=cF6>&quot;Save GR\0&quot;</span><span class=cF0>);
<a name="l62"></a>}
<a name="l63"></a></span><span class=cF5>GrInit4</span><span class=cF0>;
<a name="l64"></a>
<a name="l65"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>PopUpSpriteBitMap</span><span class=cF0>(</span><span class=cF9>CColorROPU32</span><span class=cF0> color, </span><span class=cF9>I64</span><span class=cF0> width)
<a name="l66"></a>{
<a name="l67"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l68"></a> </span><span class=cF1>U8</span><span class=cF0> *st1, *st2, buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
<a name="l69"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc = </span><span class=cF5>DocNew</span><span class=cF0>;
<a name="l70"></a>
<a name="l71"></a> </span><span class=cF5>Color2Str</span><span class=cF0>(buf, color);
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (color &amp; </span><span class=cF3>ROPF_DITHER</span><span class=cF0>)
<a name="l73"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l74"></a> st1 = </span><span class=cF6>&quot;&quot;</span><span class=cF0>;
<a name="l75"></a> st2 = buf;
<a name="l76"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l77"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l79"></a> st1 = buf;
<a name="l80"></a> st2 = </span><span class=cF6>&quot;&quot;</span><span class=cF0>;
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l82"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,
<a name="l83"></a> </span><span class=cF6>&quot;$PURPLE$$TX+CX,\&quot;Sprite BitMap Menu\&quot;$\n&quot;</span><span class=cF0>
<a name="l84"></a> </span><span class=cF6>&quot;$LK+PU+CX,\&quot;Click for Help\&quot;,A=\&quot;FI:::/Doc/SpriteBitMap.DD\&quot;$\n&quot;</span><span class=cF0>
<a name="l85"></a> </span><span class=cF6>&quot;\n$LTBLUE$$MU-UL,\&quot;Color %s\&quot;,LE=SPBM_COLOR$\n&quot;</span><span class=cF0>
<a name="l86"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Dither Color %s\&quot;,LE=SPBM_DITHER_COLOR$\n&quot;</span><span class=cF0>
<a name="l87"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Width %d\&quot;,LE=SPBM_WIDTH$\n&quot;</span><span class=cF0>
<a name="l88"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Find &amp; Replace Color\&quot;,LE=SPBM_FIND_AND_REPLACE$\n&quot;</span><span class=cF0>
<a name="l89"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Trim to Extents\&quot;,LE=SPBM_TRIM_TO_EXTENTS$\n&quot;</span><span class=cF0>
<a name="l90"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Add Outline\&quot;,LE=SPBM_ADD_OUTLINE$\n&quot;</span><span class=cF0>
<a name="l91"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Etch\&quot;,LE=SPBM_ETCH$\n&quot;</span><span class=cF0>
<a name="l92"></a> </span><span class=cF6>&quot;\n$MU-UL,\&quot;Point\&quot;,LE=SPBM_PT$\n&quot;</span><span class=cF0>
<a name="l93"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Line\&quot;,LE=SPBM_LINE$\n&quot;</span><span class=cF0>
<a name="l94"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Arrow\&quot;,LE=SPBM_ARROW$\n&quot;</span><span class=cF0>
<a name="l95"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Rect\&quot;,LE=SPBM_RECT$\n&quot;</span><span class=cF0>
<a name="l96"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Circle\&quot;,LE=SPBM_CIRCLE$\n&quot;</span><span class=cF0>
<a name="l97"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Text\&quot;,LE=SPBM_TEXT$\n&quot;</span><span class=cF0>
<a name="l98"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Text Box\&quot;,LE=SPBM_TEXT_BOX$\n&quot;</span><span class=cF0>
<a name="l99"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Text Diamond\&quot;,LE=SPBM_TEXT_DIAMOND$\n&quot;</span><span class=cF0>
<a name="l100"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Flood Fill\&quot;,LE=SPBM_FLOOD_FILL$\n&quot;</span><span class=cF0>
<a name="l101"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Flood Fill Not Color\&quot;,LE=SPBM_FLOOD_FILL_NOT$\n&quot;</span><span class=cF0>
<a name="l102"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;PolyLine\&quot;,LE=SPBM_POLYLINE$\n&quot;</span><span class=cF0>
<a name="l103"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;PolyPoint\&quot;,LE=SPBM_POLYPT$\n&quot;</span><span class=cF0>
<a name="l104"></a> </span><span class=cF6>&quot;\n$MU-UL,\&quot;Copy to Clip\&quot;,LE=SPBM_COPY$\n&quot;</span><span class=cF0>
<a name="l105"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Delete to Clip\&quot;,LE=SPBM_DELETE$\n&quot;</span><span class=cF0>
<a name="l106"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Paste Clip\&quot;,LE=SPBM_PASTE$\n&quot;</span><span class=cF0>
<a name="l107"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Paste Transparent Clip\&quot;,LE=SPBM_PASTE_TRANSPARENT$\n&quot;</span><span class=cF0>
<a name="l108"></a> </span><span class=cF6>&quot;\n$MU-UL,\&quot;Save GR File\&quot;,LE=SPBM_SAVE_GR$\n&quot;</span><span class=cF0>
<a name="l109"></a> </span><span class=cF6>&quot;\n$MU-UL,\&quot;Undo\&quot;,LE=SPBM_UNDO$\n&quot;</span><span class=cF0>
<a name="l110"></a> </span><span class=cF6>&quot;\n$PURPLE$$MU-UL,\&quot;+] Sprite Main Menu\&quot;,LE=SPBM_MAIN_MENU$$LTBLUE$\n&quot;</span><span class=cF0>
<a name="l111"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Exit Sprite\&quot;,LE=SPBM_EXIT$\n&quot;</span><span class=cF0>
<a name="l112"></a> </span><span class=cF6>&quot;$MU-UL,\&quot;Abort Sprite\&quot;,LE=DOCM_CANCEL$\n&quot;</span><span class=cF0>
<a name="l113"></a> </span><span class=cF6>&quot;\nRight-Click to get back to this menu.&quot;</span><span class=cF0>, st1, st2, width);
<a name="l114"></a> res = </span><span class=cF5>PopUpMenu</span><span class=cF0>(doc);
<a name="l115"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
<a name="l116"></a>
<a name="l117"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l118"></a>}
<a name="l119"></a>
<a name="l120"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>I64</span><span class=cF0> xx1, </span><span class=cF9>I64</span><span class=cF0> yy1, </span><span class=cF9>CDC</span><span class=cF0> *img)
<a name="l121"></a>{
<a name="l122"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l123"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l124"></a>}
<a name="l125"></a>
<a name="l126"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrBitMapEdTrimToExtents</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> **_img, </span><span class=cF9>I64</span><span class=cF0> *_xx1, </span><span class=cF9>I64</span><span class=cF0> *_yy1, </span><span class=cF9>I64</span><span class=cF0> *_xx2, </span><span class=cF9>I64</span><span class=cF0> *_yy2, </span><span class=cF9>CColorROPU32</span><span class=cF0> bkcolor)
<a name="l127"></a>{
<a name="l128"></a> </span><span class=cF9>CDC</span><span class=cF0> *img = *_img;
<a name="l129"></a> </span><span class=cF9>I64</span><span class=cF0> i, c, x1 = </span><span class=cFE>0</span><span class=cF0>, y1 = </span><span class=cFE>0</span><span class=cF0>, x2 = img-&gt;width - </span><span class=cFE>1</span><span class=cF0>, y2 = img-&gt;height - </span><span class=cFE>1</span><span class=cF0>; </span><span class=cF2>//inclusive</span><span class=cF0>
<a name="l130"></a>
<a name="l131"></a> </span><span class=cF1>while</span><span class=cF0> (y1 &lt; y2)
<a name="l132"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l133"></a> </span><span class=cF1>for</span><span class=cF0> (i = x1; i &lt;= x2; i++)
<a name="l134"></a> {
<a name="l135"></a> c = </span><span class=cF5>GrPeek</span><span class=cF0>(img, i, y1);
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (c != bkcolor &amp;&amp; c != </span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l137"></a> </span><span class=cF1>goto</span><span class=cF0> tr_y2;
<a name="l138"></a> }
<a name="l139"></a> y1++;
<a name="l140"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l141"></a>
<a name="l142"></a> tr_y2:
<a name="l143"></a> </span><span class=cF1>while</span><span class=cF0> (y1 &lt; y2)
<a name="l144"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l145"></a> </span><span class=cF1>for</span><span class=cF0> (i = x1; i &lt;= x2; i++)
<a name="l146"></a> {
<a name="l147"></a> c = </span><span class=cF5>GrPeek</span><span class=cF0>(img, i, y2);
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (c != bkcolor &amp;&amp; c != </span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l149"></a> </span><span class=cF1>goto</span><span class=cF0> tr_x1;
<a name="l150"></a> }
<a name="l151"></a> y2--;
<a name="l152"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l153"></a>
<a name="l154"></a> tr_x1:
<a name="l155"></a> </span><span class=cF1>while</span><span class=cF0> (x1 &lt; x2)
<a name="l156"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l157"></a> </span><span class=cF1>for</span><span class=cF0> (i = y1; i &lt;= y2; i++)
<a name="l158"></a> {
<a name="l159"></a> c = </span><span class=cF5>GrPeek</span><span class=cF0>(img, x1, i);
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (c != bkcolor &amp;&amp; c != </span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l161"></a> </span><span class=cF1>goto</span><span class=cF0> tr_x2;
<a name="l162"></a> }
<a name="l163"></a> x1++;
<a name="l164"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l165"></a>
<a name="l166"></a> tr_x2:
<a name="l167"></a> </span><span class=cF1>while</span><span class=cF0> (x1 &lt; x2)
<a name="l168"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l169"></a> </span><span class=cF1>for</span><span class=cF0> (i = y1; i &lt;= y2; i++)
<a name="l170"></a> {
<a name="l171"></a> c = </span><span class=cF5>GrPeek</span><span class=cF0>(img, x2, i);
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (c != bkcolor &amp;&amp; c != </span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l173"></a> </span><span class=cF1>goto</span><span class=cF0> tr_done;
<a name="l174"></a> }
<a name="l175"></a> x2--;
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l177"></a>
<a name="l178"></a> tr_done:
<a name="l179"></a> *_img = </span><span class=cF5>DCExt</span><span class=cF0>(img, x1, y1, x2, y2);
<a name="l180"></a> *_xx1 += x1;
<a name="l181"></a> *_yy1 += y1;
<a name="l182"></a> *_xx2 += x2 - (img-&gt;width - </span><span class=cFE>1</span><span class=cF0>);
<a name="l183"></a> *_yy2 += y2 - (img-&gt;height - </span><span class=cFE>1</span><span class=cF0>); </span><span class=cF2>//not inclusive</span><span class=cF0>
<a name="l184"></a> </span><span class=cF5>DCDel</span><span class=cF0>(img);
<a name="l185"></a>}
<a name="l186"></a>
<a name="l187"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrBitMapEdAddOutline</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *img, </span><span class=cF9>I64</span><span class=cF0> width, </span><span class=cF9>CColorROPU32</span><span class=cF0> color, </span><span class=cF9>CColorROPU32</span><span class=cF0> bkcolor)
<a name="l188"></a>{
<a name="l189"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, k, c;
<a name="l190"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> old_color;
<a name="l191"></a> </span><span class=cF9>CDC</span><span class=cF0> *src;
<a name="l192"></a>
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (img-&gt;width &amp;&amp; img-&gt;height)
<a name="l194"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l195"></a> old_color = img-&gt;color;
<a name="l196"></a> img-&gt;color = color;
<a name="l197"></a> </span><span class=cF1>while</span><span class=cF0> (width-- &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l198"></a> {
<a name="l199"></a> src = </span><span class=cF5>DCExt</span><span class=cF0>(img, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, img-&gt;width - </span><span class=cFE>1</span><span class=cF0>, img-&gt;height - </span><span class=cFE>1</span><span class=cF0>);
<a name="l200"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; img-&gt;height; i++)
<a name="l201"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; img-&gt;width; j++)
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrPeek</span><span class=cF7>(</span><span class=cF0>src, j, i</span><span class=cF7>)</span><span class=cF0> == bkcolor)
<a name="l203"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k &lt; </span><span class=cFE>8</span><span class=cF0>; k++)
<a name="l204"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l205"></a> c = </span><span class=cF5>GrPeek</span><span class=cF0>(src, j + </span><span class=cFB>gr_x_offsets</span><span class=cF0>[k], i + </span><span class=cFB>gr_y_offsets</span><span class=cF0>[k]);
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (c &gt;= </span><span class=cFE>0</span><span class=cF0> &amp;&amp; c != bkcolor)
<a name="l207"></a> {
<a name="l208"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(img, j, i);
<a name="l209"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l210"></a> }
<a name="l211"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l212"></a> </span><span class=cF5>DCDel</span><span class=cF0>(src);
<a name="l213"></a> }
<a name="l214"></a> img-&gt;color = old_color;
<a name="l215"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l216"></a>}
<a name="l217"></a>
<a name="l218"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>GrBitMapEdEtch</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *img, </span><span class=cF9>I64</span><span class=cF0> width, </span><span class=cF9>CColorROPU32</span><span class=cF0> bkcolor)
<a name="l219"></a>{
<a name="l220"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, k, c;
<a name="l221"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> old_color;
<a name="l222"></a> </span><span class=cF9>CDC</span><span class=cF0> *src;
<a name="l223"></a>
<a name="l224"></a> </span><span class=cF1>if</span><span class=cF0> (img-&gt;width &amp;&amp; img-&gt;height)
<a name="l225"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l226"></a> old_color = img-&gt;color;
<a name="l227"></a> img-&gt;color = bkcolor;
<a name="l228"></a> </span><span class=cF1>while</span><span class=cF0> (width-- &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l229"></a> {
<a name="l230"></a> src = </span><span class=cF5>DCExt</span><span class=cF0>(img, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, img-&gt;width - </span><span class=cFE>1</span><span class=cF0>, img-&gt;height - </span><span class=cFE>1</span><span class=cF0>);
<a name="l231"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; img-&gt;height; i++)
<a name="l232"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; img-&gt;width; j++)
<a name="l233"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrPeek</span><span class=cF7>(</span><span class=cF0>src, j, i</span><span class=cF7>)</span><span class=cF0> != bkcolor)
<a name="l234"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k &lt; </span><span class=cFE>8</span><span class=cF0>; k++)
<a name="l235"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l236"></a> c = </span><span class=cF5>GrPeek</span><span class=cF0>(src, j + </span><span class=cFB>gr_x_offsets</span><span class=cF0>[k], i + </span><span class=cFB>gr_y_offsets</span><span class=cF0>[k]);
<a name="l237"></a> </span><span class=cF1>if</span><span class=cF0> (c &lt; </span><span class=cFE>0</span><span class=cF0> || c == bkcolor)
<a name="l238"></a> {
<a name="l239"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(img, j, i);
<a name="l240"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l241"></a> }
<a name="l242"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l243"></a> </span><span class=cF5>DCDel</span><span class=cF0>(src);
<a name="l244"></a> }
<a name="l245"></a> img-&gt;color = old_color;
<a name="l246"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l247"></a>}
<a name="l248"></a>
<a name="l249"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>SpriteBitMapEd</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, </span><span class=cF9>CDC</span><span class=cF0> *dc, </span><span class=cF9>I64</span><span class=cF0> *_xx1, </span><span class=cF9>I64</span><span class=cF0> *_yy1, </span><span class=cF9>I64</span><span class=cF0> *_xx2, </span><span class=cF9>I64</span><span class=cF0> *_yy2,
<a name="l250"></a> </span><span class=cF9>CDC</span><span class=cF0> **_img, </span><span class=cF9>CColorROPU32</span><span class=cF0> bkcolor)
<a name="l251"></a>{
<a name="l252"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, mode = </span><span class=cF3>SPBM_LINE</span><span class=cF0>, color = </span><span class=cF3>BLACK</span><span class=cF0>, width = </span><span class=cFE>1</span><span class=cF0>, message_code, arg1, arg2, x1, y1, x11, y11,
<a name="l253"></a> x22, y22, res, xx1 = *_xx1, yy1 = *_yy1, xx2 = *_xx2, yy2 = *_yy2, old_de_flags = doc_e-&gt;de_flags;
<a name="l254"></a> </span><span class=cF1>Bool</span><span class=cF0> down = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l255"></a> </span><span class=cF1>U8</span><span class=cF0> *st = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l256"></a> </span><span class=cF9>CEdFileName</span><span class=cF0> filename;
<a name="l257"></a> </span><span class=cF9>CDC</span><span class=cF0> *img = *_img, *clip = </span><span class=cF3>NULL</span><span class=cF0>, *undo = </span><span class=cF3>NULL</span><span class=cF0>, *dc2;
<a name="l258"></a>
<a name="l259"></a> </span><span class=cF5>SettingsPush</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/TaskSettings.html#l3"><span class=cF4>SettingsPush</span></a><span class=cF0>
<a name="l260"></a>
<a name="l261"></a> doc_e-&gt;de_flags |= </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l263"></a>
<a name="l264"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l265"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l266"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>kbd</span><span class=cF0>.scan_code &amp; </span><span class=cF3>SCF_CTRL</span><span class=cF0>)</span><span class=cF2>//grab scroll update?</span><span class=cF0>
<a name="l267"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l268"></a>
<a name="l269"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l270"></a> dc-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l271"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc, xx1 - </span><span class=cFE>1</span><span class=cF0>, yy1 - </span><span class=cFE>1</span><span class=cF0>, xx2, yy2);</span><span class=cF2>//This is done little bit too often.</span><span class=cF0>
<a name="l272"></a>
<a name="l273"></a> </span><span class=cF1>while</span><span class=cF0> (message_code = </span><span class=cF5>MessageScan</span><span class=cF7>(</span><span class=cF0>&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0> |
<a name="l274"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0> |
<a name="l275"></a> </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF7>)</span><span class=cF0>)
<a name="l276"></a> {
<a name="l277"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code)
<a name="l278"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l279"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l280"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l281"></a> {
<a name="l282"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
<a name="l283"></a> res = </span><span class=cF3>SPE_ABORT</span><span class=cF0>;
<a name="l284"></a> </span><span class=cF1>goto</span><span class=cF0> bm_key_up_done;
<a name="l285"></a>
<a name="l286"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
<a name="l287"></a> res = </span><span class=cF3>SPE_CONT</span><span class=cF0>;
<a name="l288"></a> </span><span class=cF1>goto</span><span class=cF0> bm_key_up_done;
<a name="l289"></a>
<a name="l290"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'c'</span><span class=cF0>: </span><span class=cF2>//eye-dropper</span><span class=cF0>
<a name="l291"></a> dc2 = </span><span class=cF5>DCScreenCapture</span><span class=cF0>(</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l292"></a> color = </span><span class=cF5>GrPeek</span><span class=cF0>(dc2, </span><span class=cFB>mouse</span><span class=cF0>.pos.x, </span><span class=cFB>mouse</span><span class=cF0>.pos.y) ^ </span><span class=cFE>15</span><span class=cF0>;</span><span class=cF2>//Mouse cursor is XORed.</span><span class=cF0>
<a name="l293"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc2);
<a name="l294"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l295"></a>
<a name="l296"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'t'</span><span class=cF0>: </span><span class=cF2>//Set to transparent color</span><span class=cF0>
<a name="l297"></a> color = </span><span class=cF3>TRANSPARENT</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l299"></a> }
<a name="l300"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l301"></a>
<a name="l302"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_R_DOWN</span><span class=cF0>:
<a name="l303"></a>bm_menu:
<a name="l304"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l305"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;task_title, </span><span class=cF6>&quot;Sprite BitMap Menu&quot;</span><span class=cF0>);
<a name="l306"></a> i = </span><span class=cF5>PopUpSpriteBitMap</span><span class=cF0>(color, width);
<a name="l307"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l308"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;task_title, </span><span class=cF5>DefineSub</span><span class=cF7>(</span><span class=cF0>i, </span><span class=cF6>&quot;ST_SPRITE_BITMAP_MENU&quot;</span><span class=cF7>)</span><span class=cF0>);
<a name="l309"></a> </span><span class=cF1>switch</span><span class=cF0> (i)
<a name="l310"></a> {
<a name="l311"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCM_CANCEL</span><span class=cF0>:
<a name="l312"></a> res = </span><span class=cF3>SPE_ABORT</span><span class=cF0>;
<a name="l313"></a> </span><span class=cF1>goto</span><span class=cF0> bm_done;
<a name="l314"></a>
<a name="l315"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_EXIT</span><span class=cF0>:
<a name="l316"></a> res = </span><span class=cF3>SPE_EXIT</span><span class=cF0>;
<a name="l317"></a> </span><span class=cF1>goto</span><span class=cF0> bm_done;
<a name="l318"></a>
<a name="l319"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_MAIN_MENU</span><span class=cF0>:
<a name="l320"></a> res = </span><span class=cF3>SPE_CONT</span><span class=cF0>;
<a name="l321"></a> </span><span class=cF1>goto</span><span class=cF0> bm_done;
<a name="l322"></a>
<a name="l323"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_COLOR</span><span class=cF0>:
<a name="l324"></a> i = </span><span class=cF5>PopUpColor</span><span class=cF0>(,, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l325"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l326"></a> color = i;
<a name="l327"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l328"></a>
<a name="l329"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_FIND_AND_REPLACE</span><span class=cF0>:
<a name="l330"></a> i = </span><span class=cF5>PopUpColor</span><span class=cF0>(</span><span class=cF6>&quot;Find Color\n&quot;</span><span class=cF0>,, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l331"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l332"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l333"></a> j = </span><span class=cF5>PopUpColor</span><span class=cF0>(</span><span class=cF6>&quot;Replace Color\n&quot;</span><span class=cF0>,, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l334"></a> </span><span class=cF1>if</span><span class=cF0> (j &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l335"></a> {
<a name="l336"></a> </span><span class=cF5>DCColorChange</span><span class=cF0>(img, i, j);
<a name="l337"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l338"></a> }
<a name="l339"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l340"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l341"></a>
<a name="l342"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TRIM_TO_EXTENTS</span><span class=cF0>:
<a name="l343"></a> </span><span class=cF5>GrBitMapEdTrimToExtents</span><span class=cF0>(&amp;img, &amp;xx1, &amp;yy1, &amp;xx2, &amp;yy2, bkcolor);
<a name="l344"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l345"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l346"></a>
<a name="l347"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_ADD_OUTLINE</span><span class=cF0>:
<a name="l348"></a> i = </span><span class=cF5>PopUpRangeI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>&quot;Outline Width\n&quot;</span><span class=cF0>);
<a name="l349"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l350"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l351"></a> </span><span class=cF5>GrBitMapEdAddOutline</span><span class=cF0>(img, i, color, bkcolor);
<a name="l352"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l353"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l354"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l355"></a>
<a name="l356"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_ETCH</span><span class=cF0>:
<a name="l357"></a> i = </span><span class=cF5>PopUpRangeI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>&quot;Etch Width\n&quot;</span><span class=cF0>);
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l359"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l360"></a> </span><span class=cF5>GrBitMapEdEtch</span><span class=cF0>(img, i, bkcolor);
<a name="l361"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l362"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l363"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l364"></a>
<a name="l365"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_SAVE_GR</span><span class=cF0>:
<a name="l366"></a> *filename.name = </span><span class=cFE>0</span><span class=cF0>;
<a name="l367"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DocForm</span><span class=cF7>(</span><span class=cF0>&amp;filename</span><span class=cF7>)</span><span class=cF0> &amp;&amp; *filename.name)
<a name="l368"></a> </span><span class=cF5>GRWrite</span><span class=cF0>(filename.name, img, </span><span class=cF3>DCSF_PALETTE_GET</span><span class=cF0>);
<a name="l369"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l370"></a>
<a name="l371"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_DITHER_COLOR</span><span class=cF0>:
<a name="l372"></a> i = </span><span class=cF5>PopUpColorDither</span><span class=cF0>;
<a name="l373"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l374"></a> color = i;
<a name="l375"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l376"></a>
<a name="l377"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_WIDTH</span><span class=cF0>:
<a name="l378"></a> i = </span><span class=cF5>PopUpRangeI64</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>16</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF6>&quot;Thick\n&quot;</span><span class=cF0>);
<a name="l379"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l380"></a> width = i;
<a name="l381"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l382"></a>
<a name="l383"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_UNDO</span><span class=cF0>:
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (undo)
<a name="l385"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l386"></a> </span><span class=cF5>DCFill</span><span class=cF0>(img, bkcolor);
<a name="l387"></a> img-&gt;color = </span><span class=cF3>ROP_EQU</span><span class=cF0>;
<a name="l388"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(img, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, undo);
<a name="l389"></a> </span><span class=cF5>DCDel</span><span class=cF0>(undo);
<a name="l390"></a> undo = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l391"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l392"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l393"></a>
<a name="l394"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PT</span><span class=cF0>:
<a name="l395"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_LINE</span><span class=cF0>:
<a name="l396"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_ARROW</span><span class=cF0>:
<a name="l397"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_RECT</span><span class=cF0>:
<a name="l398"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_CIRCLE</span><span class=cF0>:
<a name="l399"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_FLOOD_FILL</span><span class=cF0>:
<a name="l400"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l401"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYPT</span><span class=cF0>:
<a name="l402"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYLINE</span><span class=cF0>:
<a name="l403"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_COPY</span><span class=cF0>:
<a name="l404"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_DELETE</span><span class=cF0>:
<a name="l405"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE</span><span class=cF0>:
<a name="l406"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE_TRANSPARENT</span><span class=cF0>:
<a name="l407"></a> mode = i;
<a name="l408"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l409"></a>
<a name="l410"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT</span><span class=cF0>:
<a name="l411"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_BOX</span><span class=cF0>:
<a name="l412"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_DIAMOND</span><span class=cF0>:
<a name="l413"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l414"></a> st = </span><span class=cF5>PopUpGetStr</span><span class=cF0>(</span><span class=cF6>&quot;Enter text and press &lt;ESC&gt;.\n&quot;</span><span class=cF0>);
<a name="l415"></a> </span><span class=cF1>if</span><span class=cF0> (st &amp;&amp; *st)
<a name="l416"></a> mode = i;
<a name="l417"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l418"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l419"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l420"></a> }
<a name="l421"></a> </span><span class=cF5>DCDel</span><span class=cF0>(undo);
<a name="l422"></a> undo = </span><span class=cF5>DCExt</span><span class=cF0>(img, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, img-&gt;width - </span><span class=cFE>1</span><span class=cF0>, img-&gt;height - </span><span class=cFE>1</span><span class=cF0>);
<a name="l423"></a> undo-&gt;bkcolor=bkcolor;
<a name="l424"></a> </span><span class=cF5>Refresh</span><span class=cF0>(</span><span class=cFE>2</span><span class=cF0>, </span><span class=cF3>TRUE</span><span class=cF0>); </span><span class=cF2>//Let popup close</span><span class=cF0>
<a name="l425"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l426"></a> down = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l427"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l428"></a>
<a name="l429"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_DOWN</span><span class=cF0>:
<a name="l430"></a> </span><span class=cF1>switch</span><span class=cF0> (mode)
<a name="l431"></a> {
<a name="l432"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PT</span><span class=cF0>:
<a name="l433"></a> img-&gt;color = color;
<a name="l434"></a> img-&gt;thick = width;
<a name="l435"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1, </span><span class=cFE>0</span><span class=cF0>);
<a name="l436"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l437"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l438"></a> </span><span class=cF1>start</span><span class=cF0>:
<a name="l439"></a> </span><span class=cF1>if</span><span class=cF0> (down)
<a name="l440"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l441"></a> x1 = arg1;
<a name="l442"></a> y1 = arg2;
<a name="l443"></a> down = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l444"></a> dc-&gt;color = color;
<a name="l445"></a> dc-&gt;thick = width;
<a name="l446"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_LINE</span><span class=cF0>:
<a name="l447"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>);
<a name="l448"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l449"></a>
<a name="l450"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_ARROW</span><span class=cF0>:
<a name="l451"></a> </span><span class=cF5>GrArrow3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>);
<a name="l452"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l453"></a>
<a name="l454"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_RECT</span><span class=cF0>:
<a name="l455"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
<a name="l456"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l457"></a>
<a name="l458"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_CIRCLE</span><span class=cF0>:
<a name="l459"></a> </span><span class=cF5>GrCircle3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0>);
<a name="l460"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l461"></a>
<a name="l462"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_COPY</span><span class=cF0>:
<a name="l463"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_DELETE</span><span class=cF0>:
<a name="l464"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l465"></a> dc-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l466"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc, x1, y1, x1, y1);
<a name="l467"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l468"></a> </span><span class=cF1>end</span><span class=cF0>:
<a name="l469"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l470"></a>
<a name="l471"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE</span><span class=cF0>:
<a name="l472"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE_TRANSPARENT</span><span class=cF0>:
<a name="l473"></a> </span><span class=cF1>if</span><span class=cF0> (clip)
<a name="l474"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l475"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l476"></a> </span><span class=cF1>if</span><span class=cF0> (mode == </span><span class=cF3>SPBM_PASTE</span><span class=cF0>)
<a name="l477"></a> {
<a name="l478"></a> clip-&gt;flags |= </span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
<a name="l479"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc, arg1, arg2, clip);
<a name="l480"></a> clip-&gt;flags&amp;=~</span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
<a name="l481"></a> }
<a name="l482"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l483"></a> {
<a name="l484"></a> dc2 = </span><span class=cF5>DCCopy</span><span class=cF0>(clip);
<a name="l485"></a> </span><span class=cF5>DCColorChange</span><span class=cF0>(dc2, bkcolor);
<a name="l486"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc, arg1, arg2, dc2);
<a name="l487"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc2);
<a name="l488"></a> }
<a name="l489"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l490"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l491"></a>
<a name="l492"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT</span><span class=cF0>:
<a name="l493"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l494"></a> dc-&gt;color = color;
<a name="l495"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, arg1, arg2, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, st);
<a name="l496"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l497"></a>
<a name="l498"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_BOX</span><span class=cF0>:
<a name="l499"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l500"></a> dc-&gt;color = color;
<a name="l501"></a> </span><span class=cF5>GrTextBox3</span><span class=cF0>(dc, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>, st);
<a name="l502"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l503"></a>
<a name="l504"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_DIAMOND</span><span class=cF0>:
<a name="l505"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l506"></a> dc-&gt;color = color;
<a name="l507"></a> </span><span class=cF5>GrTextDiamond3</span><span class=cF0>(dc, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>, st);
<a name="l508"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l509"></a>
<a name="l510"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_FLOOD_FILL</span><span class=cF0>:
<a name="l511"></a> img-&gt;color = color;
<a name="l512"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1);
<a name="l513"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l514"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l515"></a>
<a name="l516"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_FLOOD_FILL_NOT</span><span class=cF0>:
<a name="l517"></a> img-&gt;color = color;
<a name="l518"></a> </span><span class=cF5>GrFloodFill</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1, </span><span class=cF3>TRUE</span><span class=cF0>);
<a name="l519"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l520"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l521"></a>
<a name="l522"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYLINE</span><span class=cF0>:
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (!down)
<a name="l524"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l525"></a> x1 = arg1;
<a name="l526"></a> y1 = arg2;
<a name="l527"></a> down = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l528"></a> dc-&gt;color = color;
<a name="l529"></a> dc-&gt;thick = width;
<a name="l530"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>);
<a name="l531"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l532"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l533"></a>
<a name="l534"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYPT</span><span class=cF0>:
<a name="l535"></a> x1 = arg1;
<a name="l536"></a> y1 = arg2;
<a name="l537"></a> down = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l538"></a> img-&gt;color = color;
<a name="l539"></a> img-&gt;thick = width;
<a name="l540"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(img, x1 - xx1, y1 - yy1, </span><span class=cFE>0</span><span class=cF0>, arg1 - xx1, arg2 - yy1, </span><span class=cFE>0</span><span class=cF0>);
<a name="l541"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l542"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l543"></a> }
<a name="l544"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l545"></a>
<a name="l546"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_MOVE</span><span class=cF0>:
<a name="l547"></a> </span><span class=cF1>switch</span><span class=cF0> (mode)
<a name="l548"></a> {
<a name="l549"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_LINE</span><span class=cF0>:
<a name="l550"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_ARROW</span><span class=cF0>:
<a name="l551"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYLINE</span><span class=cF0>:
<a name="l552"></a> </span><span class=cF1>if</span><span class=cF0> (down)
<a name="l553"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l554"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l555"></a> dc-&gt;color = color;
<a name="l556"></a> dc-&gt;thick = width;
<a name="l557"></a> </span><span class=cF1>if</span><span class=cF0> (mode == </span><span class=cF3>SPBM_ARROW</span><span class=cF0>)
<a name="l558"></a> </span><span class=cF5>GrArrow3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>);
<a name="l559"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l560"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>);
<a name="l561"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l562"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l563"></a>
<a name="l564"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_RECT</span><span class=cF0>:
<a name="l565"></a> </span><span class=cF1>if</span><span class=cF0> (down)
<a name="l566"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l567"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l568"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &lt; arg1)
<a name="l569"></a> {
<a name="l570"></a> x11 = x1;
<a name="l571"></a> x22 = arg1;
<a name="l572"></a> }
<a name="l573"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l574"></a> {
<a name="l575"></a> x11 = arg1;
<a name="l576"></a> x22 = x1;
<a name="l577"></a> }
<a name="l578"></a> </span><span class=cF1>if</span><span class=cF0> (y1 &lt; arg2)
<a name="l579"></a> {
<a name="l580"></a> y11 = y1;
<a name="l581"></a> y22 = arg2;
<a name="l582"></a> }
<a name="l583"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l584"></a> {
<a name="l585"></a> y11 = arg2;
<a name="l586"></a> y22 = y1;
<a name="l587"></a> }
<a name="l588"></a> dc-&gt;color = color;
<a name="l589"></a> </span><span class=cF5>GrRect</span><span class=cF0>(dc, x11, y11, x22 - x11 + </span><span class=cFE>1</span><span class=cF0>, y22 - y11 + </span><span class=cFE>1</span><span class=cF0>);
<a name="l590"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l591"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l592"></a>
<a name="l593"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_COPY</span><span class=cF0>:
<a name="l594"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_DELETE</span><span class=cF0>:
<a name="l595"></a> </span><span class=cF1>if</span><span class=cF0> (down)
<a name="l596"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l597"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l598"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &lt; arg1)
<a name="l599"></a> {
<a name="l600"></a> x11 = x1;
<a name="l601"></a> x22 = arg1;
<a name="l602"></a> }
<a name="l603"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l604"></a> {
<a name="l605"></a> x11 = arg1;
<a name="l606"></a> x22 = x1;
<a name="l607"></a> }
<a name="l608"></a> </span><span class=cF1>if</span><span class=cF0> (y1 &lt; arg2)
<a name="l609"></a> {
<a name="l610"></a> y11 = y1;
<a name="l611"></a> y22 = arg2;
<a name="l612"></a> }
<a name="l613"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l614"></a> {
<a name="l615"></a> y11 = arg2;
<a name="l616"></a> y22 = y1;
<a name="l617"></a> }
<a name="l618"></a> dc-&gt;color = </span><span class=cF3>ROPF_DITHER</span><span class=cF0> + </span><span class=cF3>WHITE</span><span class=cF0> &lt;&lt; </span><span class=cFE>16</span><span class=cF0> + </span><span class=cF3>BLACK</span><span class=cF0>;
<a name="l619"></a> dc-&gt;thick = </span><span class=cFE>1</span><span class=cF0>;
<a name="l620"></a> </span><span class=cF5>GrBorder</span><span class=cF0>(dc, x11, y11, x22, y22);
<a name="l621"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l622"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l623"></a>
<a name="l624"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_CIRCLE</span><span class=cF0>:
<a name="l625"></a> </span><span class=cF1>if</span><span class=cF0> (down)
<a name="l626"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l627"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l628"></a> dc-&gt;color = color;
<a name="l629"></a> dc-&gt;thick = width;
<a name="l630"></a> </span><span class=cF5>GrCircle3</span><span class=cF0>(dc, x1, y1, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF5>SqrI64</span><span class=cF0>(arg1 - x1) + </span><span class=cF5>SqrI64</span><span class=cF0>(arg2 - y1)</span><span class=cF7>)</span><span class=cF0>);
<a name="l631"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l632"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l633"></a>
<a name="l634"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE</span><span class=cF0>:
<a name="l635"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE_TRANSPARENT</span><span class=cF0>:
<a name="l636"></a> </span><span class=cF1>if</span><span class=cF0> (clip)
<a name="l637"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l638"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l639"></a> </span><span class=cF1>if</span><span class=cF0> (mode == </span><span class=cF3>SPBM_PASTE</span><span class=cF0>)
<a name="l640"></a> {
<a name="l641"></a> clip-&gt;flags |= </span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
<a name="l642"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc, arg1, arg2, clip);
<a name="l643"></a> clip-&gt;flags &amp;= ~</span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
<a name="l644"></a> }
<a name="l645"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l646"></a> {
<a name="l647"></a> dc2 = </span><span class=cF5>DCCopy</span><span class=cF0>(clip);
<a name="l648"></a> </span><span class=cF5>DCColorChange</span><span class=cF0>(dc2, bkcolor);
<a name="l649"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc, arg1, arg2, dc2);
<a name="l650"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc2);
<a name="l651"></a> }
<a name="l652"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l653"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l654"></a>
<a name="l655"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT</span><span class=cF0>:
<a name="l656"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l657"></a> dc-&gt;color = color;
<a name="l658"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(dc, arg1, arg2, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, st);
<a name="l659"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l660"></a>
<a name="l661"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_BOX</span><span class=cF0>:
<a name="l662"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l663"></a> dc-&gt;color = color;
<a name="l664"></a> </span><span class=cF5>GrTextBox3</span><span class=cF0>(dc, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>, st);
<a name="l665"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l666"></a>
<a name="l667"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_DIAMOND</span><span class=cF0>:
<a name="l668"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l669"></a> dc-&gt;color = color;
<a name="l670"></a> </span><span class=cF5>GrTextDiamond3</span><span class=cF0>(dc, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>, st);
<a name="l671"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l672"></a>
<a name="l673"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYPT</span><span class=cF0>:
<a name="l674"></a> </span><span class=cF1>if</span><span class=cF0> (down)
<a name="l675"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l676"></a> img-&gt;color = color;
<a name="l677"></a> img-&gt;thick = width;
<a name="l678"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(img, x1 - xx1, y1 - yy1, </span><span class=cFE>0</span><span class=cF0>, arg1 - xx1, arg2 - yy1, </span><span class=cFE>0</span><span class=cF0>);
<a name="l679"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l680"></a> x1 = arg1;
<a name="l681"></a> y1 = arg2;
<a name="l682"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l683"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l684"></a> }
<a name="l685"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l686"></a>
<a name="l687"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_MS_L_UP</span><span class=cF0>:
<a name="l688"></a> </span><span class=cF1>switch</span><span class=cF0> (mode)
<a name="l689"></a> {
<a name="l690"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_LINE</span><span class=cF0>:
<a name="l691"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_ARROW</span><span class=cF0>:
<a name="l692"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYPT</span><span class=cF0>:
<a name="l693"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_POLYLINE</span><span class=cF0>:
<a name="l694"></a> img-&gt;color = color;
<a name="l695"></a> img-&gt;thick = width;
<a name="l696"></a> </span><span class=cF1>if</span><span class=cF0> (mode == </span><span class=cF3>SPBM_ARROW</span><span class=cF0>)
<a name="l697"></a> </span><span class=cF5>GrArrow3</span><span class=cF0>(img, x1 - xx1, y1 - yy1, </span><span class=cFE>0</span><span class=cF0>, arg1 - xx1, arg2 - yy1, </span><span class=cFE>0</span><span class=cF0>);
<a name="l698"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l699"></a> </span><span class=cF5>GrLine3</span><span class=cF0>(img, x1 - xx1, y1 - yy1, </span><span class=cFE>0</span><span class=cF0>, arg1 - xx1, arg2 - yy1, </span><span class=cFE>0</span><span class=cF0>);
<a name="l700"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l701"></a> </span><span class=cF1>if</span><span class=cF0> (mode == </span><span class=cF3>SPBM_POLYLINE</span><span class=cF0>)
<a name="l702"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l703"></a> x1 = arg1;
<a name="l704"></a> y1 = arg2;
<a name="l705"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l706"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l707"></a> down = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l708"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l709"></a>
<a name="l710"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_RECT</span><span class=cF0>:
<a name="l711"></a> img-&gt;color = color;
<a name="l712"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &lt; arg1)
<a name="l713"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l714"></a> x11 = x1;
<a name="l715"></a> x22 = arg1;
<a name="l716"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l717"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l718"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l719"></a> x11 = arg1;
<a name="l720"></a> x22 = x1;
<a name="l721"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l722"></a> </span><span class=cF1>if</span><span class=cF0> (y1 &lt; arg2)
<a name="l723"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l724"></a> y11 = y1;
<a name="l725"></a> y22 = arg2;
<a name="l726"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l727"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l728"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l729"></a> y11 = arg2;
<a name="l730"></a> y22 = y1;
<a name="l731"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l732"></a> </span><span class=cF5>GrRect</span><span class=cF0>(img, x11 - xx1, y11 - yy1, x22 - x11 + </span><span class=cFE>1</span><span class=cF0>, y22 - y11 + </span><span class=cFE>1</span><span class=cF0>);
<a name="l733"></a> down = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l734"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l735"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l736"></a>
<a name="l737"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_COPY</span><span class=cF0>:
<a name="l738"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_DELETE</span><span class=cF0>:
<a name="l739"></a> </span><span class=cF1>if</span><span class=cF0> (x1 &lt; arg1)
<a name="l740"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l741"></a> x11 = x1;
<a name="l742"></a> x22 = arg1;
<a name="l743"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l744"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l745"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l746"></a> x11 = arg1;
<a name="l747"></a> x22 = x1;
<a name="l748"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l749"></a> </span><span class=cF1>if</span><span class=cF0> (y1 &lt; arg2)
<a name="l750"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l751"></a> y11 = y1;
<a name="l752"></a> y22 = arg2;
<a name="l753"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l754"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l755"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l756"></a> y11 = arg2;
<a name="l757"></a> y22 = y1;
<a name="l758"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l759"></a> </span><span class=cF5>DCDel</span><span class=cF0>(clip);
<a name="l760"></a> clip = </span><span class=cF5>DCExt</span><span class=cF0>(img, x11 - xx1, y11 - yy1, x22 - xx1, y22 - yy1);
<a name="l761"></a> clip-&gt;bkcolor = bkcolor;
<a name="l762"></a> </span><span class=cF1>if</span><span class=cF0> (mode == </span><span class=cF3>SPBM_DELETE</span><span class=cF0>)
<a name="l763"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l764"></a> img-&gt;color = bkcolor;
<a name="l765"></a> </span><span class=cF5>GrRect</span><span class=cF0>(img, x11 - xx1, y11 - yy1, x22 - x11 + </span><span class=cFE>1</span><span class=cF0>, y22 - y11 + </span><span class=cFE>1</span><span class=cF0>);
<a name="l766"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l767"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l768"></a>
<a name="l769"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_CIRCLE</span><span class=cF0>:
<a name="l770"></a> img-&gt;color = color;
<a name="l771"></a> img-&gt;thick = width;
<a name="l772"></a> </span><span class=cF5>GrCircle3</span><span class=cF0>(img, x1 - xx1, y1 - yy1, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF5>SqrI64</span><span class=cF0>(arg1 - x1) + </span><span class=cF5>SqrI64</span><span class=cF0>(arg2 - y1)</span><span class=cF7>)</span><span class=cF0>);
<a name="l773"></a> down = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l774"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l775"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l776"></a>
<a name="l777"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE</span><span class=cF0>:
<a name="l778"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_PASTE_TRANSPARENT</span><span class=cF0>:
<a name="l779"></a> </span><span class=cF1>if</span><span class=cF0> (clip)
<a name="l780"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l781"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l782"></a> </span><span class=cF1>if</span><span class=cF0> (mode == </span><span class=cF3>SPBM_PASTE</span><span class=cF0>)
<a name="l783"></a> {
<a name="l784"></a> clip-&gt;flags |= </span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
<a name="l785"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1, clip);
<a name="l786"></a> clip-&gt;flags &amp;= ~</span><span class=cF3>DCF_NO_TRANSPARENTS</span><span class=cF0>;
<a name="l787"></a> }
<a name="l788"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l789"></a> {
<a name="l790"></a> dc2 = </span><span class=cF5>DCCopy</span><span class=cF0>(clip);
<a name="l791"></a> </span><span class=cF5>DCColorChange</span><span class=cF0>(dc2, bkcolor);
<a name="l792"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1, dc2);
<a name="l793"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc2);
<a name="l794"></a> }
<a name="l795"></a> </span><span class=cF5>GrBitMapEdPrepPersistentDC</span><span class=cF0>(dc, xx1, yy1, img);
<a name="l796"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l797"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l798"></a>
<a name="l799"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT</span><span class=cF0>:
<a name="l800"></a> img-&gt;color = color;
<a name="l801"></a> </span><span class=cF5>GrPrint</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, st);
<a name="l802"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l803"></a>
<a name="l804"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_BOX</span><span class=cF0>:
<a name="l805"></a> img-&gt;color = color;
<a name="l806"></a> </span><span class=cF5>GrTextBox3</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1, </span><span class=cFE>0</span><span class=cF0>, st);
<a name="l807"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l808"></a>
<a name="l809"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SPBM_TEXT_DIAMOND</span><span class=cF0>:
<a name="l810"></a> img-&gt;color = color;
<a name="l811"></a> </span><span class=cF5>GrTextDiamond3</span><span class=cF0>(img, arg1 - xx1, arg2 - yy1, </span><span class=cFE>0</span><span class=cF0>, st);
<a name="l812"></a> </span><span class=cF1>goto</span><span class=cF0> bm_menu;
<a name="l813"></a> }
<a name="l814"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l815"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l816"></a> }
<a name="l817"></a> </span><span class=cF5>Refresh</span><span class=cF0>;
<a name="l818"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l819"></a>bm_key_up_done:
<a name="l820"></a> </span><span class=cF5>MessageGet</span><span class=cF0>(,, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>);
<a name="l821"></a>bm_done:
<a name="l822"></a> </span><span class=cF5>DCDel</span><span class=cF0>(clip);
<a name="l823"></a> </span><span class=cF5>DCDel</span><span class=cF0>(undo);
<a name="l824"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l825"></a> </span><span class=cF5>DCFill</span><span class=cF0>(dc);
<a name="l826"></a> </span><span class=cF5>SettingsPop</span><span class=cF0>;
<a name="l827"></a> doc_e-&gt;de_flags = old_de_flags;
<a name="l828"></a> *_img = img;
<a name="l829"></a> *_xx1 = xx1, *_yy1 = yy1, *_xx2 = xx2, *_yy2 = yy2;
<a name="l830"></a>
<a name="l831"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l832"></a>}
</span></pre></body>
</html>