templeos-info/public/Wb/Adam/Gr/GrPrimatives.HC.HTML

1854 lines
171 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrClamp</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> *left,</span><span class=cF9>I64</span><span class=cF0> *top,</span><span class=cF9>I64</span><span class=cF0> *right,</span><span class=cF9>I64</span><span class=cF0> *bottom,
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> width=0,</span><span class=cF9>I64</span><span class=cF0> height=0)
<a name="l5"></a>{</span><span class=cF2>//Returns scrn, not window coordinates.</span><span class=cF0>
<a name="l6"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task;
<a name="l7"></a> *left=0;
<a name="l8"></a> *top=0;
<a name="l9"></a> *right=dc-&gt;width-1;
<a name="l10"></a> *bottom=dc-&gt;height-1;
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l12"></a> win_task=dc-&gt;win_task;
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>GR_WIDTH</span><span class=cF0>-1&lt;*right)
<a name="l14"></a> *right=</span><span class=cF3>GR_WIDTH</span><span class=cF0>-1;
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-1&lt;*bottom)
<a name="l16"></a> *bottom=</span><span class=cF3>GR_HEIGHT</span><span class=cF0>-1;
<a name="l17"></a> </span><span class=cF1>if</span><span class=cF0> (win_task-&gt;pix_left&gt;*left)
<a name="l18"></a> *left=win_task-&gt;pix_left;
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (win_task-&gt;pix_top&gt;*top)
<a name="l20"></a> *top=win_task-&gt;pix_top;
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (win_task-&gt;pix_right&lt;*right)
<a name="l22"></a> *right=win_task-&gt;pix_right;
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (win_task-&gt;pix_bottom&lt;*bottom)
<a name="l24"></a> *bottom=win_task-&gt;pix_bottom;
<a name="l25"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l26"></a> *left-=width;
<a name="l27"></a> *right+=width;
<a name="l28"></a> *top-=height;
<a name="l29"></a> *bottom+=height;
<a name="l30"></a> </span><span class=cF1>return</span><span class=cF0> *left&lt;=*right &amp;&amp; *top&lt;=*bottom;
<a name="l31"></a>}
<a name="l32"></a>
<a name="l33"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DCClipLine</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> *x1,</span><span class=cF9>I64</span><span class=cF0> *y1,</span><span class=cF9>I64</span><span class=cF0> *x2,</span><span class=cF9>I64</span><span class=cF0> *y2,
<a name="l34"></a> </span><span class=cF9>I64</span><span class=cF0> width=0,</span><span class=cF9>I64</span><span class=cF0> height=0)
<a name="l35"></a>{</span><span class=cF2>//Also converts window to scrn coordinates</span><span class=cF0>
<a name="l36"></a> </span><span class=cF9>I64</span><span class=cF0> left,top,right,bottom;
<a name="l37"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task;
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrClamp</span><span class=cF7>(</span><span class=cF0>dc,&amp;left,&amp;top,&amp;right,&amp;bottom,width,height</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) {
<a name="l40"></a> win_task=dc-&gt;win_task;
<a name="l41"></a> *x1+=win_task-&gt;pix_left+win_task-&gt;scroll_x;
<a name="l42"></a> *y1+=win_task-&gt;pix_top+win_task-&gt;scroll_y;
<a name="l43"></a> *x2+=win_task-&gt;pix_left+win_task-&gt;scroll_x;
<a name="l44"></a> *y2+=win_task-&gt;pix_top+win_task-&gt;scroll_y;
<a name="l45"></a> }
<a name="l46"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>ClipLine</span><span class=cF0>(x1,y1,x2,y2,left,top,right,bottom);
<a name="l47"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l48"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l49"></a>}
<a name="l50"></a>
<a name="l51"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrPlot</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l52"></a>{</span><span class=cF2>//2D. Clipping but No transformation or thick.</span><span class=cF0>
<a name="l53"></a> </span><span class=cF9>I32</span><span class=cF0> *db=dc-&gt;depth_buf;
<a name="l54"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task;
<a name="l55"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> old_color;
<a name="l56"></a> dc-&gt;depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l57"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;brush) </span><span class=cF7>{</span><span class=cF0>
<a name="l58"></a> old_color=dc-&gt;color;
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.rop!=</span><span class=cF3>ROPB_COLLISION</span><span class=cF0>)
<a name="l60"></a> dc-&gt;color.c0.rop=</span><span class=cF3>ROPB_MONO</span><span class=cF0>;
<a name="l61"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc,x,y,dc-&gt;brush);
<a name="l62"></a> dc-&gt;color=old_color;
<a name="l63"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l64"></a> win_task=dc-&gt;win_task;
<a name="l65"></a> x+=win_task-&gt;pix_left+win_task-&gt;scroll_x;
<a name="l66"></a> y+=win_task-&gt;pix_top+win_task-&gt;scroll_y;
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (win_task-&gt;pix_left&lt;=x&lt;=win_task-&gt;pix_right &amp;&amp;
<a name="l68"></a> win_task-&gt;pix_top&lt;=y&lt;=win_task-&gt;pix_bottom &amp;&amp;
<a name="l69"></a> 0&lt;=x&lt;dc-&gt;width &amp;&amp; 0&lt;=y&lt;dc-&gt;height &amp;&amp;
<a name="l70"></a> </span><span class=cF7>(</span><span class=cF0>win_task-&gt;next_task==</span><span class=cFB>sys_winmgr_task</span><span class=cF0> ||
<a name="l71"></a> dc-&gt;flags&amp;</span><span class=cF3>DCF_ON_TOP</span><span class=cF0> ||
<a name="l72"></a> !</span><span class=cF5>IsPixCovered0</span><span class=cF0>(win_task,x,y)</span><span class=cF7>)</span><span class=cF0>)
<a name="l73"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x,y);
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=x&lt;dc-&gt;width &amp;&amp; 0&lt;=y&lt;dc-&gt;height)
<a name="l76"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x,y);
<a name="l77"></a> dc-&gt;depth_buf=db;
<a name="l78"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l79"></a>}
<a name="l80"></a>
<a name="l81"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrPlot1</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l82"></a>{</span><span class=cF2>//Clipping but No transformation or thick, called with db_z set</span><span class=cF0>
<a name="l83"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task;
<a name="l84"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> old_color;
<a name="l85"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;brush) </span><span class=cF7>{</span><span class=cF0>
<a name="l86"></a> old_color=dc-&gt;color;
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.rop!=</span><span class=cF3>ROPB_COLLISION</span><span class=cF0>)
<a name="l88"></a> dc-&gt;color.c0.rop=</span><span class=cF3>ROPB_MONO</span><span class=cF0>;
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;depth_buf)
<a name="l90"></a> </span><span class=cF5>GrBlot3</span><span class=cF0>(dc,x,y,dc-&gt;db_z,dc-&gt;brush);
<a name="l91"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l92"></a> </span><span class=cF5>GrBlot</span><span class=cF0>(dc,x,y,dc-&gt;brush);
<a name="l93"></a> dc-&gt;color=old_color;
<a name="l94"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l95"></a> win_task=dc-&gt;win_task;
<a name="l96"></a> x+=win_task-&gt;pix_left+win_task-&gt;scroll_x;
<a name="l97"></a> y+=win_task-&gt;pix_top+win_task-&gt;scroll_y;
<a name="l98"></a> </span><span class=cF1>if</span><span class=cF0> (win_task-&gt;pix_left&lt;=x&lt;=win_task-&gt;pix_right &amp;&amp;
<a name="l99"></a> win_task-&gt;pix_top &lt;=y&lt;=win_task-&gt;pix_bottom &amp;&amp;
<a name="l100"></a> 0&lt;=x&lt;dc-&gt;width &amp;&amp; 0&lt;=y&lt;dc-&gt;height &amp;&amp;
<a name="l101"></a> </span><span class=cF7>(</span><span class=cF0>win_task-&gt;next_task==</span><span class=cFB>sys_winmgr_task</span><span class=cF0> ||
<a name="l102"></a> dc-&gt;flags&amp;</span><span class=cF3>DCF_ON_TOP</span><span class=cF0> ||
<a name="l103"></a> !</span><span class=cF5>IsPixCovered0</span><span class=cF0>(win_task,x,y)</span><span class=cF7>)</span><span class=cF0>)
<a name="l104"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x,y);
<a name="l105"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (0&lt;=x&lt;dc-&gt;width &amp;&amp; 0&lt;=y&lt;dc-&gt;height)
<a name="l107"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x,y);
<a name="l108"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l109"></a>}
<a name="l110"></a>
<a name="l111"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrPeek</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y)
<a name="l112"></a>{</span><span class=cF2>//2D. Clipping but no transformation.</span><span class=cF0>
<a name="l113"></a></span><span class=cF2>//Returns pix color or -1 if off-scrn or covered.</span><span class=cF0>
<a name="l114"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task;
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l116"></a> win_task=dc-&gt;win_task;
<a name="l117"></a> x+=win_task-&gt;pix_left+win_task-&gt;scroll_x;
<a name="l118"></a> y+=win_task-&gt;pix_top+win_task-&gt;scroll_y;
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>win_task-&gt;pix_left&lt;=x&lt;=win_task-&gt;pix_right</span><span class=cF7>)</span><span class=cF0> ||
<a name="l120"></a> !</span><span class=cF7>(</span><span class=cF0>win_task-&gt;pix_top &lt;=y&lt;=win_task-&gt;pix_bottom</span><span class=cF7>)</span><span class=cF0> ||
<a name="l121"></a> !</span><span class=cF7>(</span><span class=cF0>0&lt;=x&lt;dc-&gt;width</span><span class=cF7>)</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>0&lt;=y&lt;dc-&gt;height</span><span class=cF7>)</span><span class=cF0> ||
<a name="l122"></a> win_task-&gt;next_task!=</span><span class=cFB>sys_winmgr_task</span><span class=cF0> &amp;&amp;
<a name="l123"></a> !</span><span class=cF7>(</span><span class=cF0>dc-&gt;flags&amp;</span><span class=cF3>DCF_ON_TOP</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l124"></a> </span><span class=cF5>IsPixCovered0</span><span class=cF7>(</span><span class=cF0>win_task,x,y</span><span class=cF7>)</span><span class=cF0>)
<a name="l125"></a> </span><span class=cF1>return</span><span class=cF0> -1;
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>0&lt;=x&lt;dc-&gt;width</span><span class=cF7>)</span><span class=cF0> || !</span><span class=cF7>(</span><span class=cF0>0&lt;=y&lt;dc-&gt;height</span><span class=cF7>)</span><span class=cF0>)
<a name="l128"></a> </span><span class=cF1>return</span><span class=cF0> -1;
<a name="l129"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>GrPeek0</span><span class=cF0>(dc,x,y);
<a name="l130"></a>}
<a name="l131"></a>
<a name="l132"></a></span><span class=cF2>/*</span><span class=cF0>
<a name="l133"></a>
<a name="l134"></a></span><span class=cF2>This is an easier to understand</span><span class=cF0>
<a name="l135"></a></span><span class=cF2>version of the nonrecursive routine below.</span><span class=cF0>
<a name="l136"></a></span><span class=cF2>I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)</span><span class=cF0>
<a name="l137"></a></span><span class=cF2>{</span><span class=cF0>
<a name="l138"></a></span><span class=cF2> I64 res,j,x1,ray_len,ray_len2;</span><span class=cF0>
<a name="l139"></a>
<a name="l140"></a></span><span class=cF2> if (UnusedStk&lt;0x80)</span><span class=cF0>
<a name="l141"></a></span><span class=cF2> Panic(&quot;Stk Overflow&quot;,Fs);</span><span class=cF0>
<a name="l142"></a>
<a name="l143"></a></span><span class=cF2> res=ray_len=GrRayLen(dc,&amp;x,y,z,db);</span><span class=cF0>
<a name="l144"></a></span><span class=cF2> y--;</span><span class=cF0>
<a name="l145"></a></span><span class=cF2> j=ray_len;</span><span class=cF0>
<a name="l146"></a></span><span class=cF2> x1=x;</span><span class=cF0>
<a name="l147"></a></span><span class=cF2> while (j&gt;0) {</span><span class=cF0>
<a name="l148"></a></span><span class=cF2> if (ray_len2=GrRayLenMinus(dc,x1,y))</span><span class=cF0>
<a name="l149"></a></span><span class=cF2> res+=GrFloodFillRay(dc,x1,y,z,db);</span><span class=cF0>
<a name="l150"></a></span><span class=cF2> j-=ray_len2+1;</span><span class=cF0>
<a name="l151"></a></span><span class=cF2> x1-=ray_len2+1;</span><span class=cF0>
<a name="l152"></a></span><span class=cF2> }</span><span class=cF0>
<a name="l153"></a></span><span class=cF2> y+=2;</span><span class=cF0>
<a name="l154"></a></span><span class=cF2> j=ray_len;</span><span class=cF0>
<a name="l155"></a></span><span class=cF2> x1=x;</span><span class=cF0>
<a name="l156"></a></span><span class=cF2> while (j&gt;0) {</span><span class=cF0>
<a name="l157"></a></span><span class=cF2> if (ray_len2=GrRayLenMinus(dc,x1,y))</span><span class=cF0>
<a name="l158"></a></span><span class=cF2> res+=GrFloodFillRay(dc,x1,y,z,db);</span><span class=cF0>
<a name="l159"></a></span><span class=cF2> j-=ray_len2+1;</span><span class=cF0>
<a name="l160"></a></span><span class=cF2> x1-=ray_len2+1;</span><span class=cF0>
<a name="l161"></a></span><span class=cF2> }</span><span class=cF0>
<a name="l162"></a></span><span class=cF2> return res;</span><span class=cF0>
<a name="l163"></a></span><span class=cF2>}</span><span class=cF0>
<a name="l164"></a></span><span class=cF2>*/</span><span class=cF0>
<a name="l165"></a>
<a name="l166"></a></span><span class=cF1>class</span><span class=cF0> </span><span class=cF9>CFFRay</span><span class=cF0>
<a name="l167"></a>{
<a name="l168"></a> </span><span class=cF9>I64</span><span class=cF0> state,x,y,j,x1,ray_len,ray_len2;
<a name="l169"></a>};
<a name="l170"></a>
<a name="l171"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrFloodFillRay</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z,</span><span class=cF9>I32</span><span class=cF0> *db)
<a name="l172"></a>{</span><span class=cF2>//See the above commented-out routine for an easier to understand version.</span><span class=cF0>
<a name="l173"></a></span><span class=cF2>//Returns cnt of pixs changed</span><span class=cF0>
<a name="l174"></a> </span><span class=cF9>I64</span><span class=cF0> res=0;
<a name="l175"></a></span><span class=cF2>//We don't dynamically calculate the size to avoid</span><span class=cF0>
<a name="l176"></a> </span><span class=cF2>//fragmentation of memory.</span><span class=cF0>
<a name="l177"></a> </span><span class=cF9>CFFRay</span><span class=cF0> *f_dc=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CFFRay</span><span class=cF7>)</span><span class=cF0>*0x80000),*f=f_dc;
<a name="l178"></a> f-&gt;x=x;
<a name="l179"></a> f-&gt;y=y;
<a name="l180"></a> f-&gt;state=0;
<a name="l181"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l182"></a> </span><span class=cF1>switch</span><span class=cF0> [f-&gt;state] {
<a name="l183"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l184"></a> f-&gt;state++;
<a name="l185"></a> res+=f-&gt;ray_len=</span><span class=cF5>GrRayLen</span><span class=cF0>(dc,&amp;f-&gt;x,f-&gt;y,z,db);
<a name="l186"></a> f-&gt;y--;
<a name="l187"></a> f-&gt;j=f-&gt;ray_len;
<a name="l188"></a> f-&gt;x1=f-&gt;x;
<a name="l189"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l190"></a> </span><span class=cF1>case</span><span class=cF0> 1:
<a name="l191"></a> </span><span class=cF1>if</span><span class=cF0> (f-&gt;j&gt;0) </span><span class=cF7>{</span><span class=cF0>
<a name="l192"></a> f-&gt;state++;
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (f-&gt;ray_len2=</span><span class=cF5>GrRayLenMinus</span><span class=cF7>(</span><span class=cF0>dc,f-&gt;x1,f-&gt;y</span><span class=cF7>)</span><span class=cF0>) {
<a name="l194"></a> f[1].x=f-&gt;x1;
<a name="l195"></a> f[1].y=f-&gt;y;
<a name="l196"></a> f[1].state=0;
<a name="l197"></a> f++;
<a name="l198"></a> }
<a name="l199"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l200"></a> f-&gt;state+=2;
<a name="l201"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l202"></a> </span><span class=cF1>case</span><span class=cF0> 2:
<a name="l203"></a> f-&gt;state--;
<a name="l204"></a> f-&gt;j-=f-&gt;ray_len2+1;
<a name="l205"></a> f-&gt;x1-=f-&gt;ray_len2+1;
<a name="l206"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l207"></a> </span><span class=cF1>case</span><span class=cF0> 3:
<a name="l208"></a> f-&gt;state++;
<a name="l209"></a> f-&gt;y+=2;
<a name="l210"></a> f-&gt;j=f-&gt;ray_len;
<a name="l211"></a> f-&gt;x1=f-&gt;x;
<a name="l212"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l213"></a> </span><span class=cF1>case</span><span class=cF0> 4:
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (f-&gt;j&gt;0) </span><span class=cF7>{</span><span class=cF0>
<a name="l215"></a> f-&gt;state++;
<a name="l216"></a> </span><span class=cF1>if</span><span class=cF0> (f-&gt;ray_len2=</span><span class=cF5>GrRayLenMinus</span><span class=cF7>(</span><span class=cF0>dc,f-&gt;x1,f-&gt;y</span><span class=cF7>)</span><span class=cF0>) {
<a name="l217"></a> f[1].x=f-&gt;x1;
<a name="l218"></a> f[1].y=f-&gt;y;
<a name="l219"></a> f[1].state=0;
<a name="l220"></a> f++;
<a name="l221"></a> }
<a name="l222"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l223"></a> f-&gt;state+=2;
<a name="l224"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l225"></a> </span><span class=cF1>case</span><span class=cF0> 5:
<a name="l226"></a> f-&gt;state--;
<a name="l227"></a> f-&gt;j-=f-&gt;ray_len2+1;
<a name="l228"></a> f-&gt;x1-=f-&gt;ray_len2+1;
<a name="l229"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l230"></a> </span><span class=cF1>case</span><span class=cF0> 6:
<a name="l231"></a> f--;
<a name="l232"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l233"></a> }
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (f&gt;=f_dc);
<a name="l235"></a> </span><span class=cF5>Free</span><span class=cF0>(f_dc);
<a name="l236"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l237"></a>}
<a name="l238"></a>
<a name="l239"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrFloodFill</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,
<a name="l240"></a> </span><span class=cF1>Bool</span><span class=cF0> not_color=</span><span class=cF3>FALSE</span><span class=cF0>,</span><span class=cF9>I64</span><span class=cF0> z=0,</span><span class=cF9>I32</span><span class=cF0> *db=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l241"></a>{</span><span class=cF2>//2D. Ignore z and db.</span><span class=cF0>
<a name="l242"></a></span><span class=cF2>//not_color=TRUE means fill up to everything which is not the current color.</span><span class=cF0>
<a name="l243"></a> </span><span class=cF2>//not_color=FALSE means fill all parts equ to the color under the point.</span><span class=cF0>
<a name="l244"></a> </span><span class=cF2>//Returns cnt of pixs changed</span><span class=cF0>
<a name="l245"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,j,old_flags=dc-&gt;flags;
<a name="l246"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> old_color2=dc-&gt;color2;
<a name="l247"></a> </span><span class=cF9>CDC</span><span class=cF0> *old_brush;
<a name="l248"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_DONT_DRAW</span><span class=cF0>) </span><span class=cF2>//TODO</span><span class=cF0>
<a name="l249"></a> </span><span class=cF1>return</span><span class=cF0> 0;
<a name="l250"></a> old_brush=dc-&gt;brush;
<a name="l251"></a> dc-&gt;brush=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l252"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>j=</span><span class=cF5>GrPeek</span><span class=cF0>(dc,x,y)</span><span class=cF7>)</span><span class=cF0>&gt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l253"></a> </span><span class=cF1>if</span><span class=cF0> (not_color) {
<a name="l254"></a> dc-&gt;color2=dc-&gt;color.c0.color;
<a name="l255"></a> dc-&gt;flags|=</span><span class=cF3>DCF_FILL_NOT_COLOR</span><span class=cF0>;
<a name="l256"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l257"></a> dc-&gt;color2=j;
<a name="l258"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c1.rop&amp;</span><span class=cF3>ROPBF_DITHER</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color2.c0.color==dc-&gt;color.c0.color &amp;&amp;
<a name="l260"></a> dc-&gt;color.c0.color==dc-&gt;color.c1.color)
<a name="l261"></a> </span><span class=cF1>goto</span><span class=cF0> ff_done;
<a name="l262"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color2.c0.color==dc-&gt;color.c0.color)
<a name="l263"></a> </span><span class=cF1>goto</span><span class=cF0> ff_done;
<a name="l264"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_FILL_NOT_COLOR</span><span class=cF0>;
<a name="l265"></a> }
<a name="l266"></a> </span><span class=cF1>if</span><span class=cF0> (not_color &amp;&amp; j!=dc-&gt;color2 ||
<a name="l267"></a> !not_color)
<a name="l268"></a> res=</span><span class=cF5>GrFloodFillRay</span><span class=cF0>(dc,x,y,z,db);
<a name="l269"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l270"></a>ff_done:
<a name="l271"></a> dc-&gt;brush=old_brush;
<a name="l272"></a> dc-&gt;flags=old_flags;
<a name="l273"></a> dc-&gt;color2=old_color2;
<a name="l274"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l275"></a>}
<a name="l276"></a>
<a name="l277"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,</span><span class=cF9>I64</span><span class=cF0> z=0,</span><span class=cF9>I64</span><span class=cF0> diameter,</span><span class=cF9>I64</span><span class=cF0> n)
<a name="l278"></a>{</span><span class=cF2>//2D. Clipping but not transformation.</span><span class=cF0>
<a name="l279"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,i,k,r=diameter&gt;&gt;1,rr;
<a name="l280"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&gt;=1)
<a name="l281"></a> </span><span class=cF1>switch</span><span class=cF0> (n) </span><span class=cF7>{</span><span class=cF0>
<a name="l282"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l283"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l284"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l285"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cx,
<a name="l286"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cx,cy+i-r,z,z);
<a name="l287"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l288"></a> k=diameter+1;
<a name="l289"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l290"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l291"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cx,
<a name="l292"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cx,cy+i-r,z,z);
<a name="l293"></a> }
<a name="l294"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l295"></a> </span><span class=cF1>case</span><span class=cF0> 1:
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l297"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;diameter;i++)
<a name="l298"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cx,
<a name="l299"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cx,cy+i-r,z,z);
<a name="l300"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l301"></a> k=diameter+1;
<a name="l302"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l303"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;k;i++)
<a name="l304"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cx,
<a name="l305"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cx,cy+i-r,z,z);
<a name="l306"></a> }
<a name="l307"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l308"></a> </span><span class=cF1>case</span><span class=cF0> 2:
<a name="l309"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l310"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l311"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cy,
<a name="l312"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cy,z,z);
<a name="l313"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l314"></a> k=diameter+1;
<a name="l315"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l316"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l317"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cy,
<a name="l318"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cy,z,z);
<a name="l319"></a> }
<a name="l320"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l321"></a> </span><span class=cF1>case</span><span class=cF0> 3:
<a name="l322"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l323"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;diameter;i++)
<a name="l324"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cy,
<a name="l325"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cy,z,z);
<a name="l326"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l327"></a> k=diameter+1;
<a name="l328"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l329"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;k;i++)
<a name="l330"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cy,
<a name="l331"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cy,z,z);
<a name="l332"></a> }
<a name="l333"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l334"></a> </span><span class=cF1>case</span><span class=cF0> 4:
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l336"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l337"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cx,
<a name="l338"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cx,cy+i-r,z,z);
<a name="l339"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l340"></a> k=diameter+1;
<a name="l341"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l342"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l343"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cx,
<a name="l344"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cx,cy+i-r,z,z);
<a name="l345"></a> }
<a name="l346"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l347"></a> </span><span class=cF1>case</span><span class=cF0> 5:
<a name="l348"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l349"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;diameter;i++)
<a name="l350"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cx,
<a name="l351"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cx,cy+i-r,z,z);
<a name="l352"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l353"></a> k=diameter+1;
<a name="l354"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l355"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;k;i++)
<a name="l356"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cx,
<a name="l357"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cx,cy+i-r,z,z);
<a name="l358"></a> }
<a name="l359"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l360"></a> </span><span class=cF1>case</span><span class=cF0> 6:
<a name="l361"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l362"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l363"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cy,
<a name="l364"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cy,z,z);
<a name="l365"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l366"></a> k=diameter+1;
<a name="l367"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l368"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;r;i++)
<a name="l369"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cy,
<a name="l370"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cy,z,z);
<a name="l371"></a> }
<a name="l372"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l373"></a> </span><span class=cF1>case</span><span class=cF0> 7:
<a name="l374"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l375"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;diameter;i++)
<a name="l376"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cy,
<a name="l377"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cy,z,z);
<a name="l378"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l379"></a> k=diameter+1;
<a name="l380"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l381"></a> </span><span class=cF1>for</span><span class=cF0> (i=r+1;i&lt;k;i++)
<a name="l382"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,cx+i-r,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cy,
<a name="l383"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cy,z,z);
<a name="l384"></a> }
<a name="l385"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l386"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l387"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l388"></a>}
<a name="l389"></a>
<a name="l390"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrFillCircle</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,</span><span class=cF9>I64</span><span class=cF0> z=0,</span><span class=cF9>I64</span><span class=cF0> diameter)
<a name="l391"></a>{</span><span class=cF2>//2D. Clipping but not transformation.</span><span class=cF0>
<a name="l392"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,i,k,r=diameter&gt;&gt;1,rr;
<a name="l393"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&gt;=1) </span><span class=cF7>{</span><span class=cF0>
<a name="l394"></a> </span><span class=cF1>if</span><span class=cF0> (diameter&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>)
<a name="l395"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;diameter;i++)
<a name="l396"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,</span><span class=cFB>gr</span><span class=cF0>.circle_lo[diameter][i]+cx,
<a name="l397"></a> </span><span class=cFB>gr</span><span class=cF0>.circle_hi[diameter][i]+cx,cy+i-r,z,z);
<a name="l398"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l399"></a> k=diameter+1;
<a name="l400"></a> rr=</span><span class=cF5>SqrI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>k+1</span><span class=cF7>)</span><span class=cF0>&gt;&gt;1);
<a name="l401"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;=r;i++)
<a name="l402"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cx,
<a name="l403"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(r-i)</span><span class=cF7>)</span><span class=cF0>+cx,cy+i-r,z,z);
<a name="l404"></a> </span><span class=cF1>for</span><span class=cF0> (;i&lt;k;i++)
<a name="l405"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,-</span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cx,
<a name="l406"></a> </span><span class=cF5>Sqrt</span><span class=cF7>(</span><span class=cF0>rr-</span><span class=cF5>SqrI64</span><span class=cF0>(i-r)</span><span class=cF7>)</span><span class=cF0>+cx,cy+i-r,z,z);
<a name="l407"></a> }
<a name="l408"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l409"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l410"></a>}
<a name="l411"></a>
<a name="l412"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrPlot3B</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z)
<a name="l413"></a>{</span><span class=cF2>//3D. Clipping and transformation but no thick.</span><span class=cF0>
<a name="l414"></a> </span><span class=cF9>I64</span><span class=cF0> _x,_y,_z;
<a name="l415"></a> </span><span class=cF1>Bool</span><span class=cF0> was_transform=</span><span class=cF3>FALSE</span><span class=cF0>,was_symmetry=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l416"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l417"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l418"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l419"></a> was_transform=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l420"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l421"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l422"></a> _x=x; _y=y; _z=z;
<a name="l423"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x,&amp;_y,&amp;_z);
<a name="l424"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l425"></a> dc-&gt;db_z=_z;
<a name="l426"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,_x,_y);
<a name="l427"></a> was_symmetry=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l428"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags&amp;</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l429"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l430"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l431"></a> dc-&gt;db_z=z;
<a name="l432"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,x,y);
<a name="l433"></a>gr_done:
<a name="l434"></a> </span><span class=cF1>if</span><span class=cF0> (was_transform)
<a name="l435"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l436"></a> </span><span class=cF1>if</span><span class=cF0> (was_symmetry)
<a name="l437"></a> dc-&gt;flags|=</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l438"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l439"></a>}
<a name="l440"></a>
<a name="l441"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrPlot3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z)
<a name="l442"></a>{</span><span class=cF2>//3D. Clipping and transformation and thick.</span><span class=cF0>
<a name="l443"></a> </span><span class=cF9>I64</span><span class=cF0> _x,_y,_z,w,dist;
<a name="l444"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> old_color=dc-&gt;color;
<a name="l445"></a> </span><span class=cF1>Bool</span><span class=cF0> record,was_transform=</span><span class=cF3>FALSE</span><span class=cF0>,was_symmetry=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l446"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task;
<a name="l447"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l448"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l449"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l450"></a> was_transform=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l451"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l452"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l453"></a> _x=x; _y=y; _z=z;
<a name="l454"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x,&amp;_y,&amp;_z);
<a name="l455"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l456"></a> </span><span class=cF5>GrPlot3</span><span class=cF0>(dc,_x,_y,_z);
<a name="l457"></a> was_symmetry=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l458"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags&amp;</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l459"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l460"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l461"></a> w=dc-&gt;thick&gt;&gt;1;
<a name="l462"></a> dc-&gt;db_z=z;
<a name="l463"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;brush || w&lt;=0)
<a name="l464"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,x,y);
<a name="l465"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;thick&lt;</span><span class=cF3>GR_PEN_BRUSHES_NUM</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l466"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.rop!=</span><span class=cF3>ROPB_COLLISION</span><span class=cF0>)
<a name="l467"></a> dc-&gt;color.c0.rop=</span><span class=cF3>ROPB_MONO</span><span class=cF0>;
<a name="l468"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;depth_buf) {
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c1.rop&amp;</span><span class=cF3>ROPBF_DITHER</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l470"></a> dc-&gt;color.c1.rop=dc-&gt;color.c0.rop;
<a name="l471"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>(x-w)^(y-w)</span><span class=cF7>)</span><span class=cF0>&amp;1) {
<a name="l472"></a> record=</span><span class=cF5>GrBlot3</span><span class=cF0>(dc,x-w,y-w,z,</span><span class=cFB>gr</span><span class=cF0>.odd_pen_brushes[dc-&gt;thick]);
<a name="l473"></a> dc-&gt;color.c0=dc-&gt;color.c1;
<a name="l474"></a> record=</span><span class=cF5>GrBlot3</span><span class=cF0>(dc,x-w,y-w,z,</span><span class=cFB>gr</span><span class=cF0>.even_pen_brushes[dc-&gt;thick]);
<a name="l475"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l476"></a> record=</span><span class=cF5>GrBlot3</span><span class=cF0>(dc,x-w,y-w,z,</span><span class=cFB>gr</span><span class=cF0>.even_pen_brushes[dc-&gt;thick]);
<a name="l477"></a> dc-&gt;color.c0=dc-&gt;color.c1;
<a name="l478"></a> record=</span><span class=cF5>GrBlot3</span><span class=cF0>(dc,x-w,y-w,z,</span><span class=cFB>gr</span><span class=cF0>.odd_pen_brushes[dc-&gt;thick]);
<a name="l479"></a> }
<a name="l480"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l481"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.rop==</span><span class=cF3>ROPB_COLLISION</span><span class=cF0>) {
<a name="l482"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.color!=dc-&gt;bkcolor.c0.color &amp;&amp;
<a name="l483"></a> dc-&gt;color.c0.color!=</span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l484"></a> record=</span><span class=cF5>GrBlot3</span><span class=cF0>(dc,x-w,y-w,z,
<a name="l485"></a> </span><span class=cFB>gr</span><span class=cF0>.collision_pen_brushes[dc-&gt;thick]);
<a name="l486"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l487"></a> record=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l488"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l489"></a> record=</span><span class=cF5>GrBlot3</span><span class=cF0>(dc,x-w,y-w,z,</span><span class=cFB>gr</span><span class=cF0>.pen_brushes[dc-&gt;thick]);
<a name="l490"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l491"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l492"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c1.rop&amp;</span><span class=cF3>ROPBF_DITHER</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l493"></a> dc-&gt;color.c1.rop=dc-&gt;color.c0.rop;
<a name="l494"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>(x-w)^(y-w)</span><span class=cF7>)</span><span class=cF0>&amp;1) {
<a name="l495"></a> record=</span><span class=cF5>GrBlot</span><span class=cF0>(dc,x-w,y-w,</span><span class=cFB>gr</span><span class=cF0>.odd_pen_brushes[dc-&gt;thick]);
<a name="l496"></a> dc-&gt;color.c0=dc-&gt;color.c1;
<a name="l497"></a> record=</span><span class=cF5>GrBlot</span><span class=cF0>(dc,x-w,y-w,</span><span class=cFB>gr</span><span class=cF0>.even_pen_brushes[dc-&gt;thick]);
<a name="l498"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l499"></a> record=</span><span class=cF5>GrBlot</span><span class=cF0>(dc,x-w,y-w,</span><span class=cFB>gr</span><span class=cF0>.even_pen_brushes[dc-&gt;thick]);
<a name="l500"></a> dc-&gt;color.c0=dc-&gt;color.c1;
<a name="l501"></a> record=</span><span class=cF5>GrBlot</span><span class=cF0>(dc,x-w,y-w,</span><span class=cFB>gr</span><span class=cF0>.odd_pen_brushes[dc-&gt;thick]);
<a name="l502"></a> }
<a name="l503"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l504"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.rop==</span><span class=cF3>ROPB_COLLISION</span><span class=cF0>) {
<a name="l505"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.color!=dc-&gt;bkcolor.c0.color &amp;&amp;
<a name="l506"></a> dc-&gt;color.c0.color!=</span><span class=cF3>TRANSPARENT</span><span class=cF0>)
<a name="l507"></a> record=</span><span class=cF5>GrBlot</span><span class=cF0>(dc,x-w,y-w,</span><span class=cFB>gr</span><span class=cF0>.collision_pen_brushes[dc-&gt;thick]);
<a name="l508"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l509"></a> record=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l510"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l511"></a> record=</span><span class=cF5>GrBlot</span><span class=cF0>(dc,x-w,y-w,</span><span class=cFB>gr</span><span class=cF0>.pen_brushes[dc-&gt;thick]);
<a name="l512"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l513"></a> }
<a name="l514"></a> </span><span class=cF1>if</span><span class=cF0> (record) {
<a name="l515"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l516"></a> win_task=dc-&gt;win_task;
<a name="l517"></a> x+=win_task-&gt;pix_left+win_task-&gt;scroll_x;
<a name="l518"></a> y+=win_task-&gt;pix_top+win_task-&gt;scroll_y;
<a name="l519"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l520"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_LOCATE_NEAREST</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l521"></a> dist=</span><span class=cF5>DistSqrI64</span><span class=cF0>(x,y,dc-&gt;cur_x,dc-&gt;cur_y);
<a name="l522"></a> </span><span class=cF1>if</span><span class=cF0> (dist&lt;=dc-&gt;nearest_dist)
<a name="l523"></a> dc-&gt;nearest_dist=dist;
<a name="l524"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l525"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_RECORD_EXTENTS</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l526"></a> </span><span class=cF1>if</span><span class=cF0> (x-w&lt;dc-&gt;min_x) dc-&gt;min_x=x-w;
<a name="l527"></a> </span><span class=cF1>if</span><span class=cF0> (y-w&lt;dc-&gt;min_y) dc-&gt;min_y=y-w;
<a name="l528"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;thick &amp; 1) {
<a name="l529"></a> </span><span class=cF1>if</span><span class=cF0> (x+w&gt;dc-&gt;max_x) dc-&gt;max_x=x+w;
<a name="l530"></a> </span><span class=cF1>if</span><span class=cF0> (y+w&gt;dc-&gt;max_y) dc-&gt;max_y=y+w;
<a name="l531"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l532"></a> </span><span class=cF1>if</span><span class=cF0> (x+w-1&gt;dc-&gt;max_x) dc-&gt;max_x=x+w-1;
<a name="l533"></a> </span><span class=cF1>if</span><span class=cF0> (y+w-1&gt;dc-&gt;max_y) dc-&gt;max_y=y+w-1;
<a name="l534"></a> }
<a name="l535"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l536"></a> }
<a name="l537"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l538"></a> </span><span class=cF5>GrFillCircle</span><span class=cF0>(dc,x,y,dc-&gt;db_z,dc-&gt;thick);
<a name="l539"></a>gr_done:
<a name="l540"></a> dc-&gt;color=old_color;
<a name="l541"></a> </span><span class=cF1>if</span><span class=cF0> (was_transform)
<a name="l542"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l543"></a> </span><span class=cF1>if</span><span class=cF0> (was_symmetry)
<a name="l544"></a> dc-&gt;flags|=</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l545"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l546"></a>}
<a name="l547"></a>
<a name="l548"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrLinePlot0</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z)
<a name="l549"></a>{</span><span class=cF2>//This is a callback.</span><span class=cF0>
<a name="l550"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task=dc-&gt;win_task;
<a name="l551"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF7>)</span><span class=cF0> ||
<a name="l552"></a> win_task-&gt;next_task==</span><span class=cFB>sys_winmgr_task</span><span class=cF0> ||
<a name="l553"></a> dc-&gt;flags&amp;</span><span class=cF3>DCF_ON_TOP</span><span class=cF0> ||
<a name="l554"></a> !</span><span class=cF5>IsPixCovered0</span><span class=cF7>(</span><span class=cF0>win_task,x,y</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l555"></a> dc-&gt;db_z=z;
<a name="l556"></a> </span><span class=cF5>GrPlot0</span><span class=cF0>(dc,x,y);
<a name="l557"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l558"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l559"></a>}
<a name="l560"></a>
<a name="l561"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrLinePlot</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z)
<a name="l562"></a>{</span><span class=cF2>//This is a callback.</span><span class=cF0>
<a name="l563"></a> dc-&gt;db_z=z;
<a name="l564"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,x,y);
<a name="l565"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l566"></a>}
<a name="l567"></a>
<a name="l568"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrLine</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x1,</span><span class=cF9>I64</span><span class=cF0> y1,</span><span class=cF9>I64</span><span class=cF0> x2,</span><span class=cF9>I64</span><span class=cF0> y2,
<a name="l569"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,</span><span class=cF9>I64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>=0)
<a name="l570"></a>{</span><span class=cF2>//2D. Clipping but not transformation.</span><span class=cF0>
<a name="l571"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l572"></a> </span><span class=cF9>I32</span><span class=cF0> *db=dc-&gt;depth_buf;
<a name="l573"></a> dc-&gt;depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l574"></a> </span><span class=cF1>if</span><span class=cF0> (step==1 &amp;&amp; !</span><span class=cF1>start</span><span class=cF0> &amp;&amp; !dc-&gt;brush &amp;&amp; !dc-&gt;depth_buf) </span><span class=cF7>{</span><span class=cF0>
<a name="l575"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DCClipLine</span><span class=cF7>(</span><span class=cF0>dc,&amp;x1,&amp;y1,&amp;x2,&amp;y2</span><span class=cF7>)</span><span class=cF0>)
<a name="l576"></a> res=</span><span class=cF5>Line</span><span class=cF0>(dc,x1,y1,0,x2,y2,0,&amp;</span><span class=cF5>GrLinePlot0</span><span class=cF0>,step,</span><span class=cF1>start</span><span class=cF0>);
<a name="l577"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l578"></a> res=</span><span class=cF5>Line</span><span class=cF0>(dc,x1,y1,0,x2,y2,0,&amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>,step,</span><span class=cF1>start</span><span class=cF0>);
<a name="l579"></a> dc-&gt;depth_buf=db;
<a name="l580"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l581"></a>}
<a name="l582"></a>
<a name="l583"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrCircle</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,</span><span class=cF9>I64</span><span class=cF0> radius,
<a name="l584"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,</span><span class=cF1>F64</span><span class=cF0> start_radians=0,</span><span class=cF1>F64</span><span class=cF0> len_radians=2*</span><span class=cF3>pi</span><span class=cF0>)
<a name="l585"></a>{</span><span class=cF2>//2D. Clipping but not transformation.</span><span class=cF0>
<a name="l586"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l587"></a> </span><span class=cF9>I32</span><span class=cF0> *db=dc-&gt;depth_buf;
<a name="l588"></a> dc-&gt;depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l589"></a> res=</span><span class=cF5>Circle</span><span class=cF0>(dc,cx,cy,0,radius,&amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>,step,start_radians,len_radians);
<a name="l590"></a> dc-&gt;depth_buf=db;
<a name="l591"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l592"></a>}
<a name="l593"></a>
<a name="l594"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrEllipse</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,
<a name="l595"></a> </span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,
<a name="l596"></a> </span><span class=cF9>I64</span><span class=cF0> x_radius,</span><span class=cF9>I64</span><span class=cF0> y_radius,
<a name="l597"></a> </span><span class=cF1>F64</span><span class=cF0> rot_angle=0,
<a name="l598"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,
<a name="l599"></a> </span><span class=cF1>F64</span><span class=cF0> start_radians=0,
<a name="l600"></a> </span><span class=cF1>F64</span><span class=cF0> len_radians=2*</span><span class=cF3>pi</span><span class=cF0>)
<a name="l601"></a>{</span><span class=cF2>//2D. Clipping but not transformation.</span><span class=cF0>
<a name="l602"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l603"></a> </span><span class=cF9>I32</span><span class=cF0> *db=dc-&gt;depth_buf;
<a name="l604"></a> dc-&gt;depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l605"></a> res=</span><span class=cF5>Ellipse</span><span class=cF0>(dc,cx,cy,0,x_radius,y_radius,&amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>,
<a name="l606"></a> rot_angle,step,start_radians,len_radians);
<a name="l607"></a> dc-&gt;depth_buf=db;
<a name="l608"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l609"></a>}
<a name="l610"></a>
<a name="l611"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrRegPoly</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,
<a name="l612"></a> </span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,
<a name="l613"></a> </span><span class=cF9>I64</span><span class=cF0> x_radius,</span><span class=cF9>I64</span><span class=cF0> y_radius,</span><span class=cF9>I64</span><span class=cF0> sides,
<a name="l614"></a> </span><span class=cF1>F64</span><span class=cF0> rot_angle=0,
<a name="l615"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,
<a name="l616"></a> </span><span class=cF1>F64</span><span class=cF0> start_radians=0,
<a name="l617"></a> </span><span class=cF1>F64</span><span class=cF0> len_radians=2*</span><span class=cF3>pi</span><span class=cF0>)
<a name="l618"></a>{</span><span class=cF2>//2D. Clipping but no transform or thick.</span><span class=cF0>
<a name="l619"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l620"></a> </span><span class=cF9>I32</span><span class=cF0> *db=dc-&gt;depth_buf;
<a name="l621"></a> dc-&gt;depth_buf=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l622"></a> res=</span><span class=cF5>RegPoly</span><span class=cF0>(dc,cx,cy,0,x_radius,y_radius,sides,
<a name="l623"></a> &amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>,rot_angle,step,start_radians,len_radians);
<a name="l624"></a> dc-&gt;depth_buf=db;
<a name="l625"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l626"></a>}
<a name="l627"></a>
<a name="l628"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Gr2Bezier</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl)
<a name="l629"></a>{</span><span class=cF2>//2nd order. Clipping but no transform or thick.</span><span class=cF0>
<a name="l630"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Bezier2</span><span class=cF0>(dc,ctrl,&amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>);
<a name="l631"></a>}
<a name="l632"></a>
<a name="l633"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Gr3Bezier</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl)
<a name="l634"></a>{</span><span class=cF2>//3rd order. Clipping but no transform or thick.</span><span class=cF0>
<a name="l635"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Bezier3</span><span class=cF0>(dc,ctrl,&amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>);
<a name="l636"></a>}
<a name="l637"></a>
<a name="l638"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Gr2BSpline</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl,</span><span class=cF9>I64</span><span class=cF0> cnt,</span><span class=cF1>Bool</span><span class=cF0> closed=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l639"></a>{</span><span class=cF2>//2nd order. Clipping but no transform or thick.</span><span class=cF0>
<a name="l640"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>BSpline2</span><span class=cF0>(dc,ctrl,cnt,&amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>,closed);
<a name="l641"></a>}
<a name="l642"></a>
<a name="l643"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Gr3BSpline</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl,</span><span class=cF9>I64</span><span class=cF0> cnt,</span><span class=cF1>Bool</span><span class=cF0> closed=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l644"></a>{</span><span class=cF2>//3rd order. Clipping but no transform or thick.</span><span class=cF0>
<a name="l645"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>BSpline3</span><span class=cF0>(dc,ctrl,cnt,&amp;</span><span class=cF5>GrLinePlot</span><span class=cF0>,closed);
<a name="l646"></a>}
<a name="l647"></a>
<a name="l648"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrLineFat3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x1,</span><span class=cF9>I64</span><span class=cF0> y1,</span><span class=cF9>I64</span><span class=cF0> z1,</span><span class=cF9>I64</span><span class=cF0> x2,</span><span class=cF9>I64</span><span class=cF0> y2,</span><span class=cF9>I64</span><span class=cF0> z2,
<a name="l649"></a> </span><span class=cF9>I64</span><span class=cF0> width,</span><span class=cF9>I64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>=0)
<a name="l650"></a>{</span><span class=cF2>//Step through line segment calling callback.</span><span class=cF0>
<a name="l651"></a></span><span class=cF2>//Uses </span><a href="/Wb/Demo/Lectures/FixedPoint.HC.HTML#l1"><span class=cF4>fixed-point</span></a><span class=cF2>.</span><span class=cF0>
<a name="l652"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,i,j,d,dx=x2-x1,dy=y2-y1,dz=z2-z1,_x,_y,_z,d_lo,d_hi,
<a name="l653"></a> adx=</span><span class=cF5>AbsI64</span><span class=cF0>(dx),ady=</span><span class=cF5>AbsI64</span><span class=cF0>(dy),adz=</span><span class=cF5>AbsI64</span><span class=cF0>(dz);
<a name="l654"></a> </span><span class=cF1>if</span><span class=cF0> (width&gt;0) </span><span class=cF7>{</span><span class=cF0>
<a name="l655"></a> </span><span class=cF1>if</span><span class=cF0> (adx&gt;=ady) {
<a name="l656"></a> </span><span class=cF1>if</span><span class=cF0> (adx&gt;=adz) </span><span class=cF7>{</span><span class=cF0>
<a name="l657"></a> </span><span class=cF1>if</span><span class=cF0> (d=adx) {
<a name="l658"></a> </span><span class=cF1>if</span><span class=cF0> (dx&gt;=0)
<a name="l659"></a> dx=0x100000000;
<a name="l660"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l661"></a> dx=-0x100000000;
<a name="l662"></a> dy=dy&lt;&lt;32/d;
<a name="l663"></a> dz=dz&lt;&lt;32/d;
<a name="l664"></a> }
<a name="l665"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l666"></a> </span><span class=cF1>if</span><span class=cF0> (d=adz) {
<a name="l667"></a> dx=dx&lt;&lt;32/d;
<a name="l668"></a> dy=dy&lt;&lt;32/d;
<a name="l669"></a> </span><span class=cF1>if</span><span class=cF0> (dz&gt;=0)
<a name="l670"></a> dz=0x100000000;
<a name="l671"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l672"></a> dz=-0x100000000;
<a name="l673"></a> }
<a name="l674"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l675"></a> x1&lt;&lt;=32; y1&lt;&lt;=32; z1&lt;&lt;=32;
<a name="l676"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;</span><span class=cF1>start</span><span class=cF0>;j++) </span><span class=cF7>{</span><span class=cF0>
<a name="l677"></a> x1+=dx; y1+=dy; z1+=dz;
<a name="l678"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l679"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0>&gt;=d)
<a name="l680"></a> res+=</span><span class=cF5>GrFillCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width);
<a name="l681"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l682"></a> </span><span class=cF1>if</span><span class=cF0> (width==1)
<a name="l683"></a> </span><span class=cF1>for</span><span class=cF0> (i=</span><span class=cF1>start</span><span class=cF0>;i&lt;=d;i++) {
<a name="l684"></a> dc-&gt;db_z=z1.i32[1];
<a name="l685"></a> res+=</span><span class=cF5>GrPlot1</span><span class=cF0>(dc,x1.i32[1],y1.i32[1]);
<a name="l686"></a> _x=x1.i32[1]; _y=y1.i32[1]; _z=z1.i32[1];
<a name="l687"></a> x1+=dx; y1+=dy; z1+=dz;
<a name="l688"></a> }
<a name="l689"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l690"></a> i=width*</span><span class=cF5>Sqrt</span><span class=cF0>(</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>adx</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>ady</span><span class=cF7>)</span><span class=cF0>)/adx;
<a name="l691"></a> d_lo=i&gt;&gt;1; d_hi=(i-1)&gt;&gt;1;
<a name="l692"></a>
<a name="l693"></a> </span><span class=cF1>if</span><span class=cF0> (dx&gt;=0)
<a name="l694"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,2);
<a name="l695"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l696"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,7);
<a name="l697"></a> </span><span class=cF1>for</span><span class=cF0> (i=</span><span class=cF1>start</span><span class=cF0>;i&lt;=d;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l698"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,x1.i32[1],y1.i32[1]-d_lo,y1.i32[1]+d_hi,
<a name="l699"></a> z1.i32[1],z1.i32[1]);
<a name="l700"></a> _x=x1.i32[1]; _y=y1.i32[1]; _z=z1.i32[1];
<a name="l701"></a> x1+=dx; y1+=dy; z1+=dz;
<a name="l702"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l703"></a> x1-=dx; y1-=dy; z1-=dz;
<a name="l704"></a> </span><span class=cF1>if</span><span class=cF0> (dx&gt;=0)
<a name="l705"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,3);
<a name="l706"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l707"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,6);
<a name="l708"></a> }
<a name="l709"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l710"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l711"></a> </span><span class=cF1>if</span><span class=cF0> (ady&gt;=adz) </span><span class=cF7>{</span><span class=cF0>
<a name="l712"></a> </span><span class=cF1>if</span><span class=cF0> (d=ady) {
<a name="l713"></a> dx=dx&lt;&lt;32/d;
<a name="l714"></a> </span><span class=cF1>if</span><span class=cF0> (dy&gt;=0)
<a name="l715"></a> dy=0x100000000;
<a name="l716"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l717"></a> dy=-0x100000000;
<a name="l718"></a> dz=dz&lt;&lt;32/d;
<a name="l719"></a> }
<a name="l720"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l721"></a> </span><span class=cF1>if</span><span class=cF0> (d=adz) {
<a name="l722"></a> dx=dx&lt;&lt;32/d;
<a name="l723"></a> dy=dy&lt;&lt;32/d;
<a name="l724"></a> </span><span class=cF1>if</span><span class=cF0> (dz&gt;=0)
<a name="l725"></a> dz=0x100000000;
<a name="l726"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l727"></a> dz=-0x100000000;
<a name="l728"></a> }
<a name="l729"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l730"></a> x1&lt;&lt;=32; y1&lt;&lt;=32; z1&lt;&lt;=32;
<a name="l731"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;</span><span class=cF1>start</span><span class=cF0>;j++) </span><span class=cF7>{</span><span class=cF0>
<a name="l732"></a> x1+=dx; y1+=dy; z1+=dz;
<a name="l733"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l734"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>start</span><span class=cF0>&gt;=d)
<a name="l735"></a> res+=</span><span class=cF5>GrFillCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width);
<a name="l736"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l737"></a> </span><span class=cF1>if</span><span class=cF0> (width==1)
<a name="l738"></a> </span><span class=cF1>for</span><span class=cF0> (i=</span><span class=cF1>start</span><span class=cF0>;i&lt;=d;i++) {
<a name="l739"></a> dc-&gt;db_z=z1.i32[1];
<a name="l740"></a> res+=</span><span class=cF5>GrPlot1</span><span class=cF0>(dc,x1.i32[1],y1.i32[1]);
<a name="l741"></a> _x=x1.i32[1]; _y=y1.i32[1]; _z=z1.i32[1];
<a name="l742"></a> x1+=dx; y1+=dy; z1+=dz;
<a name="l743"></a> }
<a name="l744"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l745"></a> i=width*</span><span class=cF5>Sqrt</span><span class=cF0>(</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>ady</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>SqrI64</span><span class=cF7>(</span><span class=cF0>adx</span><span class=cF7>)</span><span class=cF0>)/ady;
<a name="l746"></a> d_lo=i&gt;&gt;1; d_hi=(i-1)&gt;&gt;1;
<a name="l747"></a>
<a name="l748"></a> </span><span class=cF1>if</span><span class=cF0> (dy&gt;=0)
<a name="l749"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,0);
<a name="l750"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l751"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,5);
<a name="l752"></a> </span><span class=cF1>for</span><span class=cF0> (i=</span><span class=cF1>start</span><span class=cF0>;i&lt;=d;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l753"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,x1.i32[1]-d_lo,x1.i32[1]+d_hi,y1.i32[1],
<a name="l754"></a> z1.i32[1],z1.i32[1]);
<a name="l755"></a> _x=x1.i32[1]; _y=y1.i32[1]; _z=z1.i32[1];
<a name="l756"></a> x1+=dx; y1+=dy; z1+=dz;
<a name="l757"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l758"></a> x1-=dx; y1-=dy; z1-=dz;
<a name="l759"></a> </span><span class=cF1>if</span><span class=cF0> (dy&gt;=0)
<a name="l760"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,1);
<a name="l761"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l762"></a> res+=</span><span class=cF5>GrFillSemiCircle</span><span class=cF0>(dc,x1.i32[1],y1.i32[1],z1.i32[1],width,4);
<a name="l763"></a> }
<a name="l764"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l765"></a> }
<a name="l766"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l767"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l768"></a>}
<a name="l769"></a>
<a name="l770"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrLine3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x1,</span><span class=cF9>I64</span><span class=cF0> y1,</span><span class=cF9>I64</span><span class=cF0> z1,</span><span class=cF9>I64</span><span class=cF0> x2,</span><span class=cF9>I64</span><span class=cF0> y2,</span><span class=cF9>I64</span><span class=cF0> z2,
<a name="l771"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,</span><span class=cF9>I64</span><span class=cF0> </span><span class=cF1>start</span><span class=cF0>=0)
<a name="l772"></a>{</span><span class=cF2>//3D. Transformation with thick.</span><span class=cF0>
<a name="l773"></a> </span><span class=cF9>I64</span><span class=cF0> _x1,_y1,_z1,_x2,_y2,_z2;
<a name="l774"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>,was_transform=</span><span class=cF3>FALSE</span><span class=cF0>,was_symmetry=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l775"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l776"></a> (*dc-&gt;transform)(dc,&amp;x1,&amp;y1,&amp;z1);
<a name="l777"></a> (*dc-&gt;transform)(dc,&amp;x2,&amp;y2,&amp;z2);
<a name="l778"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l779"></a> was_transform=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l780"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l781"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l782"></a> _x1=x1; _y1=y1; _z1=z1;
<a name="l783"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x1,&amp;_y1,&amp;_z1);
<a name="l784"></a> _x2=x2; _y2=y2; _z2=z2;
<a name="l785"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x2,&amp;_y2,&amp;_z2);
<a name="l786"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l787"></a> </span><span class=cF1>if</span><span class=cF0> (step==1 &amp;&amp; !dc-&gt;brush) {
<a name="l788"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF1>start</span><span class=cF0> &amp;&amp; dc-&gt;thick&lt;2 &amp;&amp; !dc-&gt;depth_buf) </span><span class=cF7>{</span><span class=cF2>//TODO: clip z depbuf</span><span class=cF0>
<a name="l789"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DCClipLine</span><span class=cF7>(</span><span class=cF0>dc,&amp;_x1,&amp;_y1,&amp;_x2,&amp;_y2</span><span class=cF7>)</span><span class=cF0>)
<a name="l790"></a> res=</span><span class=cF5>Line</span><span class=cF0>(dc,_x1,_y1,0,_x2,_y2,0,&amp;</span><span class=cF5>GrLinePlot0</span><span class=cF0>,step,</span><span class=cF1>start</span><span class=cF0>);
<a name="l791"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l792"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrLineFat3</span><span class=cF7>(</span><span class=cF0>dc,_x1,_y1,_z1,_x2,_y2,_z2,dc-&gt;thick,</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>)
<a name="l793"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l794"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l795"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l796"></a> res=</span><span class=cF5>Line</span><span class=cF0>(dc,_x1,_y1,_z1,_x2,_y2,_z2,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,step,</span><span class=cF1>start</span><span class=cF0>);
<a name="l797"></a> was_symmetry=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l798"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags&amp;</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l799"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l800"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l801"></a> </span><span class=cF1>if</span><span class=cF0> (step==1 &amp;&amp; !dc-&gt;brush) </span><span class=cF7>{</span><span class=cF0>
<a name="l802"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF1>start</span><span class=cF0> &amp;&amp; dc-&gt;thick&lt;2 &amp;&amp; !dc-&gt;depth_buf) {</span><span class=cF2>//TODO: clip z depbuf</span><span class=cF0>
<a name="l803"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DCClipLine</span><span class=cF7>(</span><span class=cF0>dc,&amp;x1,&amp;y1,&amp;x2,&amp;y2</span><span class=cF7>)</span><span class=cF0>)
<a name="l804"></a> res|=</span><span class=cF5>Line</span><span class=cF0>(dc,x1,y1,0,x2,y2,0,&amp;</span><span class=cF5>GrLinePlot0</span><span class=cF0>,step,</span><span class=cF1>start</span><span class=cF0>);
<a name="l805"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l806"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>GrLineFat3</span><span class=cF7>(</span><span class=cF0>dc,x1,y1,z1,x2,y2,z2,dc-&gt;thick,</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>)
<a name="l807"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l808"></a> }
<a name="l809"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l810"></a> res|=</span><span class=cF5>Line</span><span class=cF0>(dc,x1,y1,z1,x2,y2,z2,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,step,</span><span class=cF1>start</span><span class=cF0>);
<a name="l811"></a>gr_done:
<a name="l812"></a> </span><span class=cF1>if</span><span class=cF0> (was_transform)
<a name="l813"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l814"></a> </span><span class=cF1>if</span><span class=cF0> (was_symmetry)
<a name="l815"></a> dc-&gt;flags|=</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l816"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l817"></a>}
<a name="l818"></a>
<a name="l819"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics/Char;Char/Graphics&quot;</span><span class=cF0>
<a name="l820"></a>
<a name="l821"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrPutChar3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z,</span><span class=cF1>U8</span><span class=cF0> ch)
<a name="l822"></a>{</span><span class=cF2>//3D. Transformation. DCF_SYMMETRY is silly.</span><span class=cF0>
<a name="l823"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>)
<a name="l824"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l825"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>GrPutChar</span><span class=cF0>(dc,x,y,ch);
<a name="l826"></a>}
<a name="l827"></a>
<a name="l828"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrPrint3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z,</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
<a name="l829"></a>{</span><span class=cF2>//3D. Transformation. DCF_SYMMETRY is silly.</span><span class=cF0>
<a name="l830"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
<a name="l831"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l832"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>)
<a name="l833"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l834"></a> res=</span><span class=cF5>GrPrint</span><span class=cF0>(dc,x,y,</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,buf);
<a name="l835"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l836"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l837"></a>}
<a name="l838"></a>
<a name="l839"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrVPrint3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x,</span><span class=cF9>I64</span><span class=cF0> y,</span><span class=cF9>I64</span><span class=cF0> z,</span><span class=cF1>U8</span><span class=cF0> *fmt,...)
<a name="l840"></a>{</span><span class=cF2>//3D. Vertical text. Transformation. DCF_SYMMETRY is silly.</span><span class=cF0>
<a name="l841"></a> </span><span class=cF1>U8</span><span class=cF0> *buf=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
<a name="l842"></a> </span><span class=cF9>I64</span><span class=cF0> res;
<a name="l843"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>)
<a name="l844"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l845"></a> res=</span><span class=cF5>GrVPrint</span><span class=cF0>(dc,x,y,</span><span class=cF6>&quot;%s&quot;</span><span class=cF0>,buf);
<a name="l846"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l847"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l848"></a>}
<a name="l849"></a>
<a name="l850"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics&quot;</span><span class=cF0>
<a name="l851"></a>
<a name="l852"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrEllipse3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,
<a name="l853"></a> </span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,</span><span class=cF9>I64</span><span class=cF0> cz,
<a name="l854"></a> </span><span class=cF9>I64</span><span class=cF0> x_radius,</span><span class=cF9>I64</span><span class=cF0> y_radius,
<a name="l855"></a> </span><span class=cF1>F64</span><span class=cF0> rot_angle=0,
<a name="l856"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,
<a name="l857"></a> </span><span class=cF1>F64</span><span class=cF0> start_radians=0,
<a name="l858"></a> </span><span class=cF1>F64</span><span class=cF0> len_radians=2*</span><span class=cF3>pi</span><span class=cF0>)
<a name="l859"></a>{</span><span class=cF2>//3D. Transformation with thick.</span><span class=cF0>
<a name="l860"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l861"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z,xx,yy,zz;
<a name="l862"></a> </span><span class=cF1>F64</span><span class=cF0> m1,arg1,m2,arg2,s,c;
<a name="l863"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l864"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l865"></a> (*dc-&gt;transform)(dc,&amp;cx,&amp;cy,&amp;cz);
<a name="l866"></a>
<a name="l867"></a> c=</span><span class=cF5>Cos</span><span class=cF0>(rot_angle);
<a name="l868"></a> s=</span><span class=cF5>Sin</span><span class=cF0>(rot_angle);
<a name="l869"></a>
<a name="l870"></a> x_radius&lt;&lt;=16;
<a name="l871"></a> y_radius&lt;&lt;=16;
<a name="l872"></a>
<a name="l873"></a> xx=0;
<a name="l874"></a> yy=0;
<a name="l875"></a> zz=0;
<a name="l876"></a> (*dc-&gt;transform)(dc,&amp;xx,&amp;yy,&amp;zz);
<a name="l877"></a>
<a name="l878"></a> x=x_radius*c;
<a name="l879"></a> y=x_radius*s;
<a name="l880"></a> z=0;
<a name="l881"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l882"></a> x-=xx;
<a name="l883"></a> y-=yy;
<a name="l884"></a> z-=zz;
<a name="l885"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m1,&amp;arg1,x,y);
<a name="l886"></a>
<a name="l887"></a> x=-y_radius*s;
<a name="l888"></a> y=y_radius*c;
<a name="l889"></a> z=0;
<a name="l890"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l891"></a> x-=xx;
<a name="l892"></a> y-=yy;
<a name="l893"></a> z-=zz;
<a name="l894"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m2,&amp;arg2,x,y);
<a name="l895"></a> m2*=</span><span class=cF5>Abs</span><span class=cF0>(</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>arg2-arg1</span><span class=cF7>)</span><span class=cF0>);
<a name="l896"></a>
<a name="l897"></a> res=</span><span class=cF5>Ellipse</span><span class=cF0>(dc,cx,cy,cz,
<a name="l898"></a> m1/0x10000,m2/0x10000,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,-arg1,step,start_radians,len_radians);
<a name="l899"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l900"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l901"></a> res=</span><span class=cF5>Ellipse</span><span class=cF0>(dc,cx,cy,cz,x_radius,y_radius,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,
<a name="l902"></a> rot_angle,step,start_radians,len_radians);
<a name="l903"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l904"></a>}
<a name="l905"></a>
<a name="l906"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrCircle3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,</span><span class=cF9>I64</span><span class=cF0> cz,</span><span class=cF9>I64</span><span class=cF0> radius,
<a name="l907"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,</span><span class=cF1>F64</span><span class=cF0> start_radians=0,</span><span class=cF1>F64</span><span class=cF0> len_radians=2*</span><span class=cF3>pi</span><span class=cF0>)
<a name="l908"></a>{</span><span class=cF2>//3D. Transformation with thick.</span><span class=cF0>
<a name="l909"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>)
<a name="l910"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>GrEllipse3</span><span class=cF0>(dc,cx,cy,cz,radius,radius,0,step,
<a name="l911"></a> start_radians,len_radians);
<a name="l912"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l913"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Circle</span><span class=cF0>(dc,cx,cy,cz,radius,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,step,
<a name="l914"></a> start_radians,len_radians);
<a name="l915"></a>}
<a name="l916"></a>
<a name="l917"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>GrRegPoly3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,
<a name="l918"></a> </span><span class=cF9>I64</span><span class=cF0> cx,</span><span class=cF9>I64</span><span class=cF0> cy,</span><span class=cF9>I64</span><span class=cF0> cz,
<a name="l919"></a> </span><span class=cF9>I64</span><span class=cF0> x_radius,</span><span class=cF9>I64</span><span class=cF0> y_radius,</span><span class=cF9>I64</span><span class=cF0> sides,
<a name="l920"></a> </span><span class=cF1>F64</span><span class=cF0> rot_angle=0,
<a name="l921"></a> </span><span class=cF9>I64</span><span class=cF0> step=1,
<a name="l922"></a> </span><span class=cF1>F64</span><span class=cF0> start_radians=0,
<a name="l923"></a> </span><span class=cF1>F64</span><span class=cF0> len_radians=2*</span><span class=cF3>pi</span><span class=cF0>)
<a name="l924"></a>{</span><span class=cF2>//3D. Clipping and transform and thick.</span><span class=cF0>
<a name="l925"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l926"></a> </span><span class=cF9>I64</span><span class=cF0> x,y,z,xx,yy,zz;
<a name="l927"></a> </span><span class=cF1>F64</span><span class=cF0> m1,arg1,m2,arg2,s,c;
<a name="l928"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l929"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l930"></a> (*dc-&gt;transform)(dc,&amp;cx,&amp;cy,&amp;cz);
<a name="l931"></a>
<a name="l932"></a> c=</span><span class=cF5>Cos</span><span class=cF0>(rot_angle);
<a name="l933"></a> s=</span><span class=cF5>Sin</span><span class=cF0>(rot_angle);
<a name="l934"></a>
<a name="l935"></a> x_radius&lt;&lt;=16;
<a name="l936"></a> y_radius&lt;&lt;=16;
<a name="l937"></a>
<a name="l938"></a> xx=0;
<a name="l939"></a> yy=0;
<a name="l940"></a> zz=0;
<a name="l941"></a> (*dc-&gt;transform)(dc,&amp;xx,&amp;yy,&amp;zz);
<a name="l942"></a>
<a name="l943"></a> x=x_radius*c;
<a name="l944"></a> y=x_radius*s;
<a name="l945"></a> z=0;
<a name="l946"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l947"></a> x-=xx;
<a name="l948"></a> y-=yy;
<a name="l949"></a> z-=zz;
<a name="l950"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m1,&amp;arg1,x,y);
<a name="l951"></a>
<a name="l952"></a> x=-y_radius*s;
<a name="l953"></a> y=y_radius*c;
<a name="l954"></a> z=0;
<a name="l955"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l956"></a> x-=xx;
<a name="l957"></a> y-=yy;
<a name="l958"></a> z-=zz;
<a name="l959"></a> </span><span class=cF5>R2P</span><span class=cF0>(&amp;m2,&amp;arg2,x,y);
<a name="l960"></a> m2*=</span><span class=cF5>Abs</span><span class=cF0>(</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>arg2-arg1</span><span class=cF7>)</span><span class=cF0>);
<a name="l961"></a>
<a name="l962"></a> res=</span><span class=cF5>RegPoly</span><span class=cF0>(dc,cx,cy,cz,
<a name="l963"></a> m1/0x10000,m2/0x10000,sides,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,-arg1,
<a name="l964"></a> step,start_radians,len_radians);
<a name="l965"></a> dc-&gt;flags|=</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l966"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l967"></a> res=</span><span class=cF5>RegPoly</span><span class=cF0>(dc,cx,cy,cz,x_radius,y_radius,sides,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,
<a name="l968"></a> rot_angle,step,start_radians,len_radians);
<a name="l969"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l970"></a>}
<a name="l971"></a>
<a name="l972"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrFloodFill3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x1,</span><span class=cF9>I64</span><span class=cF0> y1,</span><span class=cF9>I64</span><span class=cF0> z1,</span><span class=cF1>Bool</span><span class=cF0> not_color=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l973"></a>{</span><span class=cF2>//3D. Transformation.</span><span class=cF0>
<a name="l974"></a></span><span class=cF2>//not_color=TRUE means fill up to everything which is not the current color.</span><span class=cF0>
<a name="l975"></a> </span><span class=cF2>//not_color=FALSE means fill all parts equ to the color under the point.</span><span class=cF0>
<a name="l976"></a> </span><span class=cF2>//Returns cnt of pixs changed</span><span class=cF0>
<a name="l977"></a> </span><span class=cF9>I64</span><span class=cF0> res,old_flags=dc-&gt;flags,
<a name="l978"></a> _x,_y,_z;
<a name="l979"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l980"></a> (*dc-&gt;transform)(dc,&amp;x1,&amp;y1,&amp;z1);
<a name="l981"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l982"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l983"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l984"></a> _x=x1; _y=y1; _z=z1;
<a name="l985"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x,&amp;_y,&amp;_z);
<a name="l986"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l987"></a> res=</span><span class=cF5>GrFloodFill</span><span class=cF0>(dc,_x,_y,not_color,_z,dc-&gt;depth_buf);
<a name="l988"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags&amp;</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l989"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l990"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l991"></a> res=</span><span class=cF5>GrFloodFill</span><span class=cF0>(dc,x1,y1,not_color,z1,dc-&gt;depth_buf);
<a name="l992"></a>gr_done:
<a name="l993"></a> dc-&gt;flags=old_flags;
<a name="l994"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l995"></a>}
<a name="l996"></a>
<a name="l997"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics;Graphics/Device Contexts&quot;</span><span class=cF0>
<a name="l998"></a>
<a name="l999"></a></span><span class=cF5>Option</span><span class=cF0>(</span><span class=cF3>OPTf_WARN_HEADER_MISMATCH</span><span class=cF0>,</span><span class=cF3>OFF</span><span class=cF0>);
<a name="l1000"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrBlot3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>I64</span><span class=cF0> x1,</span><span class=cF9>I64</span><span class=cF0> y1,</span><span class=cF9>I64</span><span class=cF0> z1,</span><span class=cF9>CDC</span><span class=cF0> *img)
<a name="l1001"></a>{</span><span class=cF2>//3D. Clipping and transformation.</span><span class=cF0>
<a name="l1002"></a> </span><span class=cF9>CColorROPU32</span><span class=cF0> old_color=dc-&gt;color;
<a name="l1003"></a> </span><span class=cF9>I64</span><span class=cF0> color,</span><span class=cF1>reg</span><span class=cF0> i,j,w=img-&gt;width,h=img-&gt;height,
<a name="l1004"></a> d1,dx1,dy1,dz1,
<a name="l1005"></a> </span><span class=cF1>reg</span><span class=cF0> d2,dx2,dy2,dz2,
<a name="l1006"></a> adx1,ady1,adz1,
<a name="l1007"></a> adx2,ady2,adz2,
<a name="l1008"></a> x2,y2,z2,x3,y3,z3,
<a name="l1009"></a> dw,</span><span class=cF1>reg</span><span class=cF0> dh,x,y,_x1,_y1,_z1,_x2,_y2,_z2,_x3,_y3,_z3,
<a name="l1010"></a> last_x,last_y,res=0;
<a name="l1011"></a> </span><span class=cF1>Bool</span><span class=cF0> first;
<a name="l1012"></a> </span><span class=cF9>CDC</span><span class=cF0> *old_brush=dc-&gt;brush;
<a name="l1013"></a>
<a name="l1014"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;depth_buf || dc-&gt;flags &amp; </span><span class=cF7>(</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0> | </span><span class=cF3>DCF_SYMMETRY</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1015"></a> x2=x1+w; y2=y1; z2=z1;
<a name="l1016"></a> x3=x1; y3=y1+h; z3=z1;
<a name="l1017"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) {
<a name="l1018"></a> (*dc-&gt;transform)(dc,&amp;x1,&amp;y1,&amp;z1);
<a name="l1019"></a> (*dc-&gt;transform)(dc,&amp;x2,&amp;y2,&amp;z2);
<a name="l1020"></a> (*dc-&gt;transform)(dc,&amp;x3,&amp;y3,&amp;z3);
<a name="l1021"></a> }
<a name="l1022"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) {
<a name="l1023"></a> _x1=x1; _y1=y1; _z1=z1;
<a name="l1024"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x1,&amp;_y1,&amp;_z1);
<a name="l1025"></a> _x2=x2; _y2=y2; _z2=z2;
<a name="l1026"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x2,&amp;_y2,&amp;_z2);
<a name="l1027"></a> _x3=x3; _y3=y3; _z3=z3;
<a name="l1028"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;_x3,&amp;_y3,&amp;_z3);
<a name="l1029"></a> dx1=_x2-_x1; dy1=_y2-_y1; dz1=_z2-_z1;
<a name="l1030"></a> dx2=_x3-_x1; dy2=_y3-_y1; dz2=_z3-_z1;
<a name="l1031"></a> adx1=</span><span class=cF5>AbsI64</span><span class=cF0>(dx1); ady1=</span><span class=cF5>AbsI64</span><span class=cF0>(dy1); adz1=</span><span class=cF5>AbsI64</span><span class=cF0>(dz1);
<a name="l1032"></a> adx2=</span><span class=cF5>AbsI64</span><span class=cF0>(dx2); ady2=</span><span class=cF5>AbsI64</span><span class=cF0>(dy2); adz2=</span><span class=cF5>AbsI64</span><span class=cF0>(dz2);
<a name="l1033"></a>
<a name="l1034"></a> </span><span class=cF1>if</span><span class=cF0> (adx1&gt;=ady1) </span><span class=cF7>{</span><span class=cF0>
<a name="l1035"></a> </span><span class=cF1>if</span><span class=cF0> (adx1&gt;=adz1)
<a name="l1036"></a> d1=adx1;
<a name="l1037"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1038"></a> d1=adz1;
<a name="l1039"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1040"></a> </span><span class=cF1>if</span><span class=cF0> (ady1&gt;=adz1)
<a name="l1041"></a> d1=ady1;
<a name="l1042"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1043"></a> d1=adz1;
<a name="l1044"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1045"></a> </span><span class=cF1>if</span><span class=cF0> (adx2&gt;=ady2) </span><span class=cF7>{</span><span class=cF0>
<a name="l1046"></a> </span><span class=cF1>if</span><span class=cF0> (adx2&gt;=adz2)
<a name="l1047"></a> d2=adx2;
<a name="l1048"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1049"></a> d2=adz2;
<a name="l1050"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1051"></a> </span><span class=cF1>if</span><span class=cF0> (ady2&gt;=adz2)
<a name="l1052"></a> d2=ady2;
<a name="l1053"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1054"></a> d2=adz2;
<a name="l1055"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1056"></a>
<a name="l1057"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>d1</span><span class=cF7>)</span><span class=cF0>!=w ||</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>d2</span><span class=cF7>)</span><span class=cF0>!=h) </span><span class=cF7>{</span><span class=cF0>
<a name="l1058"></a> d1&lt;&lt;=1;
<a name="l1059"></a> d2&lt;&lt;=1;
<a name="l1060"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1061"></a> </span><span class=cF1>if</span><span class=cF0> (d1) </span><span class=cF7>{</span><span class=cF0>
<a name="l1062"></a> dx1=dx1&lt;&lt;32/d1;
<a name="l1063"></a> dy1=dy1&lt;&lt;32/d1;
<a name="l1064"></a> dz1=dz1&lt;&lt;32/d1;
<a name="l1065"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1066"></a> </span><span class=cF1>goto</span><span class=cF0> normal_image;
<a name="l1067"></a> </span><span class=cF1>if</span><span class=cF0> (d2) </span><span class=cF7>{</span><span class=cF0>
<a name="l1068"></a> dx2=dx2&lt;&lt;32/d2;
<a name="l1069"></a> dy2=dy2&lt;&lt;32/d2;
<a name="l1070"></a> dz2=dz2&lt;&lt;32/d2;
<a name="l1071"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1072"></a> </span><span class=cF1>goto</span><span class=cF0> normal_image;
<a name="l1073"></a> dc-&gt;brush=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1074"></a> x=0;y=0;
<a name="l1075"></a> dw=w&lt;&lt;32/d1;
<a name="l1076"></a> dh=h&lt;&lt;32/d2;
<a name="l1077"></a>
<a name="l1078"></a> first=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1079"></a> _x1&lt;&lt;=32; _y1&lt;&lt;=32; _z1&lt;&lt;=32;
<a name="l1080"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;=d1;j++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1081"></a> _x2=_x1; _y2=_y1; _z2=_z1;
<a name="l1082"></a> y=0;
<a name="l1083"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;=d2;i++) {
<a name="l1084"></a> </span><span class=cF1>if</span><span class=cF0> (_x2.i32[1]!=last_x || _y2.i32[1]!=last_y ||first) </span><span class=cF7>{</span><span class=cF0>
<a name="l1085"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>color=</span><span class=cF5>GrPeek</span><span class=cF0>(img,x.i32[1],y.i32[1])</span><span class=cF7>)</span><span class=cF0>&gt;=0) {
<a name="l1086"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.rop==</span><span class=cF3>ROPB_MONO</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1087"></a> </span><span class=cF1>if</span><span class=cF0> (color) {
<a name="l1088"></a> dc-&gt;color=old_color&amp;~</span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l1089"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;depth_buf) </span><span class=cF7>{</span><span class=cF0>
<a name="l1090"></a> dc-&gt;db_z=_z2.i32[1];
<a name="l1091"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,_x2.i32[1],_y2.i32[1]);
<a name="l1092"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1093"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,_x2.i32[1],_y2.i32[1]);
<a name="l1094"></a> }
<a name="l1095"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1096"></a> </span><span class=cF1>if</span><span class=cF0> (color!=</span><span class=cF3>TRANSPARENT</span><span class=cF0>) {
<a name="l1097"></a> dc-&gt;color=old_color&amp;~</span><span class=cF3>COLORROP_NO_ROP0_MASK</span><span class=cF0>|color;
<a name="l1098"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;depth_buf) </span><span class=cF7>{</span><span class=cF0>
<a name="l1099"></a> dc-&gt;db_z=_z2.i32[1];
<a name="l1100"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,_x2.i32[1],_y2.i32[1]);
<a name="l1101"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1102"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,_x2.i32[1],_y2.i32[1]);
<a name="l1103"></a> }
<a name="l1104"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1105"></a> }
<a name="l1106"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1107"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1108"></a> last_x=_x2.i32[1]; last_y=_y2.i32[1];
<a name="l1109"></a> _x2+=dx2; _y2+=dy2; _z2+=dz2;
<a name="l1110"></a> y+=dh;
<a name="l1111"></a> }
<a name="l1112"></a> _x1+=dx1; _y1+=dy1; _z1+=dz1;
<a name="l1113"></a> x+=dw;
<a name="l1114"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1115"></a> res=1;
<a name="l1116"></a>normal_image:
<a name="l1117"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags&amp;</span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l1118"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l1119"></a> }
<a name="l1120"></a> dx1=x2-x1; dy1=y2-y1; dz1=z2-z1;
<a name="l1121"></a> dx2=x3-x1; dy2=y3-y1; dz2=z3-z1;
<a name="l1122"></a> adx1=</span><span class=cF5>AbsI64</span><span class=cF0>(dx1); ady1=</span><span class=cF5>AbsI64</span><span class=cF0>(dy1); adz1=</span><span class=cF5>AbsI64</span><span class=cF0>(dz1);
<a name="l1123"></a> adx2=</span><span class=cF5>AbsI64</span><span class=cF0>(dx2); ady2=</span><span class=cF5>AbsI64</span><span class=cF0>(dy2); adz2=</span><span class=cF5>AbsI64</span><span class=cF0>(dz2);
<a name="l1124"></a>
<a name="l1125"></a> </span><span class=cF1>if</span><span class=cF0> (adx1&gt;=ady1) {
<a name="l1126"></a> </span><span class=cF1>if</span><span class=cF0> (adx1&gt;=adz1)
<a name="l1127"></a> d1=adx1;
<a name="l1128"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1129"></a> d1=adz1;
<a name="l1130"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1131"></a> </span><span class=cF1>if</span><span class=cF0> (ady1&gt;=adz1)
<a name="l1132"></a> d1=ady1;
<a name="l1133"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1134"></a> d1=adz1;
<a name="l1135"></a> }
<a name="l1136"></a> </span><span class=cF1>if</span><span class=cF0> (adx2&gt;=ady2) {
<a name="l1137"></a> </span><span class=cF1>if</span><span class=cF0> (adx2&gt;=adz2)
<a name="l1138"></a> d2=adx2;
<a name="l1139"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1140"></a> d2=adz2;
<a name="l1141"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1142"></a> </span><span class=cF1>if</span><span class=cF0> (ady2&gt;=adz2)
<a name="l1143"></a> d2=ady2;
<a name="l1144"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1145"></a> d2=adz2;
<a name="l1146"></a> }
<a name="l1147"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>d1</span><span class=cF7>)</span><span class=cF0>!=w ||</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>d2</span><span class=cF7>)</span><span class=cF0>!=h) {
<a name="l1148"></a> d1&lt;&lt;=1;
<a name="l1149"></a> d2&lt;&lt;=1;
<a name="l1150"></a> }
<a name="l1151"></a> </span><span class=cF1>if</span><span class=cF0> (d1) {
<a name="l1152"></a> dx1=dx1&lt;&lt;32/d1;
<a name="l1153"></a> dy1=dy1&lt;&lt;32/d1;
<a name="l1154"></a> dz1=dz1&lt;&lt;32/d1;
<a name="l1155"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l1156"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l1157"></a> </span><span class=cF1>if</span><span class=cF0> (d2) {
<a name="l1158"></a> dx2=dx2&lt;&lt;32/d2;
<a name="l1159"></a> dy2=dy2&lt;&lt;32/d2;
<a name="l1160"></a> dz2=dz2&lt;&lt;32/d2;
<a name="l1161"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l1162"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l1163"></a> dc-&gt;brush=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1164"></a> x=0;y=0;
<a name="l1165"></a> dw=w&lt;&lt;32/d1;
<a name="l1166"></a> dh=h&lt;&lt;32/d2;
<a name="l1167"></a>
<a name="l1168"></a> first=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1169"></a> x1&lt;&lt;=32; y1&lt;&lt;=32; z1&lt;&lt;=32;
<a name="l1170"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j&lt;=d1;j++) {
<a name="l1171"></a> x2=x1; y2=y1; z2=z1;
<a name="l1172"></a> y=0;
<a name="l1173"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;=d2;i++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1174"></a> </span><span class=cF1>if</span><span class=cF0> (x2.i32[1]!=last_x || y2.i32[1]!=last_y || first) {
<a name="l1175"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>color=</span><span class=cF5>GrPeek</span><span class=cF0>(img,x.i32[1],y.i32[1])</span><span class=cF7>)</span><span class=cF0>&gt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l1176"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;color.c0.rop==</span><span class=cF3>ROPB_MONO</span><span class=cF0>) {
<a name="l1177"></a> </span><span class=cF1>if</span><span class=cF0> (color) </span><span class=cF7>{</span><span class=cF0>
<a name="l1178"></a> dc-&gt;color=old_color&amp;~</span><span class=cF3>ROPF_DITHER</span><span class=cF0>;
<a name="l1179"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;depth_buf) {
<a name="l1180"></a> dc-&gt;db_z=z2.i32[1];
<a name="l1181"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,x2.i32[1],y2.i32[1]);
<a name="l1182"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l1183"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,x2.i32[1],y2.i32[1]);
<a name="l1184"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1185"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1186"></a> </span><span class=cF1>if</span><span class=cF0> (color!=</span><span class=cF3>TRANSPARENT</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1187"></a> dc-&gt;color=old_color&amp;~</span><span class=cF3>COLORROP_NO_ROP0_MASK</span><span class=cF0>|color;</span><span class=cF2>//COLOR</span><span class=cF0>
<a name="l1188"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;depth_buf) {
<a name="l1189"></a> dc-&gt;db_z=z2.i32[1];
<a name="l1190"></a> </span><span class=cF5>GrPlot1</span><span class=cF0>(dc,x2.i32[1],y2.i32[1]);
<a name="l1191"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l1192"></a> </span><span class=cF5>GrPlot</span><span class=cF0>(dc,x2.i32[1],y2.i32[1]);
<a name="l1193"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1194"></a> }
<a name="l1195"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1196"></a> }
<a name="l1197"></a> first=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1198"></a> last_x=x2.i32[1]; last_y=y2.i32[1];
<a name="l1199"></a> x2+=dx2; y2+=dy2; z2+=dz2;
<a name="l1200"></a> y+=dh;
<a name="l1201"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1202"></a> x1+=dx1; y1+=dy1; z1+=dz1;
<a name="l1203"></a> x+=dw;
<a name="l1204"></a> }
<a name="l1205"></a> res=1; </span><span class=cF2>//TODO: check off scrn</span><span class=cF0>
<a name="l1206"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l1207"></a> res=</span><span class=cF5>GrBlot</span><span class=cF0>(dc,x1,y1,img);
<a name="l1208"></a>gr_done:
<a name="l1209"></a> dc-&gt;color=old_color;
<a name="l1210"></a> dc-&gt;brush=old_brush;
<a name="l1211"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1212"></a>}
<a name="l1213"></a></span><span class=cF5>Option</span><span class=cF0>(</span><span class=cF3>OPTf_WARN_HEADER_MISMATCH</span><span class=cF0>,</span><span class=cF3>ON</span><span class=cF0>);
<a name="l1214"></a>
<a name="l1215"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Graphics&quot;</span><span class=cF0>
<a name="l1216"></a>
<a name="l1217"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Gr2Bezier3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl)
<a name="l1218"></a>{</span><span class=cF2>//2nd order. Clipping and transform and thick.</span><span class=cF0>
<a name="l1219"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1220"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,z,
<a name="l1221"></a> old_flags=dc-&gt;flags;
<a name="l1222"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *ctrl2=</span><span class=cF3>NULL</span><span class=cF0>,*ctrl3=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1223"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1224"></a> ctrl2=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*3);
<a name="l1225"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;3;i++) {
<a name="l1226"></a> x=ctrl[i].x;
<a name="l1227"></a> y=ctrl[i].y;
<a name="l1228"></a> z=ctrl[i].z;
<a name="l1229"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l1230"></a> ctrl2[i].x=x;
<a name="l1231"></a> ctrl2[i].y=y;
<a name="l1232"></a> ctrl2[i].z=z;
<a name="l1233"></a> }
<a name="l1234"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l1235"></a> ctrl=ctrl2;
<a name="l1236"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1237"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1238"></a> ctrl3=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*3);
<a name="l1239"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;3;i++) {
<a name="l1240"></a> x=ctrl[i].x;
<a name="l1241"></a> y=ctrl[i].y;
<a name="l1242"></a> z=ctrl[i].z;
<a name="l1243"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;x,&amp;y,&amp;z);
<a name="l1244"></a> ctrl3[i].x=x;
<a name="l1245"></a> ctrl3[i].y=y;
<a name="l1246"></a> ctrl3[i].z=z;
<a name="l1247"></a> }
<a name="l1248"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l1249"></a> res=</span><span class=cF5>Bezier2</span><span class=cF0>(dc,ctrl3,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>);
<a name="l1250"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l1251"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l1252"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1253"></a>
<a name="l1254"></a> res|=</span><span class=cF5>Bezier2</span><span class=cF0>(dc,ctrl,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>);
<a name="l1255"></a>gr_done:
<a name="l1256"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl2);
<a name="l1257"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl3);
<a name="l1258"></a> dc-&gt;flags=old_flags;
<a name="l1259"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1260"></a>}
<a name="l1261"></a>
<a name="l1262"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Gr3Bezier3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl)
<a name="l1263"></a>{</span><span class=cF2>//3rd order. Clipping and transform and thick.</span><span class=cF0>
<a name="l1264"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1265"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,z,
<a name="l1266"></a> old_flags=dc-&gt;flags;
<a name="l1267"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *ctrl2=</span><span class=cF3>NULL</span><span class=cF0>,*ctrl3=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1268"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1269"></a> ctrl2=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*4);
<a name="l1270"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;4;i++) {
<a name="l1271"></a> x=ctrl[i].x;
<a name="l1272"></a> y=ctrl[i].y;
<a name="l1273"></a> z=ctrl[i].z;
<a name="l1274"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l1275"></a> ctrl2[i].x=x;
<a name="l1276"></a> ctrl2[i].y=y;
<a name="l1277"></a> ctrl2[i].z=z;
<a name="l1278"></a> }
<a name="l1279"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l1280"></a> ctrl=ctrl2;
<a name="l1281"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1282"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1283"></a> ctrl3=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*4);
<a name="l1284"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;4;i++) {
<a name="l1285"></a> x=ctrl[i].x;
<a name="l1286"></a> y=ctrl[i].y;
<a name="l1287"></a> z=ctrl[i].z;
<a name="l1288"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;x,&amp;y,&amp;z);
<a name="l1289"></a> ctrl3[i].x=x;
<a name="l1290"></a> ctrl3[i].y=y;
<a name="l1291"></a> ctrl3[i].z=z;
<a name="l1292"></a> }
<a name="l1293"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l1294"></a> res=</span><span class=cF5>Bezier3</span><span class=cF0>(dc,ctrl3,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>);
<a name="l1295"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l1296"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l1297"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1298"></a>
<a name="l1299"></a> res|=</span><span class=cF5>Bezier3</span><span class=cF0>(dc,ctrl,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>);
<a name="l1300"></a>gr_done:
<a name="l1301"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl2);
<a name="l1302"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl3);
<a name="l1303"></a> dc-&gt;flags=old_flags;
<a name="l1304"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1305"></a>}
<a name="l1306"></a>
<a name="l1307"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Gr2BSpline3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl,</span><span class=cF9>I64</span><span class=cF0> cnt,</span><span class=cF1>Bool</span><span class=cF0> closed=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l1308"></a>{</span><span class=cF2>//2nd order. Clipping and transform and thick.</span><span class=cF0>
<a name="l1309"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1310"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,z,
<a name="l1311"></a> old_flags=dc-&gt;flags;
<a name="l1312"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *ctrl2=</span><span class=cF3>NULL</span><span class=cF0>,*ctrl3=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1313"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1314"></a> ctrl2=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*cnt);
<a name="l1315"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++) {
<a name="l1316"></a> x=ctrl[i].x;
<a name="l1317"></a> y=ctrl[i].y;
<a name="l1318"></a> z=ctrl[i].z;
<a name="l1319"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l1320"></a> ctrl2[i].x=x;
<a name="l1321"></a> ctrl2[i].y=y;
<a name="l1322"></a> ctrl2[i].z=z;
<a name="l1323"></a> }
<a name="l1324"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l1325"></a> ctrl=ctrl2;
<a name="l1326"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1327"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1328"></a> ctrl3=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*cnt);
<a name="l1329"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++) {
<a name="l1330"></a> x=ctrl[i].x;
<a name="l1331"></a> y=ctrl[i].y;
<a name="l1332"></a> z=ctrl[i].z;
<a name="l1333"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;x,&amp;y,&amp;z);
<a name="l1334"></a> ctrl3[i].x=x;
<a name="l1335"></a> ctrl3[i].y=y;
<a name="l1336"></a> ctrl3[i].z=z;
<a name="l1337"></a> }
<a name="l1338"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l1339"></a> res=</span><span class=cF5>BSpline2</span><span class=cF0>(dc,ctrl3,cnt,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,closed);
<a name="l1340"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l1341"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l1342"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1343"></a>
<a name="l1344"></a> res|=</span><span class=cF5>BSpline2</span><span class=cF0>(dc,ctrl,cnt,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,closed);
<a name="l1345"></a>gr_done:
<a name="l1346"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl2);
<a name="l1347"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl3);
<a name="l1348"></a> dc-&gt;flags=old_flags;
<a name="l1349"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1350"></a>}
<a name="l1351"></a>
<a name="l1352"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Gr3BSpline3</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *ctrl,</span><span class=cF9>I64</span><span class=cF0> cnt,</span><span class=cF1>Bool</span><span class=cF0> closed=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l1353"></a>{</span><span class=cF2>//3rd order. Clipping and transform and thick.</span><span class=cF0>
<a name="l1354"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1355"></a> </span><span class=cF9>I64</span><span class=cF0> i,x,y,z,
<a name="l1356"></a> old_flags=dc-&gt;flags;
<a name="l1357"></a> </span><span class=cF9>CD3I32</span><span class=cF0> *ctrl2=</span><span class=cF3>NULL</span><span class=cF0>,*ctrl3=</span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1358"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1359"></a> ctrl2=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*cnt);
<a name="l1360"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++) {
<a name="l1361"></a> x=ctrl[i].x;
<a name="l1362"></a> y=ctrl[i].y;
<a name="l1363"></a> z=ctrl[i].z;
<a name="l1364"></a> (*dc-&gt;transform)(dc,&amp;x,&amp;y,&amp;z);
<a name="l1365"></a> ctrl2[i].x=x;
<a name="l1366"></a> ctrl2[i].y=y;
<a name="l1367"></a> ctrl2[i].z=z;
<a name="l1368"></a> }
<a name="l1369"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l1370"></a> ctrl=ctrl2;
<a name="l1371"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1372"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1373"></a> ctrl3=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CD3I32</span><span class=cF7>)</span><span class=cF0>*cnt);
<a name="l1374"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i&lt;cnt;i++) {
<a name="l1375"></a> x=ctrl[i].x;
<a name="l1376"></a> y=ctrl[i].y;
<a name="l1377"></a> z=ctrl[i].z;
<a name="l1378"></a> </span><span class=cF5>DCReflect</span><span class=cF0>(dc,&amp;x,&amp;y,&amp;z);
<a name="l1379"></a> ctrl3[i].x=x;
<a name="l1380"></a> ctrl3[i].y=y;
<a name="l1381"></a> ctrl3[i].z=z;
<a name="l1382"></a> }
<a name="l1383"></a> dc-&gt;flags&amp;=~</span><span class=cF3>DCF_SYMMETRY</span><span class=cF0>;
<a name="l1384"></a> res=</span><span class=cF5>BSpline3</span><span class=cF0>(dc,ctrl3,cnt,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,closed);
<a name="l1385"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_JUST_MIRROR</span><span class=cF0>)
<a name="l1386"></a> </span><span class=cF1>goto</span><span class=cF0> gr_done;
<a name="l1387"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1388"></a>
<a name="l1389"></a> res|=</span><span class=cF5>BSpline3</span><span class=cF0>(dc,ctrl,cnt,&amp;</span><span class=cF5>GrPlot3</span><span class=cF0>,closed);
<a name="l1390"></a>gr_done:
<a name="l1391"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl2);
<a name="l1392"></a> </span><span class=cF5>Free</span><span class=cF0>(ctrl3);
<a name="l1393"></a> dc-&gt;flags=old_flags;
<a name="l1394"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1395"></a>}
<a name="l1396"></a>
<a name="l1397"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>GrFillTri0</span><span class=cF0>(</span><span class=cF9>CDC</span><span class=cF0> *dc=</span><span class=cFB>gr</span><span class=cF0>.dc,</span><span class=cF9>CD3I32</span><span class=cF0> *p1,</span><span class=cF9>CD3I32</span><span class=cF0> *p2,</span><span class=cF9>CD3I32</span><span class=cF0> *p4)
<a name="l1398"></a>{</span><span class=cF2>//3D. Returns cnt of pixs changed</span><span class=cF0>
<a name="l1399"></a> </span><span class=cF9>I64</span><span class=cF0> x1,x2,y1,y2,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,res=0,i,min,max;
<a name="l1400"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task;
<a name="l1401"></a>
<a name="l1402"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>p1-&gt;y-p2-&gt;y</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>p1-&gt;y-p4-&gt;y</span><span class=cF7>)</span><span class=cF0>&lt;=
<a name="l1403"></a> </span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>p1-&gt;x-p2-&gt;x</span><span class=cF7>)</span><span class=cF0>+</span><span class=cF5>AbsI64</span><span class=cF7>(</span><span class=cF0>p1-&gt;x-p4-&gt;x</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l1404"></a></span><span class=cF2>//p1 is min x</span><span class=cF0>
<a name="l1405"></a> </span><span class=cF1>if</span><span class=cF0> (p4-&gt;x&lt;p2-&gt;x)
<a name="l1406"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;p4,&amp;p2);
<a name="l1407"></a> </span><span class=cF1>if</span><span class=cF0> (p2-&gt;x&lt;p1-&gt;x)
<a name="l1408"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;p2,&amp;p1);
<a name="l1409"></a>
<a name="l1410"></a> </span><span class=cF2>//p2y&lt;=p4y</span><span class=cF0>
<a name="l1411"></a> </span><span class=cF1>if</span><span class=cF0> (p4-&gt;y&lt;p2-&gt;y)
<a name="l1412"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;p4,&amp;p2);
<a name="l1413"></a>
<a name="l1414"></a> min=0;
<a name="l1415"></a> max=dc-&gt;height;
<a name="l1416"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) {
<a name="l1417"></a> win_task=dc-&gt;win_task;
<a name="l1418"></a> min-=win_task-&gt;scroll_y+win_task-&gt;pix_top;
<a name="l1419"></a> max-=win_task-&gt;scroll_y+win_task-&gt;pix_top;
<a name="l1420"></a> </span><span class=cF1>if</span><span class=cF0> (max&gt;win_task-&gt;pix_bottom-</span><span class=cF7>(</span><span class=cF0>win_task-&gt;scroll_y+win_task-&gt;pix_top</span><span class=cF7>)</span><span class=cF0>)
<a name="l1421"></a> max=win_task-&gt;pix_bottom-(win_task-&gt;scroll_y+win_task-&gt;pix_top);
<a name="l1422"></a> }
<a name="l1423"></a>
<a name="l1424"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>dy2=p4-&gt;y-p1-&gt;y</span><span class=cF7>)</span><span class=cF0>&lt;0) {
<a name="l1425"></a> dy1=p2-&gt;y-p1-&gt;y;
<a name="l1426"></a> dx1=(p1-&gt;x-p2-&gt;x)&lt;&lt;32/dy1;
<a name="l1427"></a> dz1=(p1-&gt;z-p2-&gt;z)&lt;&lt;32/dy1;
<a name="l1428"></a>
<a name="l1429"></a> dx2=(p1-&gt;x-p4-&gt;x)&lt;&lt;32/dy2;
<a name="l1430"></a> dz2=(p1-&gt;z-p4-&gt;z)&lt;&lt;32/dy2;
<a name="l1431"></a> x1=x2=p1-&gt;x&lt;&lt;32; y1=p1-&gt;y; z1=z2=p1-&gt;z&lt;&lt;32;
<a name="l1432"></a> </span><span class=cF1>if</span><span class=cF0> (y1+dy2&lt;min) </span><span class=cF7>{</span><span class=cF0>
<a name="l1433"></a> i=min-(y1+dy2);
<a name="l1434"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dy2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1435"></a> dy2+=i;
<a name="l1436"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1437"></a> </span><span class=cF1>if</span><span class=cF0> (y1&gt;=max) </span><span class=cF7>{</span><span class=cF0>
<a name="l1438"></a> i=y1-max+1;
<a name="l1439"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dy2)
<a name="l1440"></a> i=-dy2;
<a name="l1441"></a> dy2+=i;
<a name="l1442"></a> y1-=i;
<a name="l1443"></a> x1+=dx1*i;
<a name="l1444"></a> x2+=dx2*i;
<a name="l1445"></a> z1+=dz1*i;
<a name="l1446"></a> z2+=dz2*i;
<a name="l1447"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1448"></a> </span><span class=cF1>while</span><span class=cF0> (dy2++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1449"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
<a name="l1450"></a> y1--;
<a name="l1451"></a> x1+=dx1;
<a name="l1452"></a> x2+=dx2;
<a name="l1453"></a> z1+=dz1;
<a name="l1454"></a> z2+=dz2;
<a name="l1455"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1456"></a> </span><span class=cF1>if</span><span class=cF0> (dy2=p2-&gt;y-p4-&gt;y) </span><span class=cF7>{</span><span class=cF0>
<a name="l1457"></a> dx2=(p4-&gt;x-p2-&gt;x)&lt;&lt;32/dy2;
<a name="l1458"></a> dz2=(p4-&gt;z-p2-&gt;z)&lt;&lt;32/dy2;
<a name="l1459"></a> </span><span class=cF1>if</span><span class=cF0> (y1+dy2&lt;min) {
<a name="l1460"></a> i=min-(y1+dy2);
<a name="l1461"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dy2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1462"></a> dy2+=i;
<a name="l1463"></a> }
<a name="l1464"></a> </span><span class=cF1>if</span><span class=cF0> (y1&gt;=max) {
<a name="l1465"></a> i=y1-max+1;
<a name="l1466"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dy2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1467"></a> dy2+=i;
<a name="l1468"></a> y1-=i;
<a name="l1469"></a> x1+=dx1*i;
<a name="l1470"></a> x2+=dx2*i;
<a name="l1471"></a> z1+=dz1*i;
<a name="l1472"></a> z2+=dz2*i;
<a name="l1473"></a> }
<a name="l1474"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1475"></a> </span><span class=cF1>while</span><span class=cF0> (dy2++&lt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l1476"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
<a name="l1477"></a> y1--;
<a name="l1478"></a> x1+=dx1;
<a name="l1479"></a> x2+=dx2;
<a name="l1480"></a> z1+=dz1;
<a name="l1481"></a> z2+=dz2;
<a name="l1482"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1483"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>dy2=p2-&gt;y-p1-&gt;y</span><span class=cF7>)</span><span class=cF0>&gt;0) {
<a name="l1484"></a> dy1=p4-&gt;y-p1-&gt;y;
<a name="l1485"></a> dx1=(p4-&gt;x-p1-&gt;x)&lt;&lt;32/dy1;
<a name="l1486"></a> dz1=(p4-&gt;z-p1-&gt;z)&lt;&lt;32/dy1;
<a name="l1487"></a>
<a name="l1488"></a> dx2=(p2-&gt;x-p1-&gt;x)&lt;&lt;32/dy2;
<a name="l1489"></a> dz2=(p2-&gt;z-p1-&gt;z)&lt;&lt;32/dy2;
<a name="l1490"></a> x1=x2=p1-&gt;x&lt;&lt;32; y1=p1-&gt;y; z1=z2=p1-&gt;z&lt;&lt;32;
<a name="l1491"></a> </span><span class=cF1>if</span><span class=cF0> (y1+dy2&gt;=max) </span><span class=cF7>{</span><span class=cF0>
<a name="l1492"></a> i=y1+dy2-max+1;
<a name="l1493"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dy2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1494"></a> dy2-=i;
<a name="l1495"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1496"></a> </span><span class=cF1>if</span><span class=cF0> (y1&lt;min) </span><span class=cF7>{</span><span class=cF0>
<a name="l1497"></a> i=min-y1;
<a name="l1498"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dy2)
<a name="l1499"></a> i=dy2;
<a name="l1500"></a> dy2-=i;
<a name="l1501"></a> y1+=i;
<a name="l1502"></a> x1+=dx1*i;
<a name="l1503"></a> x2+=dx2*i;
<a name="l1504"></a> z1+=dz1*i;
<a name="l1505"></a> z2+=dz2*i;
<a name="l1506"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1507"></a> </span><span class=cF1>while</span><span class=cF0> (dy2--) </span><span class=cF7>{</span><span class=cF0>
<a name="l1508"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
<a name="l1509"></a> y1++;
<a name="l1510"></a> x1+=dx1;
<a name="l1511"></a> x2+=dx2;
<a name="l1512"></a> z1+=dz1;
<a name="l1513"></a> z2+=dz2;
<a name="l1514"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1515"></a> </span><span class=cF1>if</span><span class=cF0> (dy2=p4-&gt;y-p2-&gt;y) </span><span class=cF7>{</span><span class=cF0>
<a name="l1516"></a> dx2=(p4-&gt;x-p2-&gt;x)&lt;&lt;32/dy2;
<a name="l1517"></a> dz2=(p4-&gt;z-p2-&gt;z)&lt;&lt;32/dy2;
<a name="l1518"></a> </span><span class=cF1>if</span><span class=cF0> (y1+dy2&gt;=max) {
<a name="l1519"></a> i=y1+dy2-max+1;
<a name="l1520"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dy2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1521"></a> dy2-=i;
<a name="l1522"></a> }
<a name="l1523"></a> </span><span class=cF1>if</span><span class=cF0> (y1&lt;min) {
<a name="l1524"></a> i=min-y1;
<a name="l1525"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dy2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1526"></a> dy2-=i;
<a name="l1527"></a> y1+=i;
<a name="l1528"></a> x1+=dx1*i;
<a name="l1529"></a> x2+=dx2*i;
<a name="l1530"></a> z1+=dz1*i;
<a name="l1531"></a> z2+=dz2*i;
<a name="l1532"></a> }
<a name="l1533"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1534"></a> </span><span class=cF1>while</span><span class=cF0> (dy2--&gt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l1535"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
<a name="l1536"></a> y1++;
<a name="l1537"></a> x1+=dx1;
<a name="l1538"></a> x2+=dx2;
<a name="l1539"></a> z1+=dz1;
<a name="l1540"></a> z2+=dz2;
<a name="l1541"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1542"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1543"></a> </span><span class=cF1>if</span><span class=cF0> (dy1=p2-&gt;y-p1-&gt;y) </span><span class=cF7>{</span><span class=cF0>
<a name="l1544"></a> dx1=(p2-&gt;x-p1-&gt;x)&lt;&lt;32/dy1;
<a name="l1545"></a> dz1=(p2-&gt;z-p1-&gt;z)&lt;&lt;32/dy1;
<a name="l1546"></a> </span><span class=cF1>if</span><span class=cF0> (dy2=p2-&gt;y-p4-&gt;y) {
<a name="l1547"></a> dx2=(p2-&gt;x-p4-&gt;x)&lt;&lt;32/dy2;
<a name="l1548"></a> dz2=(p2-&gt;z-p4-&gt;z)&lt;&lt;32/dy2;
<a name="l1549"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1550"></a> dx2=0;
<a name="l1551"></a> dz2=0;
<a name="l1552"></a> }
<a name="l1553"></a> x1=x2=p2-&gt;x&lt;&lt;32; y1=p2-&gt;y; z1=z2=p2-&gt;z&lt;&lt;32;
<a name="l1554"></a> </span><span class=cF1>if</span><span class=cF0> (y1&lt;min) {
<a name="l1555"></a> i=min-y1;
<a name="l1556"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dy1)
<a name="l1557"></a> i=-dy1;
<a name="l1558"></a> dy1+=i;
<a name="l1559"></a> y1+=i;
<a name="l1560"></a> x1+=dx1*i;
<a name="l1561"></a> x2+=dx2*i;
<a name="l1562"></a> z1+=dz1*i;
<a name="l1563"></a> z2+=dz2*i;
<a name="l1564"></a> }
<a name="l1565"></a> </span><span class=cF1>while</span><span class=cF0> (dy1++&lt;=0) {
<a name="l1566"></a> </span><span class=cF1>if</span><span class=cF0> (y1&lt;max)
<a name="l1567"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
<a name="l1568"></a> y1++;
<a name="l1569"></a> x1+=dx1;
<a name="l1570"></a> x2+=dx2;
<a name="l1571"></a> z1+=dz1;
<a name="l1572"></a> z2+=dz2;
<a name="l1573"></a> }
<a name="l1574"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1575"></a> </span><span class=cF1>if</span><span class=cF0> (dy1=p4-&gt;y-p1-&gt;y) </span><span class=cF7>{</span><span class=cF0>
<a name="l1576"></a> dx1=(p1-&gt;x-p4-&gt;x)&lt;&lt;32/dy1;
<a name="l1577"></a> dz1=(p1-&gt;z-p4-&gt;z)&lt;&lt;32/dy1;
<a name="l1578"></a> </span><span class=cF1>if</span><span class=cF0> (dy2=p4-&gt;y-p2-&gt;y) {
<a name="l1579"></a> dx2=(p2-&gt;x-p4-&gt;x)&lt;&lt;32/dy2;
<a name="l1580"></a> dz2=(p2-&gt;z-p4-&gt;z)&lt;&lt;32/dy2;
<a name="l1581"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1582"></a> dx2=0;
<a name="l1583"></a> dz2=0;
<a name="l1584"></a> }
<a name="l1585"></a> x1=x2=p4-&gt;x&lt;&lt;32; y1=p4-&gt;y; z1=z2=p4-&gt;z&lt;&lt;32;
<a name="l1586"></a> </span><span class=cF1>if</span><span class=cF0> (y1-dy1&lt;min) {
<a name="l1587"></a> i=min-(y1-dy1);
<a name="l1588"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dy1) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1589"></a> dy1-=i;
<a name="l1590"></a> }
<a name="l1591"></a> </span><span class=cF1>if</span><span class=cF0> (y1&gt;=max) {
<a name="l1592"></a> i=y1-max+1;
<a name="l1593"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dy1) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1594"></a> dy1-=i;
<a name="l1595"></a> y1-=i;
<a name="l1596"></a> x1+=dx1*i;
<a name="l1597"></a> x2+=dx2*i;
<a name="l1598"></a> z1+=dz1*i;
<a name="l1599"></a> z2+=dz2*i;
<a name="l1600"></a> }
<a name="l1601"></a> </span><span class=cF1>while</span><span class=cF0> (dy1--&gt;=0) {
<a name="l1602"></a> res+=</span><span class=cF5>GrHLine</span><span class=cF0>(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
<a name="l1603"></a> y1--;
<a name="l1604"></a> x1+=dx1;
<a name="l1605"></a> x2+=dx2;
<a name="l1606"></a> z1+=dz1;
<a name="l1607"></a> z2+=dz2;
<a name="l1608"></a> }
<a name="l1609"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1610"></a> }
<a name="l1611"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l1612"></a></span><span class=cF2>//p1 is min y</span><span class=cF0>
<a name="l1613"></a> </span><span class=cF1>if</span><span class=cF0> (p4-&gt;y&lt;p2-&gt;y)
<a name="l1614"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;p4,&amp;p2);
<a name="l1615"></a> </span><span class=cF1>if</span><span class=cF0> (p2-&gt;y&lt;p1-&gt;y)
<a name="l1616"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;p2,&amp;p1);
<a name="l1617"></a>
<a name="l1618"></a> </span><span class=cF2>//p2x&lt;=p4x</span><span class=cF0>
<a name="l1619"></a> </span><span class=cF1>if</span><span class=cF0> (p4-&gt;x&lt;p2-&gt;x)
<a name="l1620"></a> </span><span class=cF5>SwapI64</span><span class=cF0>(&amp;p4,&amp;p2);
<a name="l1621"></a>
<a name="l1622"></a> min=0;
<a name="l1623"></a> max=dc-&gt;width;
<a name="l1624"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;flags &amp; </span><span class=cF3>DCF_SCRN_BITMAP</span><span class=cF0>) {
<a name="l1625"></a> win_task=dc-&gt;win_task;
<a name="l1626"></a> min-=win_task-&gt;scroll_x+win_task-&gt;pix_left;
<a name="l1627"></a> max-=win_task-&gt;scroll_x+win_task-&gt;pix_left;
<a name="l1628"></a> </span><span class=cF1>if</span><span class=cF0> (max&gt;win_task-&gt;pix_right-</span><span class=cF7>(</span><span class=cF0>win_task-&gt;scroll_x+win_task-&gt;pix_left</span><span class=cF7>)</span><span class=cF0>)
<a name="l1629"></a> max=win_task-&gt;pix_right-(win_task-&gt;scroll_x+win_task-&gt;pix_left);
<a name="l1630"></a> }
<a name="l1631"></a>
<a name="l1632"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>dx2=p4-&gt;x-p1-&gt;x</span><span class=cF7>)</span><span class=cF0>&lt;0) {
<a name="l1633"></a> dx1=p2-&gt;x-p1-&gt;x;
<a name="l1634"></a> dy1=(p1-&gt;y-p2-&gt;y)&lt;&lt;32/dx1;
<a name="l1635"></a> dz1=(p1-&gt;z-p2-&gt;z)&lt;&lt;32/dx1;
<a name="l1636"></a>
<a name="l1637"></a> dy2=(p1-&gt;y-p4-&gt;y)&lt;&lt;32/dx2;
<a name="l1638"></a> dz2=(p1-&gt;z-p4-&gt;z)&lt;&lt;32/dx2;
<a name="l1639"></a> y1=y2=p1-&gt;y&lt;&lt;32; x1=p1-&gt;x; z1=z2=p1-&gt;z&lt;&lt;32;
<a name="l1640"></a> </span><span class=cF1>if</span><span class=cF0> (x1+dx2&lt;min) </span><span class=cF7>{</span><span class=cF0>
<a name="l1641"></a> i=min-(x1+dx2);
<a name="l1642"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dx2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1643"></a> dx2+=i;
<a name="l1644"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1645"></a> </span><span class=cF1>if</span><span class=cF0> (x1&gt;=max) </span><span class=cF7>{</span><span class=cF0>
<a name="l1646"></a> i=x1-max+1;
<a name="l1647"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dx2)
<a name="l1648"></a> i=-dx2;
<a name="l1649"></a> dx2+=i;
<a name="l1650"></a> x1-=i;
<a name="l1651"></a> y1+=dy1*i;
<a name="l1652"></a> y2+=dy2*i;
<a name="l1653"></a> z1+=dz1*i;
<a name="l1654"></a> z2+=dz2*i;
<a name="l1655"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1656"></a> </span><span class=cF1>while</span><span class=cF0> (dx2++) </span><span class=cF7>{</span><span class=cF0>
<a name="l1657"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
<a name="l1658"></a> x1--;
<a name="l1659"></a> y1+=dy1;
<a name="l1660"></a> y2+=dy2;
<a name="l1661"></a> z1+=dz1;
<a name="l1662"></a> z2+=dz2;
<a name="l1663"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1664"></a> </span><span class=cF1>if</span><span class=cF0> (dx2=p2-&gt;x-p4-&gt;x) </span><span class=cF7>{</span><span class=cF0>
<a name="l1665"></a> dy2=(p4-&gt;y-p2-&gt;y)&lt;&lt;32/dx2;
<a name="l1666"></a> dz2=(p4-&gt;z-p2-&gt;z)&lt;&lt;32/dx2;
<a name="l1667"></a> </span><span class=cF1>if</span><span class=cF0> (x1+dx2&lt;min) {
<a name="l1668"></a> i=min-(x1+dx2);
<a name="l1669"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dx2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1670"></a> dx2+=i;
<a name="l1671"></a> }
<a name="l1672"></a> </span><span class=cF1>if</span><span class=cF0> (x1&gt;=max) {
<a name="l1673"></a> i=x1-max+1;
<a name="l1674"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dx2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1675"></a> dx2+=i;
<a name="l1676"></a> x1-=i;
<a name="l1677"></a> y1+=dy1*i;
<a name="l1678"></a> y2+=dy2*i;
<a name="l1679"></a> z1+=dz1*i;
<a name="l1680"></a> z2+=dz2*i;
<a name="l1681"></a> }
<a name="l1682"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1683"></a> </span><span class=cF1>while</span><span class=cF0> (dx2++&lt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l1684"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
<a name="l1685"></a> x1--;
<a name="l1686"></a> y1+=dy1;
<a name="l1687"></a> y2+=dy2;
<a name="l1688"></a> z1+=dz1;
<a name="l1689"></a> z2+=dz2;
<a name="l1690"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1691"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>dx2=p2-&gt;x-p1-&gt;x</span><span class=cF7>)</span><span class=cF0>&gt;0) {
<a name="l1692"></a> dx1=p4-&gt;x-p1-&gt;x;
<a name="l1693"></a> dy1=(p4-&gt;y-p1-&gt;y)&lt;&lt;32/dx1;
<a name="l1694"></a> dz1=(p4-&gt;z-p1-&gt;z)&lt;&lt;32/dx1;
<a name="l1695"></a>
<a name="l1696"></a> dy2=(p2-&gt;y-p1-&gt;y)&lt;&lt;32/dx2;
<a name="l1697"></a> dz2=(p2-&gt;z-p1-&gt;z)&lt;&lt;32/dx2;
<a name="l1698"></a> y1=y2=p1-&gt;y&lt;&lt;32; x1=p1-&gt;x; z1=z2=p1-&gt;z&lt;&lt;32;
<a name="l1699"></a> </span><span class=cF1>if</span><span class=cF0> (x1+dx2&gt;=max) </span><span class=cF7>{</span><span class=cF0>
<a name="l1700"></a> i=x1+dx2-max+1;
<a name="l1701"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dx2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1702"></a> dx2-=i;
<a name="l1703"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1704"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;min) </span><span class=cF7>{</span><span class=cF0>
<a name="l1705"></a> i=min-x1;
<a name="l1706"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dx2)
<a name="l1707"></a> i=dx2;
<a name="l1708"></a> dx2-=i;
<a name="l1709"></a> x1+=i;
<a name="l1710"></a> y1+=dy1*i;
<a name="l1711"></a> y2+=dy2*i;
<a name="l1712"></a> z1+=dz1*i;
<a name="l1713"></a> z2+=dz2*i;
<a name="l1714"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1715"></a> </span><span class=cF1>while</span><span class=cF0> (dx2--) </span><span class=cF7>{</span><span class=cF0>
<a name="l1716"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
<a name="l1717"></a> x1++;
<a name="l1718"></a> y1+=dy1;
<a name="l1719"></a> y2+=dy2;
<a name="l1720"></a> z1+=dz1;
<a name="l1721"></a> z2+=dz2;
<a name="l1722"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1723"></a> </span><span class=cF1>if</span><span class=cF0> (dx2=p4-&gt;x-p2-&gt;x) </span><span class=cF7>{</span><span class=cF0>
<a name="l1724"></a> dy2=(p4-&gt;y-p2-&gt;y)&lt;&lt;32/dx2;
<a name="l1725"></a> dz2=(p4-&gt;z-p2-&gt;z)&lt;&lt;32/dx2;
<a name="l1726"></a> </span><span class=cF1>if</span><span class=cF0> (x1+dx2&gt;=max) {
<a name="l1727"></a> i=x1+dx2-max+1;
<a name="l1728"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dx2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1729"></a> dx2-=i;
<a name="l1730"></a> }
<a name="l1731"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;min) {
<a name="l1732"></a> i=min-x1;
<a name="l1733"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dx2) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1734"></a> dx2-=i;
<a name="l1735"></a> x1+=i;
<a name="l1736"></a> y1+=dy1*i;
<a name="l1737"></a> y2+=dy2*i;
<a name="l1738"></a> z1+=dz1*i;
<a name="l1739"></a> z2+=dz2*i;
<a name="l1740"></a> }
<a name="l1741"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1742"></a> </span><span class=cF1>while</span><span class=cF0> (dx2--&gt;=0) </span><span class=cF7>{</span><span class=cF0>
<a name="l1743"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
<a name="l1744"></a> x1++;
<a name="l1745"></a> y1+=dy1;
<a name="l1746"></a> y2+=dy2;
<a name="l1747"></a> z1+=dz1;
<a name="l1748"></a> z2+=dz2;
<a name="l1749"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1750"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1751"></a> </span><span class=cF1>if</span><span class=cF0> (dx1=p2-&gt;x-p1-&gt;x) </span><span class=cF7>{</span><span class=cF0>
<a name="l1752"></a> dy1=(p2-&gt;y-p1-&gt;y)&lt;&lt;32/dx1;
<a name="l1753"></a> dz1=(p2-&gt;z-p1-&gt;z)&lt;&lt;32/dx1;
<a name="l1754"></a> </span><span class=cF1>if</span><span class=cF0> (dx2=p2-&gt;x-p4-&gt;x) {
<a name="l1755"></a> dy2=(p2-&gt;y-p4-&gt;y)&lt;&lt;32/dx2;
<a name="l1756"></a> dz2=(p2-&gt;z-p4-&gt;z)&lt;&lt;32/dx2;
<a name="l1757"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1758"></a> dy2=0;
<a name="l1759"></a> dz2=0;
<a name="l1760"></a> }
<a name="l1761"></a> y1=y2=p2-&gt;y&lt;&lt;32; x1=p2-&gt;x; z1=z2=p2-&gt;z&lt;&lt;32;
<a name="l1762"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;min) {
<a name="l1763"></a> i=min-x1;
<a name="l1764"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;-dx1)
<a name="l1765"></a> i=-dx1;
<a name="l1766"></a> dx1+=i;
<a name="l1767"></a> x1+=i;
<a name="l1768"></a> y1+=dy1*i;
<a name="l1769"></a> y2+=dy2*i;
<a name="l1770"></a> z1+=dz1*i;
<a name="l1771"></a> z2+=dz2*i;
<a name="l1772"></a> }
<a name="l1773"></a> </span><span class=cF1>while</span><span class=cF0> (dx1++&lt;=0) {
<a name="l1774"></a> </span><span class=cF1>if</span><span class=cF0> (x1&lt;max)
<a name="l1775"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
<a name="l1776"></a> x1++;
<a name="l1777"></a> y1+=dy1;
<a name="l1778"></a> y2+=dy2;
<a name="l1779"></a> z1+=dz1;
<a name="l1780"></a> z2+=dz2;
<a name="l1781"></a> }
<a name="l1782"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1783"></a> </span><span class=cF1>if</span><span class=cF0> (dx1=p4-&gt;x-p1-&gt;x) </span><span class=cF7>{</span><span class=cF0>
<a name="l1784"></a> dy1=(p1-&gt;y-p4-&gt;y)&lt;&lt;32/dx1;
<a name="l1785"></a> dz1=(p1-&gt;z-p4-&gt;z)&lt;&lt;32/dx1;
<a name="l1786"></a> </span><span class=cF1>if</span><span class=cF0> (dx2=p4-&gt;x-p2-&gt;x) {
<a name="l1787"></a> dy2=(p2-&gt;y-p4-&gt;y)&lt;&lt;32/dx2;
<a name="l1788"></a> dz2=(p2-&gt;z-p4-&gt;z)&lt;&lt;32/dx2;
<a name="l1789"></a> } </span><span class=cF1>else</span><span class=cF0> {
<a name="l1790"></a> dy2=0;
<a name="l1791"></a> dz2=0;
<a name="l1792"></a> }
<a name="l1793"></a> y1=y2=p4-&gt;y&lt;&lt;32; x1=p4-&gt;x; z1=z2=p4-&gt;z&lt;&lt;32;
<a name="l1794"></a> </span><span class=cF1>if</span><span class=cF0> (x1-dx1&lt;min) {
<a name="l1795"></a> i=min-(x1-dx1);
<a name="l1796"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dx1) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1797"></a> dx1-=i;
<a name="l1798"></a> }
<a name="l1799"></a> </span><span class=cF1>if</span><span class=cF0> (x1&gt;=max) {
<a name="l1800"></a> i=x1-max+1;
<a name="l1801"></a> </span><span class=cF1>if</span><span class=cF0> (i&gt;dx1) </span><span class=cF1>goto</span><span class=cF0> ft_done;
<a name="l1802"></a> dx1-=i;
<a name="l1803"></a> x1-=i;
<a name="l1804"></a> y1+=dy1*i;
<a name="l1805"></a> y2+=dy2*i;
<a name="l1806"></a> z1+=dz1*i;
<a name="l1807"></a> z2+=dz2*i;
<a name="l1808"></a> }
<a name="l1809"></a> </span><span class=cF1>while</span><span class=cF0> (dx1--&gt;=0) {
<a name="l1810"></a> res+=</span><span class=cF5>GrVLine</span><span class=cF0>(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
<a name="l1811"></a> x1--;
<a name="l1812"></a> y1+=dy1;
<a name="l1813"></a> y2+=dy2;
<a name="l1814"></a> z1+=dz1;
<a name="l1815"></a> z2+=dz2;
<a name="l1816"></a> }
<a name="l1817"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1818"></a> }
<a name="l1819"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1820"></a>ft_done:
<a name="l1821"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l1822"></a>}
</span></pre></body>
</html>