Exemple #1
0
 private static Vector <byte>[,] Undecimate(Vector <byte>[,] map, DecimationType decimationType)
 {
     if (decimationType == DecimationType.NoDecimation)
     {
         return(map);
     }
     if (decimationType == DecimationType.Horizontal)
     {
         var result = new Vector <byte> [map.GetLength(0), map.GetLength(1) * 2];
         for (var i = 0; i < map.GetLength(0); ++i)
         {
             for (var j = 0; j < map.GetLength(1); ++j)
             {
                 result[i, j * 2] = result[i, j * 2 + 1] = map[i, j];
             }
         }
         return(result);
     }
     else if (decimationType == DecimationType.Vertical)
     {
         var result = new Vector <byte> [map.GetLength(0) * 2, map.GetLength(1)];
         for (var i = 0; i < map.GetLength(0); ++i)
         {
             for (var j = 0; j < map.GetLength(1); ++j)
             {
                 result[i * 2, j] = result[i * 2 + 1, j] = map[i, j];
             }
         }
         return(result);
     }
     else
     {
         var result = new Vector <byte> [map.GetLength(0) * 2, map.GetLength(1) * 2];
         for (var i = 0; i < map.GetLength(0); ++i)
         {
             for (var j = 0; j < map.GetLength(1); ++j)
             {
                 result[i * 2, j * 2] = result[i * 2, j * 2 + 1] = result[i * 2 + 1, j * 2] = result[i * 2 + 1, j * 2 + 1] = map[i, j];
             }
         }
         return(result);
     }
 }
 //----> Decimation modification routines
 private void DecimationType_Checked(object sender, RoutedEventArgs e)
 {
     MenuItem mi = (MenuItem)sender;
     if (mi.Tag == null) return; //before fully initialized
     DecimationType dT = (DecimationType)Convert.ToInt32(mi.Tag);
     if (dT == dType) return;
     dType = dT;
     if (decVal != 0)
     {
         ChannelGraph.decimateOld = -1; //force complete redraw
         DecimationInfo.Text = (string)mi.Header;
         reDrawChannels();
     }
 }