1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      C#使用GDI中的API函數(shù)

             我們知道在.NET 平臺下主要是用GDI+來進(jìn)行圖形圖像處理,在效率要求不高的情況下使用GDI+已經(jīng)足夠?qū)崿F(xiàn)各種功能了,但一旦要求效率的情況下,我們可以考慮使用GDI來代替GDI+,網(wǎng)上有人士做過相關(guān)測試(本人也測試過),GDI在圖形、圖像繪制方面效率較GDI+有很大提高。下面將自己開發(fā)過程中整理到的NativeGdi32Api類貼出來:

      創(chuàng)新互聯(lián)主營灤平網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都app軟件開發(fā)公司,灤平h5微信小程序搭建,灤平網(wǎng)站營銷推廣歡迎灤平等地區(qū)企業(yè)咨詢

      1. public static class NativeGdi32Api  
      2. {  
      3. [ DllImport("gdi32.dll" )]  
      4. public static extern int SetDIBits (IntPtr hdc, IntPtr hBitmap, int nStartScan , int nNumScans, IntPtr lpBits, IntPtr lpBI , int wUsage);  
      5.  
      6.  
      7. [ DllImport("gdi32.dll" )]  
      8. public static extern int SetDIBitsToDevice (IntPtr hdc, int x, int y , int dx, int dy, int SrcX, int SrcY, int Scan , int NumScans, IntPtr Bits, IntPtr BitsInfo , int wUsage);  
      9.  
      10.  
      11. [ DllImport("gdi32.dll" )]  
      12. public static extern IntPtr CreateDIBSection (IntPtr hdc, IntPtr pBitmapInfo, int un , IntPtr lplpVoid , IntPtr handle, int dw);  
      13.  
      14.  
      15. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto )]  
      16. public static extern int SetPixel (IntPtr hdc, int x, int y , int crColor);  
      17.  
      18.  
      19. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto )]  
      20. public static extern int GetPixel (IntPtr hdc, int x, int y );  
      21.  
      22.  
      23.  
      24.  
      25. [ DllImport("gdi32.dll" , CharSet= CharSet.Auto )]  
      26. public static extern int CombineRgn (IntPtr dest, IntPtr src1, IntPtr src2 , int flags);  
      27.  
      28.  
      29. [ DllImport("gdi32.dll" , CharSet= CharSet.Auto )]  
      30. public static extern IntPtr CreateBrushIndirect (ref LOGBRUSH brush );  
      31.  
      32.  
      33.  
      34.  
      35. [ DllImport("gdi32.dll" , CharSet= CharSet.Auto )]  
      36. public static extern IntPtr CreateRectRgnIndirect (ref RECTAPI rect );  
      37.  
      38.  
      39.  
      40.  
      41. [ DllImport("gdi32.dll" , CharSet= CharSet.Auto )]  
      42. public static extern int GetClipBox (IntPtr hDC, ref RECTAPI rectBox);  
      43.  
      44.  
      45. [ DllImport("gdi32.dll" , CharSet= CharSet.Auto )]  
      46. public static extern bool PatBlt (IntPtr hDC, int x, int y , int width, int height, uint flags);  
      47.  
      48.  
      49. [ DllImport("gdi32.dll" , CharSet= CharSet.Auto )]  
      50. public static extern int SelectClipRgn (IntPtr hDC, IntPtr hRgn);  
      51.  
      52.  
      53.  
      54.  
      55.  
      56.  
      57. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      58. public static extern IntPtr MoveToEx (IntPtr hDC, int x, int y , ref POINTAPI lpPoint );  
      59.  
      60.  
      61. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      62. public static extern IntPtr LineTo (IntPtr hDC, int x, int y );  
      63.  
      64.  
      65. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      66. public static extern IntPtr CreatePen (int nPenStyle, int nWidth, int crColor );  
      67.  
      68.  
      69. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      70. public static extern int SetBrushOrgEx (IntPtr hDC, int x, int y , ref POINTAPI p );  
      71.  
      72.  
      73. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      74. public static extern IntPtr CreatePatternBrush (IntPtr hBMP);  
      75.  
      76.  
      77. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      78. public static extern int GetTextFace (IntPtr hDC, int nCount, string lpFacename );  
      79.  
      80.  
      81. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      82. public static extern int GetTextMetrics (IntPtr hDC, ref GDITextMetric TextMetric);  
      83.  
      84.  
      85. [ DllImport("gdi32.dll" , CharSet = CharSet.Ansi , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      86. public static extern IntPtr CreateFontIndirect ([MarshalAs( UnmanagedType.LPStruct )]LogFont LogFont);  
      87.  
      88.  
      89. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Auto, CallingConvention = CallingConvention .StdCall)]  
      90. public static extern int BitBlt (IntPtr hDestDC, int x, int y , int nWidth, int nHeight, IntPtr hSrcDC , int xSrc, int ySrc, int dwRop );  
      91.  
      92.  
      93. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      94. public static extern IntPtr CreateSolidBrush (int crColor);  
      95.  
      96.  
      97. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      98. public static extern int Rectangle (IntPtr hDC, int left, int top , int right, int bottom);  
      99.  
      100.  
      101. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      102. public static extern IntPtr CreateHatchBrush (int Style, int crColor);  
      103.  
      104.  
      105.  
      106.  
      107. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      108. public static extern IntPtr CreateCompatibleBitmap (IntPtr hDC, int nWidth, int nHeight );  
      109.  
      110.  
      111. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      112. public static extern IntPtr CreateCompatibleDC (IntPtr hDC);  
      113.  
      114.  
      115. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      116. public static extern IntPtr SelectObject (IntPtr hDC, IntPtr hObject);  
      117.  
      118.  
      119. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      120. public static extern IntPtr DeleteObject (IntPtr hObject);  
      121.  
      122.  
      123. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Auto, CallingConvention = CallingConvention .StdCall)]  
      124. public static extern int GetTextColor (IntPtr hDC);  
      125.  
      126.  
      127. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Auto, CallingConvention = CallingConvention .StdCall)]  
      128. public static extern int SetTextColor (IntPtr hDC, int crColor);  
      129.  
      130.  
      131. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Auto, CallingConvention = CallingConvention .StdCall)]  
      132. public static extern int GetBkColor (IntPtr hDC);  
      133.  
      134.  
      135. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Auto, CallingConvention = CallingConvention .StdCall)]  
      136. public static extern int GetBkMode (IntPtr hDC);  
      137.  
      138.  
      139. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      140. public static extern IntPtr DeleteDC (IntPtr hDC);  
      141.  
      142.  
      143. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Auto, CallingConvention = CallingConvention .StdCall)]  
      144. public static extern int SetBkColor (IntPtr hDC, int crColor);  
      145.  
      146.  
      147. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Auto, CallingConvention = CallingConvention .StdCall)]  
      148. public static extern int SetBkMode (IntPtr hDC, int Mode);  
      149.  
      150.  
      151. [ DllImport("gdi32.dll" , CharSet = CharSet.Auto , CallingConvention = CallingConvention .StdCall, SetLastError=true )]  
      152. public static extern int GdiFlush ();  
      153.  
      154.  
      155. [ DllImport("gdi32.dll" , SetLastError = true, CharSet = CharSet. Ansi, CallingConvention = CallingConvention .StdCall)]  
      156. public static extern int EnumFontFamiliesEx (IntPtr hDC, [MarshalAs(UnmanagedType .LPStruct)] LogFont lf , FONTENUMPROC proc, Int64 LParam, Int64 DW );  
      157.  
      158.  
      159. [ DllImport("gdi32.dll" , EntryPoint = "GdiAlphaBlend" )]  
      160. public static extern bool AlphaBlend (  
      161. IntPtr hdcDest , // handle to destination DC  
      162. int nXOriginDest , // x-coord of upper-left corner  
      163. int nYOriginDest , // y-coord of upper-left corner  
      164. int nWidthDest , // destination width  
      165. int nHeightDest , // destination height  
      166. IntPtr hdcSrc , // handle to source DC  
      167. int nXOriginSrc , // x-coord of upper-left corner  
      168. int nYOriginSrc , // y-coord of upper-left corner  
      169. int nWidthSrc , // source width  
      170. int nHeightSrc , // source height  
      171. BLENDFUNCTION blendFunction // alpha-blending function  
      172. );  
      173. }  

           另外,如果真的是對效率要求很高的應(yīng)用,還是推薦大家使用OpenGL、DirectX。.NET平臺下有與之對應(yīng)的Tao.OpenGL和Managed DirectX。


      網(wǎng)頁標(biāo)題:C#使用GDI中的API函數(shù)
      網(wǎng)站網(wǎng)址:http://ef60e0e.cn/article/jiipip.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        介休市| 嘉峪关市| 小金县| 大化| 搜索| 桂东县| 祁门县| 宁都县| 石渠县| 海伦市| 莒南县| 浮梁县| 巴青县| 平顶山市| 泗洪县| 监利县| 靖江市| 项城市| 长海县| 绍兴县| 金昌市| 贵德县| 肇东市| 永丰县| 西藏| 青海省| 新巴尔虎左旗| 祁东县| 周宁县| 手机| 化州市| 鲁山县| 志丹县| 曲沃县| 内乡县| 漯河市| 吉水县| 井陉县| 安宁市| 乌兰浩特市| 陆河县|