/[gr2lib]/trunk/gr2lib/core/typedefs/granny_pixel_layouts.cs
ViewVC logotype

Diff of /trunk/gr2lib/core/typedefs/granny_pixel_layouts.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/gr2lib/core/typedefs/granny_pixel_layouts.cs	2010/07/24 04:16:43	187
+++ trunk/gr2lib/core/typedefs/granny_pixel_layouts.cs	2010/07/24 06:31:50	191
@@ -81,10 +81,10 @@
             #region Get GrannyRGB555PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGB555PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB555PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -120,10 +120,10 @@
             #region Get GrannyRGB565PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGB565PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB565PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -159,10 +159,10 @@
             #region Get GrannyRGBA5551PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGBA5551PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA5551PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -198,10 +198,10 @@
             #region Get GrannyRGBA4444PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGBA4444PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA4444PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -237,10 +237,10 @@
             #region Get GrannyRGB888PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGB888PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGB888PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -276,10 +276,10 @@
             #region Get GrannyRGBA8888PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyRGBA8888PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyRGBA8888PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -315,10 +315,10 @@
             #region Get GrannyARGB8888PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyARGB8888PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyARGB8888PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -345,7 +345,6 @@
             #endregion
         }
         #endregion
-
         #region Pixel Layout: GrannyABGR8888PixelFormat
         /// <summary>
         /// 32bpp  8-bit red, 8-bit green, 8-bit blue, 8-bit alpha
@@ -355,14 +354,13 @@
             #region Get GrannyABGR8888PixelFormat Layout
             get
             {
-                Layout _tmp_layout = granny_pixel_layouts.GrannyARGB8888PixelFormat;
-
+                Layout _tmp_layout = granny_pixel_layouts.GrannyARGB8888PixelFormat;               
                 unsafe
                 {
-                    IntPtr layoutPTR = (IntPtr)_tmp_layout.BytesPerPixel;
-                    _tmp_layout.NativePointer = layoutPTR;
+                    GCHandle layoutHandle = GCHandle.Alloc(_tmp_layout.BytesPerPixel, GCHandleType.Pinned);                    
+                    _tmp_layout.NativePointer = layoutHandle.AddrOfPinnedObject();
+                    layoutHandle.Free();
                 }            
-
                 int R = _tmp_layout.ShiftForComponent[1];
                 int B = _tmp_layout.ShiftForComponent[3];
 
@@ -374,7 +372,6 @@
             #endregion
         }
         #endregion
-
         #region Pixel Layout: GrannyBGR555PixelFormat
         /// <summary>
         /// 16bpp  5-bit blue, 5-bit green, 5-bit red
@@ -384,10 +381,10 @@
             #region Get GrannyBGR555PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGR555PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR555PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -423,10 +420,10 @@
             #region Get GrannyBGR565PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGR565PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR565PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -462,10 +459,10 @@
             #region Get GrannyBGRA5551PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGRA5551PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA5551PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -501,10 +498,10 @@
             #region Get GrannyBGRA4444PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGRA4444PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA4444PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -540,10 +537,10 @@
             #region Get GrannyBGR888PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGR888PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGR888PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;
@@ -579,10 +576,10 @@
             #region Get GrannyBGRA8888PixelFormat Layout
             get
             {
-                IntPtr hdl = coreapi.LoadLibrary("granny2.dll");
+                IntPtr hdl = coreapi.ExternalSupport.LoadLibrary("granny2.dll");
                 if (hdl != IntPtr.Zero)
                 {
-                    IntPtr addr = coreapi.GetProcAddress(hdl, "GrannyBGRA8888PixelFormat");
+                    IntPtr addr = coreapi.ExternalSupport.GetProcAddress(hdl, "GrannyBGRA8888PixelFormat");
                     if (addr != IntPtr.Zero)
                     {
                         gr2lib.core.coretypes.native.Layout _native_ptr;

 

  ViewVC Help
Powered by ViewVC 1.1.22