mirror of
https://github.com/snltty/linker.git
synced 2025-10-23 17:13:12 +08:00
81 lines
2.9 KiB
C#
81 lines
2.9 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace linker.libs.winapis;
|
|
|
|
public static class GDI32
|
|
{
|
|
#region Enums
|
|
/// <summary>
|
|
/// Specifies a raster-operation code. These codes define how the color data for the
|
|
/// source rectangle is to be combined with the color data for the destination
|
|
/// rectangle to achieve the final color.
|
|
/// </summary>
|
|
public enum TernaryRasterOperations : uint
|
|
{
|
|
/// <summary>dest = source</summary>
|
|
SRCCOPY = 0x00CC0020,
|
|
/// <summary>dest = source OR dest</summary>
|
|
SRCPAINT = 0x00EE0086,
|
|
/// <summary>dest = source AND dest</summary>
|
|
SRCAND = 0x008800C6,
|
|
/// <summary>dest = source XOR dest</summary>
|
|
SRCINVERT = 0x00660046,
|
|
/// <summary>dest = source AND (NOT dest)</summary>
|
|
SRCERASE = 0x00440328,
|
|
/// <summary>dest = (NOT source)</summary>
|
|
NOTSRCCOPY = 0x00330008,
|
|
/// <summary>dest = (NOT src) AND (NOT dest)</summary>
|
|
NOTSRCERASE = 0x001100A6,
|
|
/// <summary>dest = (source AND pattern)</summary>
|
|
MERGECOPY = 0x00C000CA,
|
|
/// <summary>dest = (NOT source) OR dest</summary>
|
|
MERGEPAINT = 0x00BB0226,
|
|
/// <summary>dest = pattern</summary>
|
|
PATCOPY = 0x00F00021,
|
|
/// <summary>dest = DPSnoo</summary>
|
|
PATPAINT = 0x00FB0A09,
|
|
/// <summary>dest = pattern XOR dest</summary>
|
|
PATINVERT = 0x005A0049,
|
|
/// <summary>dest = (NOT dest)</summary>
|
|
DSTINVERT = 0x00550009,
|
|
/// <summary>dest = BLACK</summary>
|
|
BLACKNESS = 0x00000042,
|
|
/// <summary>dest = WHITE</summary>
|
|
WHITENESS = 0x00FF0062,
|
|
/// <summary>
|
|
/// Capture window as seen on screen. This includes layered windows
|
|
/// such as WPF windows with AllowsTransparency="true"
|
|
/// </summary>
|
|
CAPTUREBLT = 0x40000000
|
|
}
|
|
#endregion
|
|
|
|
#region DLL Imports
|
|
|
|
[DllImport("gdi32.dll", EntryPoint = "BitBlt", SetLastError = true)]
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
public static extern bool BitBlt([In] nint hdc, int nXDest, int nYDest, int nWidth, int nHeight, [In] nint hdcSrc, int nXSrc, int nYSrc, TernaryRasterOperations dwRop);
|
|
|
|
[DllImport("gdi32.dll")]
|
|
public static extern nint CreateDC(string lpszDriver, string lpszDevice, string lpszOutput, nint lpInitData);
|
|
|
|
[DllImport("GDI32.dll")]
|
|
public static extern nint CreateCompatibleBitmap(nint hdc, int nWidth, int nHeight); [DllImport("GDI32.dll")]
|
|
public static extern nint CreateCompatibleDC(nint hdc);
|
|
|
|
[DllImport("GDI32.dll")]
|
|
public static extern bool DeleteDC(nint hdc);
|
|
|
|
[DllImport("GDI32.dll")]
|
|
public static extern bool DeleteObject(nint hObject);
|
|
|
|
[DllImport("GDI32.dll")]
|
|
public static extern nint GetDeviceCaps(nint hdc, int nIndex);
|
|
|
|
[DllImport("GDI32.dll")]
|
|
public static extern nint SelectObject(nint hdc, nint hgdiobj);
|
|
|
|
#endregion
|
|
}
|