56de4bac0f
git-svn-id: svn://kolibrios.org@2815 a494cfbc-eb01-0410-851d-a64ba20cac60
392 lines
20 KiB
HTML
392 lines
20 KiB
HTML
<html>
|
|
<head>
|
|
<title>áèáëèîòåêà äëÿ ðàáîòû ñ 2d áóôåðàìè</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=WINDOWS-1251">
|
|
<style>
|
|
body
|
|
{
|
|
font-size: 15px;
|
|
font-family: "Bookman Old Style";
|
|
color: black;
|
|
text-align: justify;
|
|
}
|
|
h1 { color: green; font-size: 23px; }
|
|
h2 { color: green; font-size: 21px; }
|
|
h3 { color: green; font-size: 19px; }
|
|
h4 { color: #803f00; font-size: 17px; }
|
|
i { color: #0099cc; }
|
|
b { color: #0099cc; }
|
|
p {
|
|
text-indent: 1em;
|
|
margin-top: 3px;
|
|
margin-bottom: 2px;
|
|
margin-left: 0px;
|
|
margin-right: 0px;
|
|
}
|
|
ol, ul, dl{
|
|
margin-top: 3px;
|
|
margin-bottom: 2px;
|
|
}
|
|
pre
|
|
{
|
|
padding: 2px;
|
|
padding-left: 20px;
|
|
margin-top: 5px;
|
|
margin-bottom: 5px;
|
|
margin-left: 0px;
|
|
margin-right: 0px;
|
|
font-family: "Courier New";
|
|
font-size: 15px;
|
|
color: #004000;
|
|
background-color: #ffd0ff;
|
|
}
|
|
table { font-size: 15px; }
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Îãëàâëåíèå</h1>
|
|
<ul>
|
|
<li>Âñòóïëåíèå</li>
|
|
<li><a href="#format_buf">Ôîðìàòû áóôåðîâ</a></li>
|
|
<li><a href="#fun">Ôóíêöèè</a><br>
|
|
<ul>
|
|
<li><a href="#f_init">lib_init</a></li>
|
|
<li><a href="#f_b_create">buf2d_create</a></li>
|
|
<li><a href="#f_c_color">buf2d_crop_color</a></li>
|
|
<li><a href="#f_v_brush_c">buf2d_vox_brush_create</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#const">Êîíñòàíòû</a></li>
|
|
<li><a href="#tabl_e">Òàáëèöà ýêñïîðòà</a></li>
|
|
<li><a href="#hist">Èñòîðèÿ</a></li>
|
|
</ul>
|
|
|
|
<h1>Âñòóïëåíèå</h1>
|
|
<p>Äîêóìåíòàöèÿ ê ñâîáîäíîé áèáëèîòåêå <b>buf2d.asm</b>, äëÿ <b>ÎÑ Êîëèáðè</b>.
|
|
Ýòà áèáëèîòåêà ñîçäàíà äëÿ ðàáîòû ñ 2d èçîáðàæåíèÿìè.
|
|
Ñ åå ïîìîùüþ ìîæíî ñîçäàâàòü áóôåðà ñ èçîáðàæåíèÿìè â ïàìÿòè, è ïðè íåîáõîäèìîñòè âûâîäèòü èõ íà ýêðàí.
|
|
Èçîáðàæåíèÿ ìîæíî íàêëàäûâàòü îäíî íà äðóãîå, ïîääåðæèâàåòñÿ ðàáîòà ñ ïðîçðà÷íûìè èçîáðàæåíèÿìè.
|
|
Åñòü ôóíêöèè ðèñîâàíèÿ ëèíèé, êðèâûõ Áåçüå, ïðÿìîóãîëüíèêîâ, îêðóæíîñòåé.
|
|
Òàêæå åñòü ôóíêöèè äëÿ ðèñîâàíèé âîêñåëüíîé ãðàôèêè.</p>
|
|
|
|
<p>Ïîñëåäíåå îáíîâëåíèå áèáëèîòåêè 21.06.12.</p>
|
|
|
|
<h1><a name="format_buf">Ôîðìàòû áóôåðîâ</a></h1>
|
|
<p>Ïîääåðæèâàåòñÿ 3 ôîðìàòà áóôåðîâ.
|
|
Êàæäàÿ ôóíêöèÿ ïðè ðàáîòå ñ áóôåðàìè ìîæåò áûòü ðàñ÷èòàíà íà ðàáîòó ñ îïðåäåëåííûìè ôîðìàòàìè èçîáðàæåíèé.</p>
|
|
|
|
<h4>8 áèò</h4>
|
|
<p>Ñîæåðæèò àëüôà êàíàë <b>a</b> (ïðîçðà÷íîñòü) èçîáðàæåíèÿ. Íà ýêðàí íå âûâîäèòñÿ. Èñïîëüçóåòñÿ äëÿ ñîçäàíÿ 32-áèòíûõ áóôåðîâ.</p>
|
|
<h4>24 áèò</h4>
|
|
<p>Äàííûé áóôåð ñîäåðæèò èçîáðàæåíèå â ôîðìàòå <b>rgb</b>. Ìîæåò âûâîäèòñÿ íà ýêðàí.</p>
|
|
<h4>32 áèò</h4>
|
|
<p>Ñîäåðæèò ïðîçðà÷íîå èçîáðàæåíèå â ôîðìàòå <b>rgba</b>. Íà ýêðàí íå âûâîäèòñÿ. Èñïîëüçóåòñÿ äëÿ íàëîæåíèÿ èçîáðàæåíèé.</p>
|
|
|
|
<h1><a name="fun">Ôóíêöèè</a></h1>
|
|
|
|
<p>Ïî÷òè âñå ôóíêöèè 1-ì ïàðàìåòðîì ïðèíèìàþò óêàçàòåëü íà ñòðóêòóðó áóôåðà,
|
|
èç êîòîðîé ìîãóò èñïîëüçîâàòüñÿ ïàðàìåòðû, íóæíûå äëÿ ðàáîòû êîíêðåòíîé ôóíêöèè.
|
|
Ïðèìåð ñòðóêòóðû áóôåðà èçîáðàæåíèÿ:</p>
|
|
<pre>align 4
|
|
buf_0:
|
|
dd 0 ;+ 0 óêàçàòåëü íà áóôåð èçîáðàæåíèÿ
|
|
dw 100 ;+ 4 îòñòóï ñëåâà
|
|
dw 10 ;+ 6 îòñòóï ñïðàâà
|
|
dd 150 ;+ 8 øèðèíà
|
|
dd 100 ;+12 âûñîòà
|
|
dd 0x80 ;+16 ôîíîâûé öâåò
|
|
db 24 ;+20 áèò íà ïèêñåëü</pre>
|
|
|
|
<h4><a name="f_init">lib_init</a></h4>
|
|
<p>Ýòà ôóíêöèÿ ïîëó÷àåò óêàçàòåëè íà ôóíêöèè ðàáîòû ñ ïàìÿòüþ, âûçûâàòñÿ äîëæíà ïðè çàãðóçêå áèáëèîòåêè. Ìîæåòå èñïîëüçîâàòü ìàêðîñ <b>@use_library_mem</b>, äëÿ åå àâòîìàòè÷åñêîé íàñòðîéêè.</p>
|
|
|
|
<h4><a name="f_b_create">buf2d_create</a></h4>
|
|
<p>Ñîçäàåò áóôåð è ÷èñòèò åãî ôîíîâûì öâåòîì. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_create], buf_0</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà.</p>
|
|
<p>Ïàðàìåòðû äëÿ ñîçäàíèÿ áóôåðà áåðóòñÿ èç ñòðóêòóðû.</p>
|
|
|
|
<h4>buf2d_create_f_img</h4>
|
|
<p>Ñîçäàåò áóôåð íà îñíîâå èçîáðàæåíèÿ â ôîðìàòå <b>rgb</b>.</p>
|
|
|
|
<h4>buf2d_clear</h4>
|
|
<p>×èñòèò áóôåð óêàçàíûì öâåòîì. Ïðèìåð:</p>
|
|
<pre>buf2d_color equ dword[edi+16] ;öâåò ôîíà áóôåðà
|
|
mov edi,buf_0
|
|
stdcall [buf2d_clear], edi, buf2d_color ;î÷èùàåì ýêðàí ôîíîâûì öâåòîì</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà.</p>
|
|
|
|
<h4>buf2d_draw</h4>
|
|
<p>Ðèñóåò áóôåð íà ýêðàíå (ðàáîòàåò ÷åðåç ñèñòåìíóþ ô. 7). Ðèñóþòñÿ òîëüêî áóôåðà ñ ãëóáèíîé öâåòà 24 áèòà.</p>
|
|
|
|
<h4>buf2d_delete</h4>
|
|
<p>Îñâîáîæäàåò ïàìÿòü çàíÿòóþ èçîáðàæåíèåì áóôåðà.</p>
|
|
|
|
<h4>buf2d_resize</h4>
|
|
<p>Èçìåíÿåò ðàçìåðû áóôåðà. Ïîêà ïîääåðæèâàþòñÿ áóôåðà ñ ãëóáèíîé öâåòà 24 áèòà. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_resize], buf_0, 0,300 ;èçìåíÿåì âûñîòó áóôåðà</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ ëèíèÿ; 0 - íîâàÿ øèðèíà áóôåðà (0 îçíà÷àåò íå èçìåíÿòü ðàçìåð); 300 - íîâàÿ âûñîòà áóôåðà.</p>
|
|
|
|
<h4>buf2d_line</h4>
|
|
<p>Ðèñóåò â áóôåðå ëèíèþ ñ çàäàííûì öâåòîì è êîîðäèíàòàìè. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_line], buf_0, 30,10, 110,70, 0xffff00 ;ðèñóåì ëèíèþ</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ ëèíèÿ; 30, 10, 110, 70 - êîîðäèíàòû ëèíèè; 0xffff00 - öâåò ëèíèè.</p>
|
|
<p>Äëÿ ðèñîâàíèÿ ñãëàæåííîé ëèíèè èñïîëüçóéòå <b>buf2d_line_sm</b>.</p>
|
|
|
|
<h4>buf2d_line_sm</h4>
|
|
<p>Ðèñóåò â áóôåðå ëèíèþ ïðèíèìàåò òàêèæå ïàðàìåòðû êàê è ôóíêöèÿ <b>buf2d_line</b>. Äàííàÿ ôóíêöèÿ ðèñóåò ñãëàæåííóþ ëèíèþ áîëåå êðàñèâóþ ÷åì <b>buf2d_line</b>, íî ðàáîòàåò ìåäëåííåå íå¸ çà ñ÷åò âû÷èñëåíèÿ ñìåøàííûõ öâåòîâ ôîíà è ñàìîé ëèíèè.</p>
|
|
|
|
<h4>buf2d_rect_by_size</h4>
|
|
<p>Ðèñóåò ïðÿìîóãîëüíóþ ðàìêó, ïî äâóì êîîðäèíàòàì, 2-ÿ êîîðäèíàòà çàäàíà ïî ðàçìåðó. Åñëè ðàçìåðû îòðèöàòåëüíûå ðàìêà ðèñóåòñÿ â îáðàòíîì íàïðàâëåíèè.</p>
|
|
<pre>stdcall [buf2d_rect_by_size], buf_0, 10,10,150,100, 0x8080</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ ïðÿìîóãîëüíèê; 10, 10 - êîîðäèíàòû ëåâîãî âåðõíåãî óãëà (ïðè îòðèöàòåëüíûõ ðàçìåðàõ êîîðäèíàòà ïðàâîãî íèæíåãî); 150, 100 - ðàçìåð ïðÿìîóãîëüíèêà; 0x8080 - öâåò ëèíèè.</p>
|
|
|
|
<h4>buf2d_filled_rect_by_size</h4>
|
|
<p>Ðèñóåò çàêðàøåííûé ïðÿìîóãîëüíèê, ïî äâóì êîîðäèíàòàì, 2-ÿ êîîðäèíàòà çàäàíà ïî ðàçìåðó. Åñëè ðàçìåð çàäàòü 1*1, òî áóäåò íàðèñîâàíà òî÷êà ðàçìåðîì â 1 ïèêñåëü, ò.å. ðàçìåð ïðÿìîóãîëüíèêà â ïèêñåëÿõ áóäåò ðàâåí óêàçàííîìó. Åñëè ðàçìåðû îòðèöàòåëüíûå ïðÿìîóãîëüíèê ðèñóåòñÿ â îáðàòíîì íàïðàâëåíèè.</p>
|
|
<pre>stdcall [buf2d_rect_by_size], buf_0, 10,10,150,100, 0x8080</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ ïðÿìîóãîëüíèê; 10, 10 - êîîðäèíàòû ëåâîãî âåðõíåãî óãëà (ïðè îòðèöàòåëüíûõ ðàçìåðàõ êîîðäèíàòà ïðàâîãî íèæíåãî); 150, 100 - ðàçìåð ïðÿìîóãîëüíèêà; 0x8080 - öâåò ïðÿìîóãîëèêà.</p>
|
|
|
|
<h4>buf2d_circle</h4>
|
|
<p>Ðèñóåò â áóôåðå îêðóæíîñòü ñ çàäàííûì öâåòîì è ðàäèóñîì. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_circle], buf_0, 25, 70, 15, 0xff0000</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ îêðóæíîñòü; 25, 70 - êîîðäèíàòû öåíòðà; 15 - ðàäèóñ; 0xff0000 - öâåò.</p>
|
|
|
|
<h4>buf2d_img_hdiv2</h4>
|
|
<p>Ñæèìàåò èçîáðàæåíèå â áóôåðå ïî âûñîòå â 2 ðàçà, ïðè ýòîì ðàçìåð ñàìîãî áóôåðà íå óìåíüøàåòñÿ.</p>
|
|
|
|
<h4>buf2d_img_wdiv2</h4>
|
|
<p>Ñæèìàåò èçîáðàæåíèå â áóôåðå ïî øèðèíå â 2 ðàçà, ïðè ýòîì ðàçìåð ñàìîãî áóôåðà íå óìåíüøàåòñÿ.</p>
|
|
|
|
<h4>buf2d_conv_24_to_8</h4>
|
|
<p>Ïðåîáðàçîâàíèå áóôåðà èç 24-áèòíîãî â 8-áèòíûé.
|
|
Ïðè ïðåîáðàçîâàíèè óêàçûâàåòñÿ êàêîé öâåò áåðàòü: 0-ñèíèé, 1-çåëåíûé, 2-êðàñíûé.
|
|
Îñòàëüíûå öâåòà ïðè ïðåîáðàçîâàíèè òåðÿþòñÿ.</p>
|
|
|
|
<h4>buf2d_conv_24_to_32</h4>
|
|
<p>Ïðåîáðàçîâàíèå áóôåðà èç 24-áèòíîãî â 32-áèòíûé.
|
|
Ïðè ïðåîáðàçîâàíèè óêàçûâàåòñÿ òàêæå 8-áèòíûé áóôåð, êîòîðûé áóäåò èñïîëüçîâàí äëÿ ñîçäàíèÿ àëüôà êàíàëà. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_conv_24_to_32],buf_a,buf_b ;äåëàåì áóôåð rgba 32áèò</pre>
|
|
<p>Äî âûïîëíåíèÿ ôóíêöèè áóôåð buf_a äîëæåí áûòü 24 áèòíûì, à áóôåð buf_b - 8 áèòíûì.
|
|
Ïîñëå âûïîëíåíèÿ ôóíêöèè áóôåð buf_a ñòàíåò 32 áèòíûì, áóôåð buf_b íå èçìåíèòñÿ.</p>
|
|
|
|
<h4>buf2d_bit_blt</h4>
|
|
<p>Ðèñóåò â áóôåðå èçîáðàæåíèå èç äðóãîãî áóôåðà â óêàçàííûõ êîîðäèíàòàõ. Áóôåð â êîòîðîì ðèñóò (ïðèåìíèê) äîëæåí áûòü 24 áèòíûì, à òîò êîòîðûé ðèñóåòñÿ (èñòî÷íèê) 24 èëè 32 áèòíûì. Åñëè áóôåð èñòî÷íèê 32 áèòíûé, òî åãî ïðîçðà÷íîñòü ïðè ðèñîâàíèè íå ó÷èòûâàåòñÿ, äëÿ ó÷åòà ïðîçðà÷íîñòè èñïîëüçóåòñÿ ôóíêöèÿ <i>buf2d_bit_blt_transp</i>. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_bit_blt], buf_0, 50,30, buf_1 ;ïðîðèñîâêà ñðåäíåãî ñêèíà</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ èçîáðàæåíèå (ïðèåìíèê);
|
|
buf_1 - ñòðóêòóðà áóôåðà ñ ðèñóåìûì èçîáðàæåíèåì (èñòî÷íèê);
|
|
50,30 - êîîðäèíàòû äëÿ âûâîäà èçîáðàæåíèÿ, îïðåäåëÿþò ïîëîæåíèå ðèñóåìîé êàðòèíêè â buf_0.</p>
|
|
|
|
<h4>buf2d_bit_blt_transp</h4>
|
|
<p>Ðèñóåò â áóôåðå èçîáðàæåíèå èç äðóãîãî áóôåðà â óêàçàííûõ êîîðäèíàòàõ, ïðè ýòîì ó÷èòûâàåòñÿ ïðîçðà÷íîñòü.
|
|
Áóôåð êîòîðûé áóäåò íàðèñîâàí äîëæåí áûòü 32 áèòíûì, à òîò â êîòîðîì ðèñóþò 24 áèòíûì.</p>
|
|
|
|
<h4>buf2d_bit_blt_alpha</h4>
|
|
<p>Ðèñóåò â áóôåðå èçîáðàæåíèå èç äðóãîãî áóôåðà â óêàçàííûõ êîîðäèíàòàõ, ïðè ýòîì ó÷èòûâàåòñÿ ïðîçðà÷íîñòü.
|
|
Áóôåð êîòîðûé áóäåò íàðèñîâàí äîëæåí áûòü 8 áèòíûì, à òîò â êîòîðîì ðèñóþò 24 áèòíûì.</p>
|
|
|
|
<h4>buf2d_curve_bezier</h4>
|
|
<p>Ðèñóåò ïî òðåì òî÷êàì îòðåçîê êðèâîé áåçüå.</p>
|
|
<pre>stdcall [buf2d_curve_bezier], buf_0, (10 shl 16)+20,(110 shl 16)+10,(50 shl 16)+90, dword 0xff</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ êðèâàÿ;
|
|
(10 shl 16)+20,(110 shl 16)+10,(50 shl 16)+90 - êîîðäèíàòû òî÷åê (10,20), (110,10), (50,90);
|
|
0xff - öâåò ïðÿìîé.</p>
|
|
|
|
<h4>buf2d_convert_text_matrix</h4>
|
|
<p>Ïðåîáðàçóåò ìàòðèöó ñ òåêñòîì ðàçìåðîì 16*16 â ðàçìåð 1*256. Íåîáõîäèìî äëÿ ñîçäàíèÿ ìàòðèöû äëÿ ðèñîâàíèÿ òåêñòà. Ïåðåä èñïîëüçîâàíèåì äàííîé ôóíêöèè ïðåäïîëàãàåòñÿ ÷òî åñòü èçîáðàæåíèå ñ ïîëíûì íàáîðîì ñèìâîëîâ ðàçìåðîì 16 ñòîëáöîâ íà 16 ñòðîê, èç êîòîðîãî ïðåäâàðèòåëüíî áûë ñîçäàí 8 áèòíûé áóôåð.</p>
|
|
<pre>stdcall [buf2d_create_f_img], buf_1,[image_data] ;ñîçäàåì áóôåð 24 áèò íà îñíîâå äàííûõ èçîáðàæåíèÿ
|
|
stdcall [buf2d_conv_24_to_8], buf_1,1 ;äåëàåì áóôåð ïðîçðà÷íîñòè 8 áèò
|
|
stdcall [buf2d_convert_text_matrix], buf_1</pre>
|
|
<p>ãäå buf_1 - ñòðóêòóðà áóôåðà äëÿ ôîðìèðîâàíèÿ òåêñòîâîé ìàòðèöû;
|
|
image_data - äàííûå èçîáðàæåíèÿ òåêñòîâîé ìàòðèöû â ôîðìàòå rgb, ðàçìåðîì 16*16 ñèìâîëîâ.</p>
|
|
|
|
<h4>buf2d_draw_text</h4>
|
|
<p>Ðèñóåò òåêñò â áóôåðå, èñïîëüçóÿ ìàòðèöó ñ òåêñòîì ðàçìåðîì 1*256 ñèìâîëîâ. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_draw_text], buf_0, buf_1,some_text,20,10,0x4040ff ;ðèñóåì ñòðîêó ñ òåêñòîì</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà â êîòîðîì áóäåò ðèñîâàòüñÿ òåêñò;</p>
|
|
<p>buf_1 - ñòðóêòóðà áóôåðà ñ òåêñòîâîé ìàòðèöåé â ôîðìàòå 8 áèò, ðàçìåðîì 1*256 ñèìâîëîâ;</p>
|
|
<p>some_text - òåêñò, êîòîðûé áóäåò âûâåäåí â áóôåð buf_0.</p>
|
|
|
|
<h4><a name="f_c_color">buf2d_crop_color</a></h4>
|
|
<p>Îáðåçàíèå áóôåðà, ïî óêàçàííîìó öâåòó. Ôóíêöèÿ èñïîëüçóåòñÿ äëÿ óìåíüøåíèÿ ïàìÿòè, çàíèìàåìîé áóôåðîì. Îòðåçàþòñÿ êðàéíèå ÷àñòè áóôåðà èìåþùèå îäèíàêîâûé öâåò. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_crop_color], buf_0,0xffffff,BUF2D_OPT_CROP_TOP+BUF2D_OPT_CROP_BOTTOM</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà êîòîðûé áóäåò îáðåçàí;</p>
|
|
<p>0xffffff - öâåò ïî êîòîðîìó áóäåò îáðåçàòüñÿ áóôåð;</p>
|
|
<p>BUF2D_OPT_CROP_TOP è BUF2D_OPT_CROP_BOTTOM - êîíñòàíòû, óêàçûâàþùèå ñ êàêèõ ñòîðîí îáðåçàòü áóôåð.</p>
|
|
|
|
<h4>buf2d_offset_h</h4>
|
|
<p>Ñäâèã èçîáðàæåíèÿ â áóôåðå ïî âûñîòå ââåðõ èëè âíèç.</p>
|
|
|
|
<h4>buf2d_flood_fill</h4>
|
|
<p>Ôóíêöèÿ äëÿ ðåêóðñèâíîé çàëèâêè âûáðàííûì öâåòîì. Èìååòñÿ äâà âàðèàíòà çàëèâêè. Ïðèìåð:</p>
|
|
<pre>stdcall [buf2d_flood_fill], buf_0, 100,200, 0, 0xff,0xff0000</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà;</p>
|
|
<p>100,200 - êîîðäèíàòû òî÷êè, ñ êîòîðîé íà÷íåòñÿ çàëèâêà;</p>
|
|
<p>0 - ïàðàìåòð, îïðåäåëÿåò àëãîðèòì çàëèâêè (ìîæåò áûòü 0 èëè 1);</p>
|
|
<p>0xff - öâåò çàëèâêè;</p>
|
|
<p>0xff0000 - çàâèñèò îò çíà÷åíèÿ 4-ãî ïàðàìåòðà, 1) åñëè 0 - öâåò äî êîòîðîãî áóäåò çàëèâàòüñÿ îáëàñòü; 2) åñëè 1 - öâåò îáëàñòè êîòîðàÿ áóäåò çàëèâàòñÿ;</p>
|
|
|
|
<h4>buf2d_set_pixel</h4>
|
|
<p>Ôóíêöèÿ ñòàâèò òî÷êó, ïðèíèìàåò êîîðäèíàòû è öâåò.</p>
|
|
<pre>stdcall [buf2d_set_pixel], buf_0, 100,150, 0xff0000</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà;</p>
|
|
<p>100,150 - êîîðäèíàòû òî÷êè;</p>
|
|
<p>0xff0000 - öâåò òî÷êè.</p>
|
|
|
|
<h4>buf2d_get_pixel</h4>
|
|
<p>Ôóíêöèÿ çàïèñûâàåò öâåò òî÷êè â ðåãèñòð eax, ïðèíèìàåò êîîðäèíàòû.</p>
|
|
<pre>stdcall [buf2d_get_pixel], buf_0, 100,150</pre>
|
|
<p>ãäå buf_0 - ñòðóêòóðà áóôåðà;</p>
|
|
<p>100,150 - êîîðäèíàòû òî÷êè;</p>
|
|
<p>eax - öâåò òî÷êè (äëÿ 8 è 24 áèòíûõ áóôåðîâ íå èñïîëüçóåìûå ñòàðøèå áèòû â eax ðàâíû 0) èëè çíà÷åíèå -1 â ñëó÷àå îøèáêè.</p>
|
|
|
|
<h4><a name="f_v_brush_c">buf2d_vox_brush_create</a></h4>
|
|
<p>Ñîçäàíèå âîêñåëüíîé êèñòè.</p>
|
|
|
|
<h4>buf2d_vox_brush_delete</h4>
|
|
<p>Óäàëåíèå âîêñåëüíîé êèñòè.</p>
|
|
|
|
<h4>buf2d_vox_obj_draw_1g</h4>
|
|
<p>Ðèñîâàíèå âîêñåëüíîãî îáúåêòà ñ 1-é ãðàíüþ.</p>
|
|
|
|
<h4>buf2d_vox_obj_get_img_w_3g</h4>
|
|
<p>Âîçâðàøàåò øèðèíó âîêñåëüíîãî èçîáðàæåíèÿ ñ 3-ìÿ ãðàíÿìè (êîòîðîå ðèñóåòñÿ ôóíêöèåé <b>buf2d_vox_obj_draw_3g</b>), ïðèíèìàåò óêàçàòåëü íà êèñòü è ìàñøòàá.</p>
|
|
|
|
<h4>buf2d_vox_obj_get_img_h_3g</h4>
|
|
<p>Âîçâðàøàåò âûñîòó âîêñåëüíîãî èçîáðàæåíèÿ ñ 3-ìÿ ãðàíÿìè (êîòîðîå ðèñóåòñÿ ôóíêöèåé <b>buf2d_vox_obj_draw_3g</b>), ïðèíèìàåò óêàçàòåëü íà êèñòü è ìàñøòàá.</p>
|
|
|
|
<h4>buf2d_vox_obj_draw_3g</h4>
|
|
<p>Ðèñîâàíèå âîêñåëüíîãî îáúåêòà ñ 3-ìÿ ãðàíÿìè.</p>
|
|
|
|
<h4>buf2d_vox_obj_draw_3g_scaled</h4>
|
|
<p>Ðèñîâàíèå ÷àñòè âîêñåëüíîãî îáúåêòà.</p>
|
|
|
|
<h4>buf2d_vox_obj_draw_3g_shadows</h4>
|
|
<p>Ôóíêöèÿ ðèñóþùàÿ òåíè äëÿ èçîáðàæåíèé íàðèñîâàííûõ ñ ïîìîùüþ ôóíêöèè <b>buf2d_vox_obj_draw_3g</b> èëè <b>buf2d_vox_obj_draw_3g_scaled</b>.</p>
|
|
|
|
<h4>buf2d_vox_obj_draw_pl</h4>
|
|
<p>Ôóíêöèÿ ðèñóþùàÿ ñðåç âîêñåëüíîãî îáüåêòà.</p>
|
|
|
|
<h4>buf2d_vox_obj_draw_pl_scaled</h4>
|
|
<p>Ôóíêöèÿ ðèñóþùàÿ ñðåç ÷àñòè âîêñåëüíîãî îáüåêòà.</p>
|
|
|
|
<h1><a name="const">Êîíñòàíòû</a></h1>
|
|
<h4>BUF2D_OPT_CROP_TOP equ 1</h4>
|
|
<p>Êîíñòàíòà äëÿ ôóíêöèè <a href="#f_c_color">buf2d_crop_color</a>, îáîçíà÷àåò îáðåçêó áóôåðà ñâåðõó</p>
|
|
<h4>BUF2D_OPT_CROP_LEFT equ 2</h4>
|
|
<p>Êîíñòàíòà äëÿ ôóíêöèè <a href="#f_c_color">buf2d_crop_color</a>, îáîçíà÷àåò îáðåçêó áóôåðà ñëåâà</p>
|
|
<h4>BUF2D_OPT_CROP_BOTTOM equ 4</h4>
|
|
<p>Êîíñòàíòà äëÿ ôóíêöèè <a href="#f_c_color">buf2d_crop_color</a>, îáîçíà÷àåò îáðåçêó áóôåðà ñíèçó</p>
|
|
<h4>BUF2D_OPT_CROP_RIGHT equ 8</h4>
|
|
<p>Êîíñòàíòà äëÿ ôóíêöèè <a href="#f_c_color">buf2d_crop_color</a>, îáîçíà÷àåò îáðåçêó áóôåðà ñïðàâà</p>
|
|
|
|
<h1><a name="tabl_e">Òàáëèöà ýêñïîðòà</a></h1>
|
|
<p>Ïðèìåð òàáëèöû ýêñïîðòà, ðàñ÷èòàííîé íà èñïîëüçîâàíèå ìàêðîñà <b>@use_library_mem</b>:</p>
|
|
<pre>align 4
|
|
import_buf2d_lib:
|
|
dd sz_lib_init
|
|
buf2d_create dd sz_buf2d_create
|
|
buf2d_create_f_img dd sz_buf2d_create_f_img
|
|
buf2d_clear dd sz_buf2d_clear
|
|
buf2d_draw dd sz_buf2d_draw
|
|
buf2d_delete dd sz_buf2d_delete
|
|
buf2d_resize dd sz_buf2d_resize
|
|
buf2d_line dd sz_buf2d_line
|
|
buf2d_line_sm dd sz_buf2d_line_sm
|
|
buf2d_rect_by_size dd sz_buf2d_rect_by_size
|
|
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
|
|
buf2d_circle dd sz_buf2d_circle
|
|
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
|
|
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
|
|
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
|
|
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
|
|
buf2d_bit_blt dd sz_buf2d_bit_blt
|
|
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
|
|
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
|
|
buf2d_curve_bezier dd sz_buf2d_curve_bezier
|
|
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
|
|
buf2d_draw_text dd sz_buf2d_draw_text
|
|
buf2d_crop_color dd sz_buf2d_crop_color
|
|
buf2d_offset_h dd sz_buf2d_offset_h
|
|
buf2d_flood_fill dd sz_buf2d_flood_fill
|
|
buf2d_set_pixel dd sz_buf2d_set_pixel
|
|
buf2d_get_pixel dd sz_buf2d_get_pixel
|
|
|
|
;âîêñåëüíûå ôóíêöèè:
|
|
buf2d_vox_brush_create dd sz_buf2d_vox_brush_create
|
|
buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete
|
|
buf2d_vox_obj_draw_1g dd sz_buf2d_vox_obj_draw_1g
|
|
buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g
|
|
buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g
|
|
buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g
|
|
buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled
|
|
buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows
|
|
buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl
|
|
buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled
|
|
|
|
dd 0,0
|
|
sz_lib_init db 'lib_init',0
|
|
sz_buf2d_create db 'buf2d_create',0
|
|
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
|
|
sz_buf2d_clear db 'buf2d_clear',0
|
|
sz_buf2d_draw db 'buf2d_draw',0
|
|
sz_buf2d_delete db 'buf2d_delete',0
|
|
sz_buf2d_resize db 'buf2d_resize',0
|
|
sz_buf2d_line db 'buf2d_line',0
|
|
sz_buf2d_line_sm db 'buf2d_line_sm',0
|
|
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
|
|
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
|
|
sz_buf2d_circle db 'buf2d_circle',0
|
|
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
|
|
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
|
|
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
|
|
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
|
|
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
|
|
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
|
|
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
|
|
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
|
|
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
|
|
sz_buf2d_draw_text db 'buf2d_draw_text',0
|
|
sz_buf2d_crop_color db 'buf2d_crop_color',0
|
|
sz_buf2d_offset_h db 'buf2d_offset_h',0
|
|
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
|
|
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
|
|
sz_buf2d_get_pixel db 'buf2d_get_pixel',0
|
|
|
|
;âîêñåëüíûå ôóíêöèè:
|
|
sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0
|
|
sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0
|
|
sz_buf2d_vox_obj_draw_1g db 'buf2d_vox_obj_draw_1g',0
|
|
sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0
|
|
sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0
|
|
sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0
|
|
sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0
|
|
sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0
|
|
sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0
|
|
sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0</pre>
|
|
|
|
<h1><a name="hist">Èñòîðèÿ</a></h1>
|
|
<p>02.07.10 - ñàìàÿ ïåðâàÿ âåðñèÿ áèáëèîòåêè, 2 ïðèìåðà èñïîëüçîâàíèÿ.</p>
|
|
<p>06.07.10 - ðàñøèðåíû âîçìîæíîñòè ôóíêöèè buf2d_bit_blt, òåïåðü îíà ìîæåò ðèñîâàòü 32 áèòíûå áóôåðû. Äîáàâëåíû 2 íîâûå ôóíêöèè: buf2d_bit_blt_alpha è buf2d_cruve_bezier. Íåáîëüøèå èçìåíåíèÿ â ôóíêöèè buf2d_line.</p>
|
|
<p>16.07.10 - èñïðàâëåíî ïî 2 îøèáêè â ôóíêöèÿõ buf2d_img_hdiv2 è buf2d_img_wdiv2, êîòîðûå ìîãëè ïðîÿâëÿòüñÿ ïðè îïðåäåëåííûõ óñëîâèÿõ (åñëè ðàçìåð èçîáðàæåíèÿ áûë êðàòåí 4Êá è äð.). Äîáàâëåíû 2 ôóíêöèè äëÿ âûâîäà òåêñòà â áóôåð buf2d_convert_text_matrix è buf2d_draw_text.</p>
|
|
<p>19.07.10 - äîáàâëåíà ôóíêöèÿ ðèñîâàíèÿ îêðóæíîñòè buf2d_circle;
|
|
èçìåíåí ôîðìàò áóôåðà - äëÿ øèðèíû è âûñîòû èñïîëüçóþòñÿ 4-õ áàéòíûå ÷èñëà âìåñòî 2-õ áàéòíûõ.</p>
|
|
<p>29.07.10 - äîáàâëåíû ôóíêöèè buf2d_crop_color è buf2d_offset_h;
|
|
èñïðàâëåíèÿ â ôóíêöèè buf2d_delete.</p>
|
|
<p>30.09.10 - äîáàâëåíà ôóíêöèÿ buf2d_rect_by_size.</p>
|
|
<p>04.10.10 - äîáàâëåíà ôóíêöèÿ buf2d_filled_rect_by_size, äîðàáîòàíà ôóíêöèÿ buf_bit_blt_alpha.</p>
|
|
<p>07.10.10 - äîðàáîòàíà ôóíêöèÿ buf_bit_blt (ïðè ïîïûòêå íàðèñîâàòü èçîáðàæåíèå çà ïðåäåëàìè ïðàâîãî êðàÿ áóôåðà ïðèëîæåíèå âûçâàâøåå ôóíêöèþ ïàäàëî).</p>
|
|
<p>11.10.10 - èñïðàâëåíî çàäàíèå öâåòîâ â íåêîòîðûõ ôóíêöèÿõ, êðàñíûé è ñèíèé öâåòà ïîìåíÿë ìåñòàìè. Òåïåðü öâåòà ñîâïàäàþò ñ ñèñåìíûìè ôóíêöèÿìè.</p>
|
|
<p>02.11.10 - äîáàâëåíà ôóíêöèÿ buf2d_flood_fill.</p>
|
|
<p>22.12.10 - èçìåíåíî èìÿ ôóíêöèè buf2d_cruve_bezier íà buf2d_curve_bezier.</p>
|
|
<p>25.03.11 - äîáàâëåíà ôóíêöèÿ äëÿ ðèñîâàíèÿ òî÷êè buf2d_set_pixel.</p>
|
|
<p>30.08.11 - äîáàâëåíà ôóíêöèÿ èçìåíåíèÿ ðàçìåðîâ áóôåðà buf2d_resize.</p>
|
|
<p>13.09.11 - îïòèìèçèðîâàíà ðàáîòà ôóíêöèé buf2d_filled_rect_by_size buf2d_rect_by_size, äîáàâëåíû ïðèìåðû èñïîëüçîâàíèÿ áèáëèîòåêè.</p>
|
|
<p>22.09.11 - äîáàâëåíà ôóíêöèÿ buf2d_line_sm äëÿ ðèñîâàíèÿ ñãëàæåííîé ëèíèè.</p>
|
|
<p>20.02.12 - ôóíêöèè buf2d_filled_rect_by_size è buf2d_rect_by_size ìîãóò ïðèíèìàòü îòðèöàòåëüíûå ðàçìåðû äëÿ ïðÿìîóãîëüíèêîâ, â ôóíêöèè buf2d_line ãîðèçîíòàëüíàÿ ëèíèÿ ðèñóåòñÿ íà 1 ïèêñåëü äëèíåå (ðàíüøå íå äîðèñîâûâàëî), íåêîòîðûå ôóíêöèè ìîãóò ðèñîâàòü â 8 áèòíûõ áóôåðàõ.</p>
|
|
<p>23.02.12 - ôóíêöèÿ buf2d_bit_blt_alpha ìîæåò ïðèíèìàòü îòðèöàòåëüíûå êîîðäèíàòû â ïîçèöèè êîïèðóåìîãî áóôåðà, íåáîëüøèå äîðàáîòêè â buf2d_bit_blt_transp</p>
|
|
<p>11.05.12 - äîáàâëåíà ôóíêöèÿ äëÿ âçÿòèÿ öâåòà òî÷êè buf2d_get_pixel, äîðàáîòêè â buf2d_set_pixel.</p>
|
|
<p>12.06.12 - äîáàâëåíû ôóíêöèè äëÿ ðèñîâàíèÿ âîêñåëüíîé ãðàôèêè.</p>
|
|
</body>
|
|
</html> |