Exemple #1
0
        unsafe void CreateDistortionMap(string settings, string path)
        {
            DistortionMap DM = new DistortionMap();

            DM.Deserialize(settings);
            float[] fData = DM.GenerateMap();
            byte[]  bData = new byte[fData.Length * 4 + 8];
            using (FileStream FS = new FileStream(path, FileMode.Create, FileAccess.Write))
            {
                fixed(float *sfData = &fData[0])
                fixed(byte *sbData = &bData[0])
                {
                    float *pfData = sfData;
                    float *pbData = (float *)sbData + 2;
                    int *  piData = (int *)sbData;

                    *piData++ = DM.Width;
                    *piData++ = DM.Height;
                    for (int i = 0; i < fData.Length; i++)
                    {
                        *pbData++ = *pfData++;
                    }
                }
            }
            File.WriteAllBytes(path, bData);
        }
Exemple #2
0
 public MainForm()
 {
     InitializeComponent();
     DM = new DistortionMap();
     DM.Deserialize(Settings.Default.SettingsString);
     CalculationProperyGrid.SelectedObject = DM;
 }