C# 클래스 Tao.Platform.Windows.Gdi

GDI binding for .NET, implementing Windows-specific GDI functionality.
Binds functions and definitions in gdi32.dll.
파일 보기 프로젝트 열기: WolfgangSt/axiom 1 사용 예제들

공개 메소드들

메소드 설명
SetPixelFormat ( IntPtr deviceContext, int pixelFormat, PIXELFORMATDESCRIPTOR &pixelFormatDescriptor ) : bool

The SetPixelFormat function sets the pixel format of the specified device context to the format specified by the iPixelFormat index.

If hdc references a window, calling the SetPixelFormat function also changes the pixel format of the window. Setting the pixel format of a window more than once can lead to significant complications for the Window Manager and for multithread applications, so it is not allowed. An application can only set the pixel format of a window one time. Once a window's pixel format is set, it cannot be changed.

You should select a pixel format in the device context before calling the Wgl.wglCreateContext function. The wglCreateContext function creates a rendering context for drawing on the device in the selected pixel format of the device context.

An OpenGL window has its own pixel format. Because of this, only device contexts retrieved for the client area of an OpenGL window are allowed to draw into the window. As a result, an OpenGL window should be created with the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles. Additionally, the window class attribute should not include the CS_PARENTDC style.

The following code example shows SetPixelFormat usage:

HDC hdc; int pixelFormat; Gdi.PIXELFORMATDESCRIPTOR pfd; // size of this pfd pfd.nSize = (ushort) sizeof(Gdi.PIXELFORMATDESCRIPTOR); // version number pfd.nVersion = 1; // support window, support OpenGL, double buffered pfd.dwFlags = Gdi.PFD_DRAW_TO_WINDOW | Gdi.PFD_SUPPORT_OPENGL | Gdi.PFD_DOUBLEBUFFER; // RGBA type pfd.iPixelType = Gdi.PFD_TYPE_RGBA; // 24-bit color depth pfd.cColorBits = 24; // color bits and shift bits ignored pfd.cRedBits = 0; pfd.cRedShift = 0; pfd.cGreenBits = 0; pfd.cGreenShift = 0; pfd.cBlueBits = 0; pfd.cBlueShift = 0; pfd.cAlphaBits = 0; pfd.cAlphaShift = 0; // no accumulation buffer, accum bits ignored pfd.cAccumBits = 0; pfd.cAccumRedBits = 0; pfd.cAccumGreenBits = 0; pfd.cAccumBlueBits = 0; pfd.cAccumAlphaBits = 0; // no stencil buffer pfd.cStencilBits = 0; // no auxiliary buffer pfd.cAuxBuffers = 0; // main layer pfd.iLayerType = Gdi.PFD_MAIN_PLANE; // reserved pfd.bReserved = 0; // layer masks ignored pfd.dwLayerMask = 0; pfd.dwVisibleMask = 0; pfd.dwDamageMask = 0; pixelFormat = Gdi.ChoosePixelFormat(hdc, &pfd); // make that the pixel format of the device context Gdi.SetPixelFormat(hdc, pixelFormat, &pfd);

비공개 메소드들

메소드 설명
ChoosePixelFormat ( IntPtr deviceContext, PIXELFORMATDESCRIPTOR &pixelFormatDescriptor ) : int
CreateFont ( int height, int width, int escapement, int orientation, int weight, bool italic, bool underline, bool strikeOut, int charSet, int outputPrecision, int clipPrecision, int quality, int pitchAndFamily, string typeFace ) : IntPtr
DeleteObject ( IntPtr objectHandle ) : bool
GetDeviceCaps ( IntPtr deviceContext, int nIndex ) : int
SelectObject ( IntPtr deviceContext, IntPtr objectHandle ) : IntPtr
SwapBuffers ( IntPtr deviceContext ) : bool
SwapBuffersFast ( [ deviceContext ) : int
_SetPixelFormat ( IntPtr deviceContext, int pixelFormat, PIXELFORMATDESCRIPTOR &pixelFormatDescriptor ) : bool

메소드 상세

SetPixelFormat() 공개 정적인 메소드

The SetPixelFormat function sets the pixel format of the specified device context to the format specified by the iPixelFormat index.
If hdc references a window, calling the SetPixelFormat function also changes the pixel format of the window. Setting the pixel format of a window more than once can lead to significant complications for the Window Manager and for multithread applications, so it is not allowed. An application can only set the pixel format of a window one time. Once a window's pixel format is set, it cannot be changed.

You should select a pixel format in the device context before calling the Wgl.wglCreateContext function. The wglCreateContext function creates a rendering context for drawing on the device in the selected pixel format of the device context.

An OpenGL window has its own pixel format. Because of this, only device contexts retrieved for the client area of an OpenGL window are allowed to draw into the window. As a result, an OpenGL window should be created with the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles. Additionally, the window class attribute should not include the CS_PARENTDC style.

The following code example shows SetPixelFormat usage:

HDC hdc; int pixelFormat; Gdi.PIXELFORMATDESCRIPTOR pfd; // size of this pfd pfd.nSize = (ushort) sizeof(Gdi.PIXELFORMATDESCRIPTOR); // version number pfd.nVersion = 1; // support window, support OpenGL, double buffered pfd.dwFlags = Gdi.PFD_DRAW_TO_WINDOW | Gdi.PFD_SUPPORT_OPENGL | Gdi.PFD_DOUBLEBUFFER; // RGBA type pfd.iPixelType = Gdi.PFD_TYPE_RGBA; // 24-bit color depth pfd.cColorBits = 24; // color bits and shift bits ignored pfd.cRedBits = 0; pfd.cRedShift = 0; pfd.cGreenBits = 0; pfd.cGreenShift = 0; pfd.cBlueBits = 0; pfd.cBlueShift = 0; pfd.cAlphaBits = 0; pfd.cAlphaShift = 0; // no accumulation buffer, accum bits ignored pfd.cAccumBits = 0; pfd.cAccumRedBits = 0; pfd.cAccumGreenBits = 0; pfd.cAccumBlueBits = 0; pfd.cAccumAlphaBits = 0; // no stencil buffer pfd.cStencilBits = 0; // no auxiliary buffer pfd.cAuxBuffers = 0; // main layer pfd.iLayerType = Gdi.PFD_MAIN_PLANE; // reserved pfd.bReserved = 0; // layer masks ignored pfd.dwLayerMask = 0; pfd.dwVisibleMask = 0; pfd.dwDamageMask = 0; pixelFormat = Gdi.ChoosePixelFormat(hdc, &pfd); // make that the pixel format of the device context Gdi.SetPixelFormat(hdc, pixelFormat, &pfd);
public static SetPixelFormat ( IntPtr deviceContext, int pixelFormat, PIXELFORMATDESCRIPTOR &pixelFormatDescriptor ) : bool
deviceContext System.IntPtr /// Specifies the device context whose pixel format the function attempts to set. ///
pixelFormat int /// Index that identifies the pixel format to set. The various pixel formats supported by a device /// context are identified by one-based indexes. ///
pixelFormatDescriptor PIXELFORMATDESCRIPTOR /// Pointer to a structure that contains the logical pixel /// format specification. The system's metafile component uses this structure to record the logical /// pixel format specification. The structure has no other effect upon the behavior of the /// SetPixelFormat function. ///
리턴 bool