int wglChoosePixelFormat(IntPtr hDc, ref Gdi.PIXELFORMATDESCRIPTOR pPfd) { unsafe { fixed (Gdi.PIXELFORMATDESCRIPTOR* pPfd_ptr = &pPfd) { return Delegates.wglChoosePixelFormat((IntPtr)hDc, (Gdi.PIXELFORMATDESCRIPTOR*)pPfd_ptr); } } }
int wglDescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, Gdi.PIXELFORMATDESCRIPTOR[] ppfd) { unsafe { fixed (Gdi.PIXELFORMATDESCRIPTOR* ppfd_ptr = ppfd) { return Delegates.wglDescribePixelFormat((IntPtr)hdc, (int)ipfd, (UInt32)cjpfd, (Gdi.PIXELFORMATDESCRIPTOR*)ppfd_ptr); } } }
public static extern int _DescribePixelFormat(System.IntPtr hdc,int iPixelFormat,uint nBytes,ref Gdi.PIXELFORMATDESCRIPTOR ppfd);
public static PixelFormatValue[] PrioritizePixelFormats(Gdi.PIXELFORMATDESCRIPTOR[] unsortedFormats,bool requireDoubleBuffering,bool requireHardwareAccerleration) { ArrayList sortedFormats=new ArrayList(); for(int i=0;i<unsortedFormats.Length;i++) { Gdi.PIXELFORMATDESCRIPTOR pfd=unsortedFormats[i]; long bpp=pfd.cColorBits; long depth=pfd.cDepthBits; bool pal=FormatUsesPalette(pfd); bool hardware=FormatSupportsAcceleration(pfd); bool opengl=FormatSupportsOpenGL(pfd); bool window=FormatSupportsWindow(pfd); bool bitmap=FormatSupportsBitmap(pfd); bool dbuff=FormatSupportsDoubleBuffering(pfd); //Recognize formats which do not meet minimum requirements first and foremost. if(!opengl||!window||bpp<8||depth<8||pal||requireDoubleBuffering!=dbuff||requireHardwareAccerleration!=hardware) { continue; } PixelFormatValue pfv=new PixelFormatValue(); pfv.pfd=pfd; pfv.formatNumber=i+1; sortedFormats.Add(pfv); } sortedFormats.Sort(); return (PixelFormatValue[])sortedFormats.ToArray(typeof(PixelFormatValue)); }
public static extern int ChangeDisplaySettings(ref Gdi.DEVMODE devMode, int flags);
public static extern bool EnumDisplaySettings(string deviceName, int modeNumber, out Gdi.DEVMODE devMode);
internal extern static unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, Gdi.PIXELFORMATDESCRIPTOR* ppfd);
private static void PopulatePixelFormatDescriptor(ref Gdi.PIXELFORMATDESCRIPTOR pfd) { pfd.nSize = (short)Marshal.SizeOf(pfd); pfd.nVersion = 1; pfd.dwFlags = Gdi.PFD_DRAW_TO_WINDOW | Gdi.PFD_SUPPORT_OPENGL | Gdi.PFD_DOUBLEBUFFER; pfd.iPixelType = (byte)Gdi.PFD_TYPE_RGBA; pfd.cColorBits = (byte)32; pfd.cRedBits = 0; pfd.cRedShift = 0; pfd.cGreenBits = 0; pfd.cGreenShift = 0; pfd.cBlueBits = 0; pfd.cBlueShift = 0; pfd.cAlphaBits = 0; pfd.cAlphaShift = 0; pfd.cAccumBits = 0; pfd.cAccumRedBits = 0; pfd.cAccumGreenBits = 0; pfd.cAccumBlueBits = 0; pfd.cAccumAlphaBits = 0; pfd.cDepthBits = 32; pfd.cStencilBits = 0; pfd.cAuxBuffers = 0; pfd.iLayerType = (byte)Gdi.PFD_MAIN_PLANE; pfd.bReserved = 0; pfd.dwLayerMask = 0; pfd.dwVisibleMask = 0; pfd.dwDamageMask = 0; }
Boolean wglUseFontOutlinesW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, ref Gdi.GLYPHMETRICSFLOAT glyphMetrics) { unsafe { fixed (Gdi.GLYPHMETRICSFLOAT* glyphMetrics_ptr = &glyphMetrics) { return Delegates.wglUseFontOutlinesW((IntPtr)hDC, (Int32)first, (Int32)count, (Int32)listBase, (float)thickness, (float)deviation, (Int32)fontMode, (Gdi.GLYPHMETRICSFLOAT*)glyphMetrics_ptr); } } }
///<summary>Returns true if the given pixel format supports OpenGL rendering, false otherwise.</summary> public static bool FormatSupportsOpenGL(Gdi.PIXELFORMATDESCRIPTOR pfd) { return (pfd.dwFlags&Gdi.PFD_SUPPORT_OPENGL)!=0; }
Boolean wglSetPixelFormat(IntPtr hdc, int ipfd, ref Gdi.PIXELFORMATDESCRIPTOR ppfd) { unsafe { fixed (Gdi.PIXELFORMATDESCRIPTOR* ppfd_ptr = &ppfd) { return Delegates.wglSetPixelFormat((IntPtr)hdc, (int)ipfd, (Gdi.PIXELFORMATDESCRIPTOR*)ppfd_ptr); } } }
Boolean wglDescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, Int32 nBytes, ref Gdi.LAYERPLANEDESCRIPTOR plpd) { unsafe { fixed (Gdi.LAYERPLANEDESCRIPTOR* plpd_ptr = &plpd) { return Delegates.wglDescribeLayerPlane((IntPtr)hDc, (int)pixelFormat, (int)layerPlane, (UInt32)nBytes, (Gdi.LAYERPLANEDESCRIPTOR*)plpd_ptr); } } }
public static int wglChoosePixelFormat(IntPtr hDc, Gdi.PIXELFORMATDESCRIPTOR[] pPfd) { unsafe { fixed (Gdi.PIXELFORMATDESCRIPTOR* pPfd_ptr = pPfd) { return Delegates.wglChoosePixelFormat((IntPtr)hDc, (Gdi.PIXELFORMATDESCRIPTOR*)pPfd_ptr); } } }
internal extern static unsafe Boolean UseFontOutlinesW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, Gdi.GLYPHMETRICSFLOAT* glyphMetrics);
internal extern static unsafe Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, Gdi.LAYERPLANEDESCRIPTOR* plpd);
///<summary>Does the pixel format support a color palette?</summary> public static bool FormatUsesPalette(Gdi.PIXELFORMATDESCRIPTOR pfd) { return (pfd.iPixelType==Gdi.PFD_TYPE_COLORINDEX); }
///<summary>Returns true if the given pixel format supports bitmapped rendering, false otherwise.</summary> public static bool FormatSupportsBitmap(Gdi.PIXELFORMATDESCRIPTOR pfd) { return (pfd.dwFlags&Gdi.PFD_DRAW_TO_BITMAP)!=0; }
///<summary>Returns true if the given pixel format supports some kind of hardware acceleration, false if the format is a software only graphics.</summary> public static bool FormatSupportsAcceleration(Gdi.PIXELFORMATDESCRIPTOR pfd) { return (pfd.dwFlags&Gdi.PFD_GENERIC_FORMAT)==0; }
internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, Gdi.PIXELFORMATDESCRIPTOR* pPfd);
///<summary>Returns true if the given pixel format supports windowed rendering, false otherwise.</summary> public static bool FormatSupportsWindow(Gdi.PIXELFORMATDESCRIPTOR pfd) { return (pfd.dwFlags&Gdi.PFD_DRAW_TO_WINDOW)!=0; }
internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, Gdi.PIXELFORMATDESCRIPTOR* ppfd);
///<summary>Returns true if the given pixel format supports double-buffering, false otherwise.</summary> public static bool FormatSupportsDoubleBuffering(Gdi.PIXELFORMATDESCRIPTOR pfd) { return (pfd.dwFlags&Gdi.PFD_DOUBLEBUFFER)!=0; }
public static extern void ZeroMemory(Gdi.PIXELFORMATDESCRIPTOR ptr, int numBytes);