/[gr2lib]/trunk/gr2lib/core/coreapi/coreapi.cs
ViewVC logotype

Contents of /trunk/gr2lib/core/coreapi/coreapi.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 172 - (show annotations) (download)
Thu Jul 22 15:27:45 2010 UTC (9 years, 1 month ago) by william
File size: 4946 byte(s)
Add: GrannySwapRGBAToBGRA(granny_pixel_layout * Layout);

1 using System;
2 using System.Runtime.InteropServices;
3
4 using gr2lib.core.typedefs;
5 using gr2lib.core.coretypes;
6 using gr2lib.core.coretypes.native;
7 //using gr2lib.core.coretypes;
8
9 namespace gr2lib.core
10 {
11 public class coreapi
12 {
13
14
15 #region INTEROP SUPPORT
16 [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
17 public static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
18 [DllImport("kernel32", SetLastError = true)]
19 public static extern IntPtr LoadLibrary(string lpFileName);
20 #endregion
21
22 #region Granny2 API Version Support
23 [DllImport("granny2.dll", EntryPoint = "GrannyVersionsMatch_", CallingConvention = CallingConvention.StdCall)]
24 internal static extern bool GrannyVersionsMatch(granny_int32x MajorVersion, granny_int32x MinorVersion, granny_int32x Customization, granny_int32x BuildNumber);
25 [DllImport("granny2.dll", EntryPoint = "GrannyGetVersion", CallingConvention = CallingConvention.StdCall)]
26 internal static extern void GrannyGetVersion(ref granny_int32x MajorVersion, ref granny_int32x MinorVersion, ref granny_int32x Customization, ref granny_int32x BuildNumber);
27 [DllImport("granny2.dll", EntryPoint = "GrannyGetVersionString", CallingConvention = CallingConvention.StdCall)]
28 internal static extern string GrannyGetVersionString();
29 #endregion
30
31 #region Granny2 API File Loading Support
32 [DllImport("granny2.dll", EntryPoint = "GrannyReadEntireFile", CallingConvention = CallingConvention.StdCall)]
33 public static extern IntPtr GrannyReadEntireFile(string fileName);
34 [DllImport("granny2.dll", EntryPoint = "GrannyGetFileInfo", CallingConvention = CallingConvention.StdCall)]
35 public static extern IntPtr GetFileInfo(IntPtr file);
36 [DllImport("granny2.dll", EntryPoint = "GrannyFreeFile", CallingConvention = CallingConvention.StdCall)]
37 public static extern void FreeFile(IntPtr pointer);
38 #endregion
39
40 #region Granny2 API Header Support
41 [DllImport("granny2.dll", EntryPoint = "GrannyGetFileTypeTag", CallingConvention = CallingConvention.StdCall)]
42 public static extern int GrannyGetFileTypeTag(IntPtr File);
43 #endregion
44
45 #region Granny2 API Granny Texture Format Support
46
47 //extern GRANNY_DYNLINKDATA(granny_data_type_definition *) GrannyPixelLayoutType;
48 //[Obsolete("GrannyCopyTextureImage() -- currently does not work [need to research this more]", true)]
49 [DllImport("granny2.dll", EntryPoint = "_GrannyCopyTextureImage@32", CallingConvention = CallingConvention.StdCall)]
50 public static extern bool GrannyCopyTextureImage(IntPtr Texture,
51 int ImageIndex,
52 int MIPIndex,
53 IntPtr Layout,
54 int DestWidth,
55 int DestHeight,
56 int DestStride,
57 IntPtr Pixels);
58 [DllImport("granny2.dll", EntryPoint = "GrannySwapRGBAToBGRA@32", CallingConvention = CallingConvention.StdCall)]
59 public static extern void GrannySwapRGBAToBGRA(IntPtr Layout);
60 #endregion
61
62 #region Granny2 API Logging Support
63
64
65
66 [DllImport("granny2.dll", EntryPoint = "granny_log_function", CallingConvention = CallingConvention.StdCall)]
67 public static extern void granny_log_function(granny_log_message_type Type,
68 granny_log_message_origin Origin,
69 string Message,
70 IntPtr UserData);
71 [DllImport("granny2.dll", EntryPoint = "_GrannySetLogCallback@4", CallingConvention = CallingConvention.StdCall)]
72 public static extern void GrannySetLogCallback(ref gr2lib.core.coretypes.implementation.granny_log_callback_builder.granny_log_callback LogCallback);
73
74
75
76 public static string GrannyGetLogMessageTypeString(granny_log_message_type Type)
77 {
78 string _type = Enum.GetName(typeof(granny_log_message_type), Type);
79 return _type;
80 }
81 public static string GrannyGetLogMessageOriginString(granny_log_message_origin Origin)
82 {
83 string _type = Enum.GetName(typeof(granny_log_message_origin), Origin);
84 return _type;
85 }
86 #endregion
87
88 #region Granny2 API Enum Value to String Support
89 public static string GetGrannyEnumTypeString<T>(T _type)
90 {
91 string _name = Enum.GetName(typeof(T), _type);
92 return _name;
93 }
94 #endregion
95 }
96 }

  ViewVC Help
Powered by ViewVC 1.1.22