GDI binding for .NET, implementing Windows-specific GDI functionality.
Binds functions and definitions in gdi32.dll.
Example #1
0
 int wglChoosePixelFormat(IntPtr hDc, ref Gdi.PIXELFORMATDESCRIPTOR pPfd)
 {
     unsafe
     {
         fixed (Gdi.PIXELFORMATDESCRIPTOR* pPfd_ptr = &pPfd)
         {
             return Delegates.wglChoosePixelFormat((IntPtr)hDc, (Gdi.PIXELFORMATDESCRIPTOR*)pPfd_ptr);
         }
     }
 }
Example #2
0
 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);
         }
     }
 }
Example #3
0
		public static extern int _DescribePixelFormat(System.IntPtr hdc,int iPixelFormat,uint nBytes,ref Gdi.PIXELFORMATDESCRIPTOR ppfd);
Example #4
0
		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));
		}
Example #5
0
 public static extern int ChangeDisplaySettings(ref Gdi.DEVMODE devMode, int flags);
Example #6
0
 public static extern bool EnumDisplaySettings(string deviceName, int modeNumber, out Gdi.DEVMODE devMode);
Example #7
0
 internal extern static unsafe Boolean SetPixelFormat(IntPtr hdc, int ipfd, Gdi.PIXELFORMATDESCRIPTOR* ppfd);
Example #8
0
 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;
 }
Example #9
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);
         }
     }
 }
Example #10
0
		///<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;
		}
Example #11
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);
         }
     }
 }
Example #12
0
 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);
         }
     }
 }
Example #13
0
 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);
         }
     }
 }
Example #14
0
 internal extern static unsafe Boolean UseFontOutlinesW(IntPtr hDC, Int32 first, Int32 count, Int32 listBase, float thickness, float deviation, Int32 fontMode, Gdi.GLYPHMETRICSFLOAT* glyphMetrics);
Example #15
0
 internal extern static unsafe Boolean DescribeLayerPlane(IntPtr hDc, int pixelFormat, int layerPlane, UInt32 nBytes, Gdi.LAYERPLANEDESCRIPTOR* plpd);
Example #16
0
		///<summary>Does the pixel format support a color palette?</summary>
		public static bool FormatUsesPalette(Gdi.PIXELFORMATDESCRIPTOR pfd) {
			return (pfd.iPixelType==Gdi.PFD_TYPE_COLORINDEX);
		}
Example #17
0
		///<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;
		}
Example #18
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;
		}
Example #19
0
 internal extern static unsafe int ChoosePixelFormat(IntPtr hDc, Gdi.PIXELFORMATDESCRIPTOR* pPfd);
Example #20
0
		///<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;
		}
Example #21
0
 internal extern static unsafe int DescribePixelFormat(IntPtr hdc, int ipfd, UInt32 cjpfd, Gdi.PIXELFORMATDESCRIPTOR* ppfd);
Example #22
0
		///<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;
		}
Example #23
0
 public static extern void ZeroMemory(Gdi.PIXELFORMATDESCRIPTOR ptr, int numBytes);