コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();

            NoteType.Items.Add(new KeyValuePair <string, double>("Full", 4));
            NoteType.Items.Add(new KeyValuePair <string, double>("1/2", 2));
            NoteType.Items.Add(new KeyValuePair <string, double>("1/4", 1));
            NoteType.Items.Add(new KeyValuePair <string, double>("1/8", 0.5));
            NoteType.Items.Add(new KeyValuePair <string, double>("1/16", 0.25));
            NoteType.Items.Add(new KeyValuePair <string, double>("1/32", 0.128));
            NoteType.Items.Add(new KeyValuePair <string, double>("1/64", 0.064));
            NoteType.SelectedIndex = 4;

            NoteCenter.Items.Add("Eb5");
            NoteCenter.Items.Add("C4");
            NoteCenter.Items.Add("C3");
            NoteCenter.Items.Add("C2");
            NoteCenter.SelectedIndex = 2;

            Uri iconUri = new Uri("pack://application:,,,/ImageToMidi.ico", UriKind.RelativeOrAbsolute);

            this.Icon = BitmapFrame.Create(iconUri);

            image.Source = this.Icon;
            bitmap       = PixelMidi.ImageSourceToBitmap(this.Icon as BitmapSource);
        }
コード例 #2
0
 internal void LoadImage(BitmapSource source)
 {
     if (source is BitmapSource)
     {
         bitmap       = PixelMidi.ImageSourceToBitmap(source as BitmapSource);
         image.Source = PixelMidi.BitmapToImageSource(PixelMidi.GrayScale(bitmap));
     }
 }
コード例 #3
0
        internal void LoadImage(Uri url)
        {
            try
            {
                if (url is Uri)
                {
                    BitmapImage img = new BitmapImage();
                    img.BeginInit();
                    img.UriSource   = url;
                    img.CacheOption = BitmapCacheOption.OnLoad;
                    img.EndInit();

                    if (img is BitmapSource)
                    {
                        bitmap       = PixelMidi.ImageSourceToBitmap(img as BitmapSource);
                        image.Source = PixelMidi.BitmapToImageSource(PixelMidi.GrayScale(bitmap));
                    }
                }
            }
            catch (Exception) { }
        }