⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gapi.cs

📁 功能:基于windows mobile 的地图查看器。使用vs2005开发
💻 CS
字号:
using System;
using System.Runtime.InteropServices;

namespace GXGraphicsLibrary
{
#if USE_GXLIBS
	/// <summary>
	/// Full encapsulation of GAPI graphics functions and constants.
	/// This entire class is only visible internally to the library.
	/// </summary>
	internal class GAPI
	{
		/// <summary>
		/// Failure return value of GAPI functions.
		/// </summary>
		public const int GX_FAIL = 0;

		/// <summary>
		/// Success return value of GAPI functions.
		/// </summary>
		public const int GX_SUCCESS = 1;

		/// <summary>
		/// Sets the display to fullscreen mode - the only mode
		/// our library will support.  Used in GXOpenDisplay.
		/// </summary>
		public const uint GX_FULLSCREEN = 0x01;

		/// <summary>
		/// Specifies if the display is in landscape mode in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfLandscape = 0x8;

		/// <summary>
		/// Specifies if the display pixels are paletted in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfPalette = 0x10;

		/// <summary>
		/// Specifies if the display pixels are direct color in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfDirect = 0x20;

		/// <summary>
		/// Specifies if the display pixels are 15 bit 555 format in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfDirect5550 = 0x40;

		/// <summary>
		/// Specifies if the display pixels are 16 bit 565 format in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfDirect565 = 0x80;

		/// <summary>
		/// Specifies if the display pixels are 24 bit 888 format in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfDirect888 = 0x100;

		/// <summary>
		/// Specifies if the display pixels are 12 bit 444 format in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfDirect444 = 0x200;

		/// <summary>
		/// Specifies if the display pixels are inverted in GXDisplayProperties.ffFormat.
		/// </summary>
		public const uint kfDirectInverted = 0x400;

		/// <summary>
		/// Defines the display properties of the device in GXDisplayProperties.ffFormat.
		/// </summary>
		public class GXDisplayProperties
		{
			public uint cxWidth = 0;		// Screen width
			public uint cyHeight = 0;		// Screen height
			public int cbxPitch = 0;		// Byte offset to next pixel in X
			public int cbyPitch = 0;		// Byte offset to next pixel in Y
			public int cBPP = 0;			// Bits per pixel
			public uint ffFormat = 0;		// Pixel format
		}

		/// <summary>
		/// Starts a draw cycle to the display device. Called at the
		/// start of each frame.
		/// </summary>
		/// <returns>A pointer to display memory pixel 0,0</returns>
		[DllImport("gx.dll", EntryPoint="#1")]
		extern public static IntPtr GXBeginDraw();

		/// <summary>
		/// End a draw cycle.  Call at the end of every draw frame.
		/// </summary>
		/// <returns>GX_FAIL or GX_SUCCESS</returns>
		[DllImport("gx.dll", EntryPoint="#4")]
		extern public static int GXEndDraw();

		/// <summary>
		/// Open the display for drawing.  Called only once.
		/// </summary>
		/// <param name="hWnd">Handle to the parent window</param>
		/// <param name="dwFlags">Flags specifying display properties</param>
		/// <returns>Non-zero if successful</returns>
		[DllImport("gx.dll", EntryPoint="#8")]
		extern public static int GXOpenDisplay(IntPtr hWnd, uint dwFlags);

		/// <summary>
		/// Close the display.  Called only once when application
		/// has finished using GAPI.
		/// </summary>
		/// <returns>GX_FAIL or GX_SUCCESS</returns>
		[DllImport("gx.dll", EntryPoint="#2")]
		extern public static int GXCloseDisplay();
		
		/// <summary>
		/// Specifies if the display memory is a DRAM buffer.
		/// </summary>
		/// <returns>0 if false, non-zero otherwise</returns>
		[DllImport("gx.dll", EntryPoint="#7")]
		extern public static int GXIsDisplayDRAMBuffer();

		/// <summary>
		/// Resume drawing from a suspend.
		/// </summary>
		/// <returns>Always GX_SUCCESS</returns>
		[DllImport("gx.dll", EntryPoint="#10")]
		extern public static int GXResume();

		/// <summary>
		/// Set the graphics viewport.  This does not inherently clip.
		/// </summary>
		/// <param name="dwTop">Top pixel row</param>
		/// <param name="dwHeight">Height of viewport</param>
		/// <param name="dwReserved1">Unused</param>
		/// <param name="dwReserved2">Unused</param>
		/// <returns>GX_FAIL or GX_SUCCESS</returns>
		[DllImport("gx.dll", EntryPoint="#11")]
		extern public static int GXSetViewport(uint dwTop, uint dwHeight, uint dwReserved1, uint dwReserved2);

		/// <summary>
		/// Suspend drawing.  Used when application is minimized.
		/// </summary>
		/// <returns>Always GX_SUCCESS</returns>
		[DllImport("gx.dll", EntryPoint="#12")]
		extern public static int GXSuspend();

		/// <summary>
		/// Fills an instance of GXDisplayProperties.
		/// </summary>
		/// <param name="displayProps">Class instance of GXDisplayProperties</param>
		[DllImport("gapinet.dll")]
		extern public static void GXGetDisplayProperties(GXDisplayProperties displayProps);
	}
#endif
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -