/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/Layout.cs
ViewVC logotype

Contents of /trunk/gr2lib/core/coretypes/implementation/Layout.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 73 - (show annotations) (download)
Thu Jul 15 14:31:59 2010 UTC (11 years, 4 months ago) by william
File size: 1433 byte(s)
setup default constructors to initialize each class to its default values

1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using gr2lib.core.helpers;
5
6 namespace gr2lib.core.coretypes.implementation
7 {
8 public class Layout
9 {
10 public int BytesPerPixel;
11 public int[] ShiftForComponent = new int[4];//4 values
12 public int[] BitsForComponent = new int[4];//4 values
13
14 public IntPtr NativePointer;
15
16 public Layout()
17 {
18 this.BytesPerPixel = 0;
19 this.ShiftForComponent = new int[4] { 0, 0, 0, 0 };
20 this.BitsForComponent = new int[4] { 0, 0, 0, 0 };
21 this.NativePointer = IntPtr.Zero;
22 }
23
24 internal static Layout ReadFromMemory(IntPtr pointer)
25 {
26 if (pointer == IntPtr.Zero) return null;
27 native.Layout native = Helpers.ReadFromMemory<native.Layout>(pointer);
28 Layout managed = ReadFromNative(native);
29 managed.NativePointer = pointer;
30 return managed;
31 }
32
33 internal static Layout ReadFromNative(native.Layout native)
34 {
35 Layout managed = new Layout();
36 managed.BytesPerPixel = native.BytesPerPixel;
37 unsafe
38 {
39 managed.ShiftForComponent = native.ShiftForComponent;
40 managed.BitsForComponent = native.BitsForComponent;
41 }
42 return managed;
43 }
44 }
45 }

  ViewVC Help
Powered by ViewVC 1.1.22