Increase the drawing speed, use double buffering, and say goodbye to bitblt, so that your memory may be stolen.

Source: Internet
Author: User

Http://blog.csdn.net/cnming/archive/2007/04/21/1574030.aspx

Due to memory release problems, the use of the bitblt method will cause memory usage to grow slowly and will not be released. This problem does not occur when using common dual-buffering, and the speed is acceptable.
Some code is cropped, so the code is incomplete.
Cementing. curvesplit. drawcurvepress and then draw a pressure graph on the bitmap (membmp) pointed to by memdc.

 

Using system;
Using system. Collections. Generic;
Using system. text;
Using system. runtime. interopservices;

Namespace Cementing
{
Class win32support
{
/// <Summary>
/// Enumeration to be used for those Win32 function that return bool
/// </Summary>
Public Enum bool
{
False = 0,
True
};

/// <Summary>
/// Enumeration for the raster operations used in bitblt.
/// In C ++ these are actually # define. But to use these
/// Constants with C #, a new Enumeration type is defined.
/// </Summary>
Public Enum ternaryrasteroperations
{
Srccopy = 0x00cc0020,/* DEST = source */
Srcpaint = 0x00ee0086,/* DEST = source or DEST */
Srcand = 0x008800c6,/* DEST = source and DEST */
SRCINVERT = 0x00660046,/* DEST = source xor dest */
Srcerase = 0x00440328,/* DEST = source and (not DEST )*/
Notsrccopy = 0x00330008,/* DEST = (not source )*/
NOTSRCERASE = 0x001100a6,/* DEST = (not SRC) and (not DEST )*/
Mergecopy = 0x00c000ca,/* DEST = (source and pattern )*/
Mergepaint = 0x00bb0226,/* DEST = (not source) or DEST */
Patcopy = 0x00f00021,/* DEST = pattern */
Patpaint = 0x00fb0a09,/* DEST = dpsnoo */
Patinvert = 0x005a0049,/* DEST = pattern xor dest */
Dstinvert = 0x00550009,/* DEST = (not DEST )*/
Blackness = 0x00000042,/* DEST = black */
Whiteness = 0x00ff0062,/* DEST = white */
};

/// <Summary>
/// Createcompatibledc
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern intptr createcompatibledc (intptr HDC );

/// <Summary>
/// Deletedc
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern bool deletedc (intptr HDC );

/// <Summary>
/// SelectObject
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true)]
Public static extern intptr SelectObject (intptr HDC, intptr hobject );

/// <Summary>
/// Deleteobject
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern bool deleteobject (intptr hobject );

/// <Summary>
/// Createcompatiblebitmap
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern intptr createcompatiblebitmap (intptr hobject, int width, int height );

/// <Summary>
/// Bitblt
/// </Summary>
[Dllimport ("gdi32.dll", exactspelling = true, setlasterror = true)]
Public static extern bool bitblt (intptr hobject, int nxdest, int nydest, int nwidth, int nheight, intptr hobjsource, int nxsrc, int nysrc, ternaryrasteroperations dwrop );
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.