public void GetColorContrastCalculator_OptionsSpecifyV2_ReturnsV2()
        {
            ConfigureConfigMockForAzalyzerVersion(AnalyzerVersion.V2);
            BitmapCollection collection = new BitmapCollection(null, _configMock.Object);

            Assert.AreEqual(collection.RunColorContrastCalculationV2,
                            collection.GetColorContrastCalculator());
            VerifyAllMocks();
        }
Beispiel #2
0
        private void RunAutoCCA(Bitmap bitmap)
        {
            var bmc    = new BitmapCollection(bitmap);
            var result = bmc.RunColorContrastCalculation();
            var pair   = result.GetMostLikelyColorPair();

            this.ContrastVM.FirstColor  = pair.DarkerColor.DrawingColor.ToMediaColor();
            this.ContrastVM.SecondColor = pair.LighterColor.DrawingColor.ToMediaColor();
            tbConfidence.Text           = result.ConfidenceValue().ToString();
        }
        private void RunAutoCCA(Bitmap bitmap)
        {
            var bmc    = new BitmapCollection(bitmap);
            var result = bmc.RunColorContrastCalculation();
            var pair   = result.MostLikelyColorPair;

            if (pair == null)
            {
                throw new InvalidOperationException("Unable to determine colors!");
            }

            this.ContrastVM.FirstColor  = pair.DarkerColor.DrawingColor.ToMediaColor();
            this.ContrastVM.SecondColor = pair.LighterColor.DrawingColor.ToMediaColor();
            tbConfidence.Text           = result.ConfidenceValue().ToString();
        }
Beispiel #4
0
        /// <summary>
        /// Register a palette
        /// </summary>
        /// <param name="p"></param>
        /// <param name="doubleClick"></param>
        private Palette AddPalette(BitmapCollection collection, RoutedCommand doubleClick = null)
        {
            Palette p = new Palette(collection);

            if (doubleClick != null)
            {
                p.DefaultDoubleClick = doubleClick;
            }
            p.OnThumbnailSelected += event_ThumbnailSelected;

            if (Palettes == null)
            {
                Palettes = new ObservableCollection <Palette>();
            }
            Palettes.Add(p);
            return(p);
        }
 /// <summary>
 /// Callback event to add thumbnail when the underlying collection adds an item
 /// </summary>
 /// <param name="collection"></param>
 /// <param name="item"></param>
 void palette_itemAdded(BitmapCollection collection, BitmapType item)
 {
     AddThumbnail(item);
 }
 public Palette(BitmapCollection collection)
     : base()
 {
     Bitmaps = collection;
 }
        /// <summary>
        /// Callback event to remove the thumbnail when the underlying collection removes an item
        /// </summary>
        /// <param name="collection"></param>
        /// <param name="item"></param>
        void palette_itemRemoved(BitmapCollection collection, BitmapType item)
        {
            Thumbnail thumb = FindThumbnail(item);

            RemoveThumbnail(thumb);
        }