/[gr2lib]/trunk/gr2lib/core/ui/typeeditors/PixelBytesEditor.cs
ViewVC logotype

Diff of /trunk/gr2lib/core/ui/typeeditors/PixelBytesEditor.cs

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

--- trunk/gr2lib/core/ui/typeeditors/PixelBytesEditor.cs	2010/07/19 09:19:24	144
+++ trunk/gr2lib/core/ui/typeeditors/PixelBytesEditor.cs	2010/07/19 09:39:21	145
@@ -156,21 +156,36 @@
         #region DEBUG PIXELS SUPPORT
         private void btnDebugPixels_Click(object sender, EventArgs e)
         {
-            throw new NotImplementedException("Debug Has Not Been Implemented");
-            ////MessageBox.Show("Debug Has Not Been Implemented", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-            //List<byte> _bytes = new List<byte>();
-            //foreach (Pixel p in this.Value) { _bytes.Add(new byte()); }
+            //throw new NotImplementedException("Debug Has Not Been Implemented");
+            //MessageBox.Show("Debug Has Not Been Implemented", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+            List<byte> _bytes = new List<byte>();
+            foreach (Pixel p in this.Value) { _bytes.Add(new byte()); }
+
+            byte[] __bytes = _bytes.ToArray();
+
+            Texture ReferenceTexture = Value[0].ReferenceTexture;
+
+
+            bool TextureCopied = false;
+  
+            byte[] buffer = new byte[__bytes.Length];
+            unsafe
+            {
+                fixed (byte* p = buffer)
+                {
+                    IntPtr byte_ptr = (IntPtr)p;
+                    TextureCopied = coreapi.GrannyCopyTextureImage(ReferenceTexture.NativePointer, 
+                                                                    0, 
+                                                                    0, 
+                                                                    granny_pixel_layout_types.GrannyRGBA8888PixelFormat.NativePointer,
+                                                                    ReferenceTexture.Width,
+                                                                    ReferenceTexture.Height,
+                                                                    0,
+                                                                    byte_ptr);
+                    MessageBox.Show("coreapi.GrannyCopyTextureImage returned: " + TextureCopied.ToString());
+                }
+            }
 
-            //byte[] __bytes = _bytes.ToArray();
-
-            //Texture ReferenceTexture = Value[0].ReferenceTexture;
-
-
-            //bool TextureCopied = false;
-
-            //TextureCopied = coreapi.GrannyCopyTextureImage(Texture.AssignToStructure(ReferenceTexture), 0, 0, gr2lib.core.coretypes.implementation.Layout.AssignToStructure(granny_pixel_layout_types.GrannyRGBA8888PixelFormat), 100, 100, 0, ref __bytes);
-
-            //MessageBox.Show("coreapi.GrannyCopyTextureImage returned: " + TextureCopied.ToString());
      
         }
         #endregion

 

  ViewVC Help
Powered by ViewVC 1.1.22