コード例 #1
0
        public static PaletteColors From(IBitmapHelper bitmapHelper)
        {
            var paletteBuilder = new PaletteBuilder();
            var palette        = paletteBuilder.Generate(bitmapHelper);

            return(new PaletteColors(palette));
        }
コード例 #2
0
        /// <summary>
        /// Generate and return the Palette synchronously.
        /// </summary>
        /// <returns></returns>
        public Palette Generate(IBitmapHelper bitmapHelper)
        {
            if (bitmapHelper == null)
            {
                throw new ArgumentNullException("IBitmapHelper is not valid");
            }

            var pixels = bitmapHelper.ScaleDownAndGetPixels();
            ColorCutQuantizer quantizer = new ColorCutQuantizer(
                pixels,
                mMaxColors,
                (mFilters.Count == 0) ? null : mFilters.ToArray());

            var swatches = quantizer.GetQuantizedColors();

            Palette palette = new Palette(swatches, mTargets);

            palette.Generate();
            return(palette);
        }
コード例 #3
0
        public MainWindow(INAudioHelper naHelper, BitmapHelper waveImage)
        {
            InitializeComponent();

            _nauHelper = naHelper;
            _bmpHelper = waveImage;

            dragPnl.MouseLeftButtonDown += (s, e) => DragMove();
            me1.MediaOpened             += mediaOpened;
            me1.MediaFailed             += mediaFailed;
            me1.MediaEnded += mediaEnded;
            Loaded         += onLoaded;
            KeyDown        += (s, e) =>
            {
                TimeSpan step =
                    e.KeyboardDevice.Modifiers == ModifierKeys.Alt ? TimeSpan.FromMilliseconds(100000) :
                    e.KeyboardDevice.Modifiers == ModifierKeys.None ? TimeSpan.FromMilliseconds(1000) :
                    e.KeyboardDevice.Modifiers == ModifierKeys.Shift ? TimeSpan.FromMilliseconds(100) :
                    e.KeyboardDevice.Modifiers == ModifierKeys.Control ? TimeSpan.FromMilliseconds(10000) :
                    e.KeyboardDevice.Modifiers == ModifierKeys.Windows ? TimeSpan.FromMilliseconds(1000) : TimeSpan.FromMilliseconds(1000);
                switch (e.Key)
                {
                case Key.Space: onTglPlay(s, e); break;

                case Key.Escape: Close(); Application.Current.Shutdown(); break;

                case Key.Left: me1.Position = me1.Position.Add(-step); break;

                case Key.Right: me1.Position = me1.Position.Add(step); break;
                }
            };

            _progMover = new DispatcherTimer(TimeSpan.FromSeconds(.02), DispatcherPriority.Normal, new EventHandler((s, e) => onPbMover()), Dispatcher.CurrentDispatcher);
            _resettter = new DispatcherTimer(TimeSpan.FromSeconds(2), DispatcherPriority.Background, new EventHandler((s, e) => onBackToPositionA(s, null)), Dispatcher.CurrentDispatcher); //tu: one-line timer
            _resettter.Stop();
            if (Debugger.IsAttached)
            {
                Topmost = true;
            }
        }
コード例 #4
0
ファイル: FloatingWindow.cs プロジェクト: Zoomicon/ZUI
        /// <summary>
        /// Initializes a new instance of the <see cref="FloatingWindow" /> class.
        /// </summary>
        public FloatingWindow()
        {
            DefaultStyleKey = typeof(FloatingWindow);

            resizeController = new ResizeController(this);
            resizeController.ResizingArea = ResizingAreaThickness;
            snapinController = new SnapinController();
            inertiaController = new InertiaController();
            localStorage = new LocalStorage();
            bitmapHelper = new BitmapHelper();

            this.SetVisible(false);
        }