⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fg__x11drawinterface_8cpp-source.html

📁 《道法自然》书的源码FishGUI,一个跨平台的界面库
💻 HTML
📖 第 1 页 / 共 2 页
字号:
00117         <span class="comment">// 把缓冲区内容刷新到屏幕上</span>00118         XSetFillStyle(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p4">m_CopyGC</a>, FillTiled);00119             XSetTile(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p4">m_CopyGC</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>);00120         XFillRectangle(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p0">m_Win</a>, <a class="code" href="classFG__X11DrawInterface.html#p4">m_CopyGC</a>, m_Invalid.<a class="code" href="structFG__Rect.html#o0">wLeft</a>, m_Invalid.<a class="code" href="structFG__Rect.html#o1">wTop</a>, m_Invalid.<a class="code" href="structFG__Rect.html#a20">Width</a>(), m_Invalid.<a class="code" href="structFG__Rect.html#a21">Height</a>());00121     }00122 }00123 00124 <span class="comment">//##ModelId=3F6EB001009A</span><a name="l00125"></a><a class="code" href="classFG__X11DrawInterface.html#a4">00125</a> <span class="keywordtype">void</span> <a class="code" href="classFG__X11DrawInterface.html#a4">FG_X11DrawInterface::FillRect</a>(<span class="keyword">const</span> <a class="code" href="structFG__Rect.html">FG_Rect</a> &amp; rect, <span class="keyword">const</span> <a class="code" href="group__Color.html#ga0">COLORVAL</a> ForeColor, <span class="keyword">const</span> <a class="code" href="group__Color.html#ga0">COLORVAL</a> background)00126 {00127         XSetForeground(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, background);00128         XFillRectangle(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, rect.<a class="code" href="structFG__Rect.html#o0">wLeft</a>, rect.<a class="code" href="structFG__Rect.html#o1">wTop</a>, rect.<a class="code" href="structFG__Rect.html#a20">Width</a>(), rect.<a class="code" href="structFG__Rect.html#a21">Height</a>());00129         <span class="keywordflow">if</span> (ForeColor != background)00130         {00131         XSetForeground(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, ForeColor);00132             XDrawRectangle(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, rect.<a class="code" href="structFG__Rect.html#o0">wLeft</a>, rect.<a class="code" href="structFG__Rect.html#o1">wTop</a>, rect.<a class="code" href="structFG__Rect.html#a20">Width</a>(), rect.<a class="code" href="structFG__Rect.html#a21">Height</a>());00133         }00134 }00135 00136 <span class="comment">//##ModelId=3F6EB00100A4</span><a name="l00137"></a><a class="code" href="classFG__X11DrawInterface.html#a5">00137</a> <span class="keywordtype">void</span> <a class="code" href="classFG__X11DrawInterface.html#a5">FG_X11DrawInterface::Line</a>(<span class="keyword">const</span> <span class="keywordtype">short</span> x1, <span class="keyword">const</span> <span class="keywordtype">short</span> y1, <span class="keyword">const</span> <span class="keywordtype">short</span> x2, <span class="keyword">const</span> <span class="keywordtype">short</span> y2, <span class="keyword">const</span> <a class="code" href="group__Color.html#ga0">COLORVAL</a> color)00138 {00139         XSetForeground(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, color);00140         XDrawLine(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, x1, y1, x2, y2);00141 }00142 00143 <span class="comment">//##ModelId=3F6EB00100B1</span><a name="l00144"></a><a class="code" href="classFG__X11DrawInterface.html#a6">00144</a> <span class="keywordtype">void</span> <a class="code" href="classFG__X11DrawInterface.html#a6">FG_X11DrawInterface::DrawText</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * Text, <span class="keyword">const</span> <span class="keywordtype">short</span> x, <span class="keyword">const</span> <span class="keywordtype">short</span> y, <span class="keyword">const</span> <a class="code" href="group__Color.html#ga0">COLORVAL</a> color)00145 {00146         XSetForeground(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, color);00147         <span class="keywordtype">short</span> my = y + <a class="code" href="classFG__X11DrawInterface.html#a8">GetTextHeight</a>(Text);00148     XmbDrawString(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, <a class="code" href="classFG__X11DrawInterface.html#p7">m_FontSet</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, x, my, Text, strlen(Text));00149 }00150 00151 <span class="comment">//##ModelId=3F6EB00100C3</span><a name="l00152"></a><a class="code" href="classFG__X11DrawInterface.html#a7">00152</a> <a class="code" href="group__Utility.html#ga1">WORD</a> <a class="code" href="classFG__X11DrawInterface.html#a7">FG_X11DrawInterface::GetTextWidth</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * Text)00153 {00154     XRectangle ink, logical;00155     XmbTextExtents(<a class="code" href="classFG__X11DrawInterface.html#p7">m_FontSet</a>, Text, strlen(Text), &amp; ink, &amp; logical);00156 00157     <span class="keywordflow">return</span> logical.width;00158 }00159 00160 <span class="comment">//##ModelId=3F6EB00100CC</span><a name="l00161"></a><a class="code" href="classFG__X11DrawInterface.html#a8">00161</a> <a class="code" href="group__Utility.html#ga1">WORD</a> <a class="code" href="classFG__X11DrawInterface.html#a8">FG_X11DrawInterface::GetTextHeight</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * Text)00162 {00163     XRectangle ink, logical;00164     XmbTextExtents(<a class="code" href="classFG__X11DrawInterface.html#p7">m_FontSet</a>, Text, strlen(Text), &amp; ink, &amp; logical);00165 00166     <span class="keywordflow">return</span> logical.height;00167 }00168 00169 <span class="comment">//##ModelId=3F6EB00100CE</span><a name="l00170"></a><a class="code" href="classFG__X11DrawInterface.html#a9">00170</a> <span class="keywordtype">void</span> <a class="code" href="classFG__X11DrawInterface.html#a9">FG_X11DrawInterface::DrawBitmap</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * pBmpName, <span class="keyword">const</span> <span class="keywordtype">short</span> x1, <span class="keyword">const</span> <span class="keywordtype">short</span> y1)00171 {00172         <span class="keywordtype">int</span> status;00173         XpmAttributes attributes;00174 00175         attributes.valuemask = XpmColormap | XpmCloseness;00176         attributes.colormap = <a class="code" href="classFG__X11DrawInterface.html#p6">m_CMap</a>;00177         attributes.closeness = 65535;00178         00179   Pixmap pix, mask;00180     <span class="comment">// 读取xpm文件</span>00181     <span class="keywordflow">if</span> (XpmReadFileToPixmap(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, (<span class="keywordtype">char</span> *)pBmpName, &amp; pix, &amp; mask, &amp; attributes) == XpmSuccess)00182     {00183         <span class="keywordtype">int</span> width = attributes.width;00184             <span class="keywordtype">int</span> height = attributes.height;00185             GC gc = XCreateGC(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, 0, <a class="code" href="group__Utility.html#ga11">NULL</a>);00186             XSetFillStyle(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, gc, FillTiled);00187             XSetTile(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, gc, pix);00188             00189             XGCValues xgcv;00190             xgcv.ts_y_origin = y1;00191             xgcv.ts_x_origin = x1;00192             xgcv.clip_y_origin = y1;00193             xgcv.clip_x_origin = x1;00194             XChangeGC(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, gc, GCClipXOrigin | GCClipYOrigin | GCTileStipXOrigin | GCTileStipYOrigin, &amp; xgcv);00195             XFillRectangle(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, gc, x1, y1, width, height);00196             00197             XFreePixmap(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, pix);00198             XFreeGC(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, gc);00199     }00200 }00201 00202 <span class="comment">//##ModelId=3F6EB00100D8</span><a name="l00203"></a><a class="code" href="classFG__X11DrawInterface.html#a10">00203</a> <span class="keywordtype">void</span> <a class="code" href="classFG__X11DrawInterface.html#a10">FG_X11DrawInterface::DrawPolyLine</a>(<span class="keyword">const</span> <span class="keywordtype">short</span> n, <span class="keyword">const</span> <a class="code" href="structFG__Point.html">FG_Point</a> * vert, <span class="keyword">const</span> <a class="code" href="group__Color.html#ga0">COLORVAL</a> color)00204 {00205         <span class="keywordflow">if</span> (n &gt; 1)00206         {00207         XSetForeground(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, color);00208         <span class="keywordflow">for</span> (<span class="keywordtype">short</span> i = 0; i &lt; n - 1; i ++)00209             XDrawLine(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, vert[i].x, vert[i].y, vert[i + 1].x, vert[i + 1].y);00210     }00211 }00212 00213 <span class="comment">//##ModelId=3F6EB00100E3</span><a name="l00214"></a><a class="code" href="classFG__X11DrawInterface.html#a11">00214</a> <span class="keywordtype">void</span> <a class="code" href="classFG__X11DrawInterface.html#a11">FG_X11DrawInterface::DrawDotRect</a>(<span class="keyword">const</span> <a class="code" href="structFG__Rect.html">FG_Rect</a> &amp; rect, <span class="keyword">const</span> <a class="code" href="group__Color.html#ga0">COLORVAL</a> color)00215 {00216     XSetForeground(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, color);00217 00218     XGCValues xgcv;00219     xgcv.line_style = LineOnOffDash;00220     XChangeGC(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, GCLineStyle, &amp; xgcv);00221 00222     XDrawRectangle(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p5">m_Buffer</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, rect.<a class="code" href="structFG__Rect.html#o0">wLeft</a>, rect.<a class="code" href="structFG__Rect.html#o1">wTop</a>, rect.<a class="code" href="structFG__Rect.html#a20">Width</a>(), rect.<a class="code" href="structFG__Rect.html#a21">Height</a>());00223 00224     xgcv.line_style = LineSolid;00225     XChangeGC(<a class="code" href="classFG__X11DrawInterface.html#p1">m_Display</a>, <a class="code" href="classFG__X11DrawInterface.html#p3">m_GC</a>, GCLineStyle, &amp; xgcv);00226 }00227 </pre></div><hr><center>由 DoxyGen 1.3.6 于 Wed Jun 9 22:34:41 2004 生成<br>版权所有 (C) 2003,2004 王咏武</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -