CPF/CPF.Skia/GlContexts/Wgl/Gdi32.cs
2023-11-21 23:05:03 +08:00

32 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace CPF.Skia
{
public class Gdi32
{
private const string gdi32 = "gdi32.dll";
public const byte PFD_TYPE_RGBA = 0;
public const byte PFD_MAIN_PLANE = 0;
public const uint PFD_DRAW_TO_WINDOW = 0x00000004;
public const uint PFD_SUPPORT_OPENGL = 0x00000020;
public const uint PFD_DRAW_TO_BITMAP = 8u;
public const uint PFD_SUPPORT_GDI = 16u;
[DllImport(gdi32, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetPixelFormat(IntPtr hdc, int iPixelFormat, [In] ref PIXELFORMATDESCRIPTOR ppfd);
[DllImport(gdi32, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
public static extern int ChoosePixelFormat(IntPtr hdc, [In] ref PIXELFORMATDESCRIPTOR ppfd);
[DllImport(gdi32, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SwapBuffers(IntPtr hdc);
}
}