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

📄 group__dc__fns.htm

📁 MINIGUI1.6开发API
💻 HTM
📖 第 1 页 / 共 5 页
字号:
    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Locks a dc to get direct access to pixels in the DC. <p>Calling this function will try to lock the DC <em>hdc</em> to directly access the pixels of the DC. You should tell this function the rectangle to be accessed, and the function will return the effective <em>width</em>, <em>height</em> and <em>pitch</em> of the DC. The access beyond effective width and height will be invalid.<p>Locking a DC which uses screen surface will lock some global objects, such as mouse cursor, and so on. All GDI calls of other threads (in MiniGUI-Threads) or other process (in MiniGUI-Processes) will be blocked as well. So you should call <em>UnlockDC</em> to unlock the DC as soon as possible, and should not call any system function in the duration of locking the DC.<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 handle to the device context. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>rw_rc</em>&nbsp;</td><td>The rectangle in device coordinate system to be accessed in the DC. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>width</em>&nbsp;</td><td>The width of the effective rectangle can access will be returned through this pointer. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>height</em>&nbsp;</td><td>The height of the effective rectangle can access will be returned through this pointer. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>pitch</em>&nbsp;</td><td>The pitch of the scan line of the DC will be returned through this pointer. Pitch means the length of the scan line in bytes. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>The bits pointer to the upper-left corner of the effective rectangle, NULL on error.</dd></dl><dl compact><dt><b>Note:</b></dt><dd>Only defined for _USE_NEWGAL.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__dc__fns.htm#ga21">UnlockDC</a></dd></dl>Example:<p><div class="fragment"><pre class="fragment">    <span class="comment">/*</span><span class="comment">     * lock the dc and draw the scan line with random color.</span><span class="comment">     */</span>    <span class="keywordtype">int</span> i, width, height, pitch;    <a class="code" href="struct__RECT.htm">RECT</a> rc = {0, 0, 200, 200};    <span class="keywordtype">int</span> bpp = <a class="code" href="group__dc__fns.htm#ga0">GetGDCapability</a> (hdc, GDCAP_BPP);    <a class="code" href="group__basic__types.htm#ga0">Uint8</a>* frame_buffer = <a class="code" href="group__dc__fns.htm#ga20">LockDC</a> (hdc, &amp;rc, &amp;width, &amp;height, &amp;pitch);    <a class="code" href="group__basic__types.htm#ga0">Uint8</a>* row = frame_buffer;    <span class="keywordflow">for</span> (i = 0; i &lt; *height; i++) {        memset (row, rand ()%0x100, *width * bpp);        row += *pitch;    }    <a class="code" href="group__dc__fns.htm#ga21">UnlockDC</a> (hdc);</pre></div>     </td>  </tr></table><a class="anchor" name="ga3" doxytag="gdi.h::ReleaseDC"></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">void GUIAPI ReleaseDC           </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="mdname1" valign="top" nowrap> <em>hdc</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Releases a DC from DC pool. <p>This function releases the DC returned by <em>GetDC</em> or <em>GetClientDC</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 handle to the DC.</td></tr>  </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__dc__fns.htm#ga1">GetDC</a>, <a class="el" href="group__dc__fns.htm#ga2">GetClientDC</a> </dd></dl>    </td>  </tr></table><a class="anchor" name="ga10" doxytag="gdi.h::RestoreDC"></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 RestoreDC           </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>hdc</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap> <em>saved_dc</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;    </td>    <td><p>Restores a device context (DC) to the specified state. <p>This function restores a device context (DC) to the specified state. The DC is restored by popping state information off a stack created by earlier calls to the <em>SaveDC</em> function.<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 handle to the DC. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>saved_dc</em>&nbsp;</td><td>Specifies the saved state to be restored. If this parameter is positive, saved_dc represents a specific instance of the state to be restored. If this parameter is negative, saved_dc represents an instance relative to the current state. For example, -1 restores the most recently saved state.</td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.</dd></dl><dl compact><dt><b>Note:</b></dt><dd>The stack can contain the state information for several instances of the DC. If the state specified by the specified parameter is not at the top of the stack, RestoreDC deletes all state information between the top of the stack and the specified instance.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__dc__fns.htm#ga9">SaveDC</a> </dd></dl>    </td>  </tr></table><a class="anchor" name="ga9" doxytag="gdi.h::SaveDC"></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">int GUIAPI SaveDC           </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="mdname1" valign="top" nowrap> <em>hdc</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Saves the current state of a device context. <p>This function saves the current state of the specified device context (DC) by copying data describing selected objects and graphic modes (such as pen, brush, palette, font, pen, region, drawing mode, and mapping mode) to a context stack.<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 handle to the DC whose state is to be saved.</td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>If the function succeeds, the return value identifies the saved state. If the function fails, the return value is zero.</dd></dl><dl compact><dt><b>Note:</b></dt><dd>This function can be used any number of times to save any number of instances of the DC state. A saved state can be restored by using the <em>RestoreDC</em> function.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__dc__fns.htm#ga10">RestoreDC</a> </dd></dl>    </td>  </tr></table><a class="anchor" name="ga17" doxytag="gdi.h::SetMemDCAlpha"></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 SetMemDCAlpha           </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__win32__types.htm#ga4">DWORD</a>&nbsp;</td>          <td class="mdname" nowrap> <em>flags</em>, </td>        </tr>        <tr>          <td class="md" nowrap align="right"></td>          <td class="md"></td>          <td class="md" nowrap><a class="el" href="group__basic__types.htm#ga0">Uint8</a>&nbsp;</td>          <td class="mdname" nowrap> <em>alpha</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;    </td>    <td><p>Sets the alpha value for the entire surface of a DC, as opposed to using the alpha component of each pixel. <p>This function sets the alpha value for the entire surface of the DC <em>mem_dc</em>, as opposed to using the alpha component of each pixel. This value measures the range of transparency of the surface, 0 being completely transparent to 255 being completely opaque. An <em>alpha</em> value of 255 causes blits to be opaque, the source pixels copied to the destination (the default). Note that per-surface alpha can be combined with colorkey transparency.<p>If <em>flags</em> is 0, alpha blending is disabled for the surface. If <em>flags</em> is MEMDC_FLAG_SRCALPHA, alpha blending is enabled for the surface. OR'ing the flag with MEMDC_FLAG_RLEACCEL requests RLE acceleration for the surface; if MEMDC_FLAG_RLEACCEL is not specified, the RLE acceleration will be removed.<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>mem_dc</em>&nbsp;</td><td>The device context. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>flags</em>&nbsp;</td><td>The alpha value specific memory DC flags. </td></tr>    <tr><td valign="top"></td><td valign="top"><em>alpha</em>&nbsp;</td><td>the alpha value for the entire surface of the DC <em>mem_dc</em>.</td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>TRUE on success, otherwise FALSE.</dd></dl><dl compact><dt><b>Note:</b></dt><dd>Only defined for _USE_NEWGAL.</dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__dc__fns.htm#ga18">SetMemDCColorKey</a> </dd></dl>    </td>  </tr></table><a class="anchor" name="ga18" doxytag="gdi.h::SetMemDCColorKey"></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 SetMemDCColorKey           </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>  

⌨️ 快捷键说明

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