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

📄 group__dc__fns.htm

📁 MINIGUI1.6开发API
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>MiniGUI V1.6.10 API Reference: General DC operations</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.2 --><div class="qindex"><a class="qindex" href="index.htm">Main&nbsp;Page</a> | <a class="qindex" href="modules.htm">Modules</a> | <a class="qindex" href="classes.htm">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.htm">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.htm">Directories</a> | <a class="qindex" href="files.htm">File&nbsp;List</a> | <a class="qindex" href="functions.htm">Data&nbsp;Fields</a> | <a class="qindex" href="globals.htm">Globals</a> | <a class="qindex" href="pages.htm">Related&nbsp;Pages</a></div><h1>General DC operations<br><small>[<a class="el" href="group__gdi__fns.htm">GDI functions</a>]</small></h1><h2>Modules</h2><ul><li><a class="el" href="group__yuv__fns.htm">YUV overlay operations</a><li><a class="el" href="group__gamma__fns.htm">Gamma correction functions</a></ul><h2>Defines</h2><ul><li>#define <a class="el" href="group__dc__fns.htm#ga22">HDC_SCREEN</a>&nbsp;&nbsp;&nbsp;0<dl class="el"><dd class="mdescRight">Handle to the device context of the whole screen.  <a href="#ga22"></a><br></dl><li>#define <a class="el" href="group__dc__fns.htm#ga23">HDC_INVALID</a>&nbsp;&nbsp;&nbsp;0<dl class="el"><dd class="mdescRight">Indicates an invalid handle to device context.  <a href="#ga23"></a><br></dl><li>#define <a class="el" href="group__dc__fns.htm#ga41">CreateCompatibleDC</a>(hdc)&nbsp;&nbsp;&nbsp;CreateCompatibleDCEx(hdc, 0, 0);<dl class="el"><dd class="mdescRight">Creates a memory DC which is compatible with a given DC.  <a href="#ga41"></a><br></dl><li>#define <a class="el" href="group__dc__fns.htm#ga42">DeleteCompatibleDC</a>(hdc)&nbsp;&nbsp;&nbsp;DeleteMemDC(hdc)<dl class="el"><dd class="mdescRight">Deletes a memory DC.  <a href="#ga42"></a><br></dl></ul><h2>Functions</h2><ul><li>MG_EXPORT unsigned int GUIAPI <a class="el" href="group__dc__fns.htm#ga0">GetGDCapability</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc, int iItem)<dl class="el"><dd class="mdescRight">Returns a capability of a DC.  <a href="#ga0"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga1">GetDC</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hwnd)<dl class="el"><dd class="mdescRight">Gets a window DC of a window.  <a href="#ga1"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga2">GetClientDC</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hwnd)<dl class="el"><dd class="mdescRight">Gets a client DC of a window.  <a href="#ga2"></a><br></dl><li>MG_EXPORT void GUIAPI <a class="el" href="group__dc__fns.htm#ga3">ReleaseDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc)<dl class="el"><dd class="mdescRight">Releases a DC from DC pool.  <a href="#ga3"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga4">CreatePrivateDC</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hwnd)<dl class="el"><dd class="mdescRight">Creates a private window DC of a window.  <a href="#ga4"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga5">CreatePrivateClientDC</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hwnd)<dl class="el"><dd class="mdescRight">Creates a private client DC of a window.  <a href="#ga5"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga6">GetPrivateClientDC</a> (<a class="el" href="group__handles.htm#ga1">HWND</a> hwnd)<dl class="el"><dd class="mdescRight">Returns the private client DC of a window.  <a href="#ga6"></a><br></dl><li>MG_EXPORT void GUIAPI <a class="el" href="group__dc__fns.htm#ga7">DeletePrivateDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc)<dl class="el"><dd class="mdescRight">Deletes the DC returned by <em>CreatePrivateDC</em> or <em>CreatePrivateClientDC</em>.  <a href="#ga7"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga1">HWND</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga8">WindowFromDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc)<dl class="el"><dd class="mdescRight">Gets the handle to the window by a handle to the DC.  <a href="#ga8"></a><br></dl><li>MG_EXPORT int GUIAPI <a class="el" href="group__dc__fns.htm#ga9">SaveDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc)<dl class="el"><dd class="mdescRight">Saves the current state of a device context.  <a href="#ga9"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga10">RestoreDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc, int saved_dc)<dl class="el"><dd class="mdescRight">Restores a device context (DC) to the specified state.  <a href="#ga10"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga11">CreateCompatibleDCEx</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc, int width, int height)<dl class="el"><dd class="mdescRight">Creates a memory DC which is compatible with the specified reference DC.  <a href="#ga11"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga12">CreateMemDC</a> (int width, int height, int depth, <a class="el" href="group__win32__types.htm#ga4">DWORD</a> flags, <a class="el" href="group__basic__types.htm#ga4">Uint32</a> Rmask, <a class="el" href="group__basic__types.htm#ga4">Uint32</a> Gmask, <a class="el" href="group__basic__types.htm#ga4">Uint32</a> Bmask, <a class="el" href="group__basic__types.htm#ga4">Uint32</a> Amask)<dl class="el"><dd class="mdescRight">Creates a memory DC.  <a href="#ga12"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga13">CreateSubMemDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> parent, int off_x, int off_y, int width, int height, <a class="el" href="group__simple__types.htm#ga0">BOOL</a> comp_to_parent)<dl class="el"><dd class="mdescRight">Creates a sub memory DC in the given memory DC.  <a href="#ga13"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga14">CreateMemDCFromBitmap</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc, <a class="el" href="struct__BITMAP.htm">BITMAP</a> *bmp)<dl class="el"><dd class="mdescRight">Creates a memory DC from a reference DC and a BITMAP object.  <a href="#ga14"></a><br></dl><li>MG_EXPORT <a class="el" href="group__handles.htm#ga2">HDC</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga15">CreateMemDCFromMyBitmap</a> (const <a class="el" href="struct__MYBITMAP.htm">MYBITMAP</a> *my_bmp, <a class="el" href="struct__RGB.htm">RGB</a> *pal)<dl class="el"><dd class="mdescRight">Creates a memory DC from a device independent MYBITMAP object.  <a href="#ga15"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga16">ConvertMemDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> mem_dc, <a class="el" href="group__handles.htm#ga2">HDC</a> ref_dc, <a class="el" href="group__win32__types.htm#ga4">DWORD</a> flags)<dl class="el"><dd class="mdescRight">Converts a memory DC to have a same format as a reference DC.  <a href="#ga16"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga17">SetMemDCAlpha</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> mem_dc, <a class="el" href="group__win32__types.htm#ga4">DWORD</a> flags, <a class="el" href="group__basic__types.htm#ga0">Uint8</a> alpha)<dl class="el"><dd class="mdescRight">Sets the alpha value for the entire surface of a DC, as opposed to using the alpha component of each pixel.  <a href="#ga17"></a><br></dl><li>MG_EXPORT <a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI <a class="el" href="group__dc__fns.htm#ga18">SetMemDCColorKey</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> mem_dc, <a class="el" href="group__win32__types.htm#ga4">DWORD</a> flags, <a class="el" href="group__basic__types.htm#ga4">Uint32</a> color_key)<dl class="el"><dd class="mdescRight">Sets the color key (transparent pixel) of a memory DC.  <a href="#ga18"></a><br></dl><li>MG_EXPORT void GUIAPI <a class="el" href="group__dc__fns.htm#ga19">DeleteMemDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> mem_dc)<dl class="el"><dd class="mdescRight">Deletes a memory DC.  <a href="#ga19"></a><br></dl><li>MG_EXPORT <a class="el" href="group__basic__types.htm#ga0">Uint8</a> *GUIAPI <a class="el" href="group__dc__fns.htm#ga20">LockDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc, const <a class="el" href="struct__RECT.htm">RECT</a> *rw_rc, int *width, int *height, int *pitch)<dl class="el"><dd class="mdescRight">Locks a dc to get direct access to pixels in the DC.  <a href="#ga20"></a><br></dl><li>MG_EXPORT void GUIAPI <a class="el" href="group__dc__fns.htm#ga21">UnlockDC</a> (<a class="el" href="group__handles.htm#ga2">HDC</a> hdc)<dl class="el"><dd class="mdescRight">Unlocks a locked DC.  <a href="#ga21"></a><br></dl></ul><hr><a name="_details"></a><h2>Detailed Description</h2>DC means Device Context, just like Graphics Context (GC) of X Lib. DC represents a rectangle area on the actual screen or a virtual screen created in memory. We call the rectangle area as "surface" of the DC.<p>You can call a GDI function and pass a DC to the function to draw lines, circles, or text. Commonly, you should call a function like <em>GetClientDC</em> or <em>CreateCompatibleDC</em> to get or create a DC, then call GDI functions to draw objects, e.g. <em>MoveTo</em> and <em>LineTo</em>. After finishing drawing, you should call <em>ReleaseDC</em> or <em>DeleteMemDC</em> function to release or destroy the DC.<p>MiniGUI reserved an global DC called <em>HDC_SCREEN</em>. You can use this DC directly without getting/creating or releasing/destroying.<p>For main windows or controls, MiniGUI will send a MSG_PAINT message to the window when the whole or part of window area have been invalidated. You should call <em>BegainPaint</em> function to get the DC, then repaint the window, and call <em>EndPaint</em> function to release the DC at the last.<p>Example:<p><div class="fragment"><pre class="fragment"><span class="keywordflow">case</span> <a class="code" href="group__paint__msgs.htm#ga3">MSG_PAINT</a>:{        <a class="code" href="group__handles.htm#ga2">HDC</a> hdc;        hdc = <a class="code" href="group__window__general__fns.htm#ga30">BeginPaint</a> (hWnd);        <span class="comment">// Draw a line.</span>    <a class="code" href="group__draw__fns.htm#ga32">MoveTo</a> (hdc, 0, 0);    <a class="code" href="group__draw__fns.htm#ga33">LineTo</a> (hdc, 100, 100);        <a class="code" href="group__window__general__fns.htm#ga31">EndPaint</a> (hWnd, hdc);        <span class="keywordflow">break</span>;}</pre></div> <hr><h2>Define Documentation</h2><a class="anchor" name="ga41" doxytag="gdi.h::CreateCompatibleDC"></a><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">#define CreateCompatibleDC          </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">hdc&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap>&nbsp;&nbsp;&nbsp;CreateCompatibleDCEx(hdc, 0, 0);</td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Creates a memory DC which is compatible with a given DC. <p>This function creates a memory DC fully compatible with the reference DC <em>hdc</em>, including pixel format and geomatry.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>hdc</em>&nbsp;</td><td>The reference DC. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>The handle to the memory DC, HDC_INVALID indicates an error.</dd></dl><dl compact><dt><b>Note:</b></dt><dd>Only defined as macro calling <em>CreateCompatibleDCEx</em> for _USE_NEWGAL. If _USE_NEWGAL is not defined, <em>CreateCompatibleDC</em> is defined as a function, and have the same semantics as this macro.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__dc__fns.htm#ga11">CreateCompatibleDCEx</a>, <a class="el" href="group__dc__fns.htm#ga19">DeleteMemDC</a> </dd></dl><p>Definition at line <a class="el" href="gdi_8h-source.htm#l01623">1623</a> of file <a class="el" href="gdi_8h-source.htm">gdi.h</a>.    </td>  </tr></table><a class="anchor" name="ga42" doxytag="gdi.h::DeleteCompatibleDC"></a><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">#define DeleteCompatibleDC          </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">hdc&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap>&nbsp;&nbsp;&nbsp;DeleteMemDC(hdc)</td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Deletes a memory DC. <p>This function deletes a memory DC created by <em>CreateCompatibleDC</em>.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>hdc</em>&nbsp;</td><td>The device context to be deleted.</td></tr>  </table></dl><dl compact><dt><b>Note:</b></dt><dd>Only defined as macro calling <em>DeleteMemDC</em> for _USE_NEWGAL. If _USE_NEWGAL is not defined, <em>DeleteCompatibleDC</em> is defined as a function, and have the same semantics as this macro.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__dc__fns.htm#ga41">CreateCompatibleDC</a>, <a class="el" href="group__dc__fns.htm#ga19">DeleteMemDC</a> </dd></dl><p>Definition at line <a class="el" href="gdi_8h-source.htm#l01639">1639</a> of file <a class="el" href="gdi_8h-source.htm">gdi.h</a>.    </td>  </tr></table><a class="anchor" name="ga23" doxytag="gdi.h::HDC_INVALID"></a><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">#define HDC_INVALID&nbsp;&nbsp;&nbsp;0          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Indicates an invalid handle to device context. <p><p>Definition at line <a class="el" href="gdi_8h-source.htm#l01126">1126</a> of file <a class="el" href="gdi_8h-source.htm">gdi.h</a>.    </td>  </tr></table><a class="anchor" name="ga22" doxytag="gdi.h::HDC_SCREEN"></a><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">#define HDC_SCREEN&nbsp;&nbsp;&nbsp;0          </td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Handle to the device context of the whole screen. <p>This DC is a special one. MiniGUI uses it to draw popup menus and other global objects. You can also use this DC to draw lines or text on the screen directly, and there is no need to get or release it.<p>If you do not want to create any main window, but you want to draw on the screen, you can use this DC.<p><dl compact><dt><b>Note:</b></dt><dd>MiniGUI does not do any clipping operation for this DC, so use this DC may make a mess of other windows. </dd></dl><p>Definition at line <a class="el" href="gdi_8h-source.htm#l01120">1120</a> of file <a class="el" href="gdi_8h-source.htm">gdi.h</a>.    </td>  </tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="ga16" doxytag="gdi.h::ConvertMemDC"></a><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"><a class="el" href="group__simple__types.htm#ga0">BOOL</a> GUIAPI ConvertMemDC           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="group__handles.htm#ga2">HDC</a>&nbsp;</td>          <td class="mdname" nowrap> <em>mem_dc</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap><a class="el" href="group__handles.htm#ga2">HDC</a>&nbsp;</td>          <td class="mdname" nowrap> <em>ref_dc</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap><a class="el" href="group__win32__types.htm#ga4">DWORD</a>&nbsp;</td>          <td class="mdname" nowrap> <em>flags</em></td>        </tr>        <tr>          <td class="md"></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;

⌨️ 快捷键说明

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