/// <summary> /// Creates a new instance of the <see cref="NJImage"/> class /// </summary> public NJImage() { comp = (Component *)Marshal.AllocHGlobal(3 * Marshal.SizeOf(typeof(Component))); block = (int *)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(int))); FillMem(comp, new Component(), 3); qtab = (byte **)Marshal.AllocHGlobal(4 * IntPtr.Size); vlctab = (VLCCode **)Marshal.AllocHGlobal(4 * IntPtr.Size); for (int i = 0; i < 4; i++) { qtab[i] = (byte *)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(byte))); vlctab[i] = (VLCCode *)Marshal.AllocHGlobal(65536 * Marshal.SizeOf(typeof(VLCCode))); FillMem((long *)qtab[i], 0, 64 / 8); //use long instead of byte FillMem((long *)vlctab[i], 0, 65536 / 4); //use long instead of VLCCode (length=2) } }
public Jpeg(MainForm fm, string filename) { this.mf = fm; comp = (Component *)Marshal.AllocHGlobal(3 * Marshal.SizeOf(typeof(Component))); block = (int *)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(int))); FillMem(comp, new Component(), 3); qtab = (byte **)Marshal.AllocHGlobal(4 * IntPtr.Size); vlctab = (VLCCode **)Marshal.AllocHGlobal(4 * IntPtr.Size); for (int i = 0; i < 4; i++) { qtab[i] = (byte *)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(byte))); vlctab[i] = (VLCCode *)Marshal.AllocHGlobal(65536 * Marshal.SizeOf(typeof(VLCCode))); FillMem((long *)qtab[i], 0, 64 / 8); // use long instead of byte FillMem((long *)vlctab[i], 0, 65536 / 4); // use long instead of VLCCode (length=2) } Decode(filename); }
/// <summary> /// Creates a new instance of the <see cref="NJImage"/> class /// </summary> public NJImage() { comp = (Component*)Marshal.AllocHGlobal(3 * Marshal.SizeOf(typeof(Component))); block = (int*)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(int))); FillMem(comp, new Component(), 3); qtab = (byte**)Marshal.AllocHGlobal(4 * IntPtr.Size); vlctab = (VLCCode**)Marshal.AllocHGlobal(4 * IntPtr.Size); for (int i = 0; i < 4; i++) { qtab[i] = (byte*)Marshal.AllocHGlobal(64 * Marshal.SizeOf(typeof(byte))); vlctab[i] = (VLCCode*)Marshal.AllocHGlobal(65536 * Marshal.SizeOf(typeof(VLCCode))); FillMem((long*)qtab[i], 0, 64 / 8);//use long instead of byte FillMem((long*)vlctab[i], 0, 65536 / 4);//use long instead of VLCCode (length=2) } }