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