using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics
{
///
/// windows系统API类
///
public partial class winapi
{
///
/// The ChoosePixelFormat function attempts to match an appropriate pixel format supported by a device context to a given pixel format specification.
///
///
/// Specifies the device context that the function examines to determine the best match for the pixel format descriptor pointed to by ppfd.
///
///
/// Pointer to a PIXELFORMATDESCRIPTOR structure that specifies the requested pixel format.
///
///
/// If the function succeeds, the return value is a pixel format index (one-based) that is the closest match to the given pixel format descriptor.
/// If the function fails, the return value is zero.
///
[DllImport("gdi32.dll", ExactSpelling = false, EntryPoint = "ChoosePixelFormat", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern int ChoosePixelFormat(IntPtr hdc, IntPtr ppfd);
///
/// The SetPixelFormat function sets the pixel format of the specified device context to the format specified by the iPixelFormat index.
///
///
/// Specifies the device context whose pixel format the function attempts to set.
///
/// Index that identifies the pixel format to set.
/// The various pixel formats supported by a device context are identified by one-based indexes.
///
///
/// Pointer to a PIXELFORMATDESCRIPTOR structure that contains the logical pixel format specification.
/// The system's metafile component uses this structure to record the logical pixel format specification.
///
///
/// If the function succeeds, the return value is TRUE.If the function fails, the return value is FALSE.
///
[DllImport("gdi32.dll", ExactSpelling = false, EntryPoint = "SetPixelFormat", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern bool SetPixelFormat(IntPtr hdc, int format, IntPtr ppfd);
///
/// The GetDC function retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen.
/// You can use the returned handle in subsequent GDI functions to draw in the DC.
///
///
/// A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen.
///
///
/// If the function succeeds, the return value is a handle to the DC for the specified window's client area.
/// If the function fails, the return value is NULL.
///
[DllImport("user32.dll", ExactSpelling = false, EntryPoint = "GetDC", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr GetDC(IntPtr hwnd);
///
/// The SwapBuffers function exchanges the front and back buffers if the current pixel format for the window referenced by the specified device context includes a back buffer.
///
///
/// Specifies a device context.
/// If the current pixel format for the window referenced by this device context includes a back buffer,
/// the function exchanges the front and back buffers.
///
///
/// If the function succeeds, the return value is TRUE.If the function fails, the return value is FALSE.
///
[DllImport("gdi32.dll", ExactSpelling = false, EntryPoint = "SwapBuffers", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern bool SwapBuffers(IntPtr hdc);
///
/// 获取当前线程的控制台窗口句柄
///
/// 当前线程控制台句柄
[DllImport("kernel32.dll", ExactSpelling = false, EntryPoint = "GetConsoleWindow", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr GetConsoleWindow();
}
}