Ejemplo n.º 1
0
        public void Initialize(double[] data, int width, int height, IColorTable colorTable, IColorMap colorMap)
        {
            // set members
            _width   = width;
            _height  = height;
            _rawData = data;

            // set default for this
            _invalidPixelValueColor = Color.White;

            // allocate image buffer
            _data = new int[width * height];

            // set color table now, we need it during raw buffer creation
            // TODO: throw if null, initialize?
            _colorTable = colorTable;

            // create color map
            if (colorMap != null)
            {
                _colorMap = colorMap;
            }
            else
            {
                _colorMap = ColorMapFactory.Create(ColorMapTypes.Gray);
                _colorMap.Initialize();
                _colorMap.Bias     = 0.5;
                _colorMap.Contrast = 1;
            }

            // create raw image buffer.
            // separating this will  add more granularity saving time if we want to rebuild
            // since we dont want to recalc extremes again...etc
            CreateRawImageBuffer();
        }
Ejemplo n.º 2
0
        static public IColorTable FromFile(string path)
        {
            IColorTable ct = null;
            XmlReader   r  = null;

            try
            {
                r = XmlReader.Create(path);
                r.ReadToFollowing("ColorTable");
                ColorTableType    ctt = (ColorTableType)Enum.Parse(typeof(ColorTableType), r["Type"]);
                int               cts = int.Parse(r["Size"]);
                ScalingAlgorithms sa  = (ScalingAlgorithms)Enum.Parse(typeof(ScalingAlgorithms), r["Scale"]);
                double            min = double.Parse(r["Minimum"]);
                double            max = double.Parse(r["Maximum"]);
                ct = ColorTableFactory.Create(ctt);
                if (ct != null)
                {
                    ct.ScalingAlgorithm = ScalingAlgorithmFactory.Create(sa);
                    ct.Initialize(cts, min, max);
                }
            }
            finally
            {
                if (r != null)
                {
                    r.Close();
                }
            }
            return(ct);
        }
Ejemplo n.º 3
0
        private void ResetColorTable()
        {
            IColorTable ct = ColorTableFactory.Create(_modelState.ColorTable.Type);

            ct.Initialize(1 << _modelState.ColorTable.Depth, _modelState.PixelMinimum, _modelState.PixelMaximum);
            ct.ScalingAlgorithm = ScalingAlgorithmFactory.Create(_modelState.ColorTable.ScalingAlgorithmType);
            _colorTable         = ct;
        }
Ejemplo n.º 4
0
 public ColorTheme(
     ISystemThemeDetector systemThemeDetector,
     LogJoint.Settings.IGlobalSettingsAccessor settings
     )
 {
     this.systemThemeDetector = systemThemeDetector;
     this.threadColors        = new LogThreadsColorsTable(this, () => settings.Appearance.ColoringBrightness);
     this.highlightingColors  = new HighlightBackgroundColorsTable(this);
 }
Ejemplo n.º 5
0
 public Presenter(
     IFiltersList filtersList,
     IView view,
     FilterDialog.IPresenter filtersDialogPresenter,
     IColorTable highlightColorsTable
     )
 {
     this.filtersList            = filtersList;
     this.view                   = view;
     this.filtersDialogPresenter = filtersDialogPresenter;
     this.highlightColorsTable   = highlightColorsTable;
     view.SetPresenter(this);
 }
Ejemplo n.º 6
0
 public Presenter(
     ILogSourcesManager logSources,
     IFiltersList filtersList,
     IView view,
     IColorTable highlightColorsTable
     )
 {
     this.logSources           = logSources;
     this.view                 = view;
     this.highlightColorsTable = highlightColorsTable;
     this.actionsOptions       = MakeActionsOptions(filtersList.Purpose, highlightColorsTable);
     this.scopeSupported       = filtersList.Purpose == FiltersListPurpose.Highlighting;
     view.SetEventsHandler(this);
 }
Ejemplo n.º 7
0
            /// <summary>Creates new color table based on existing color table.</summary>
            /// <param name="colorTable">Color table to copy colors from.</param>
            /// <exception cref="ArgumentNullException"><paramref name="colorTable"/> == <c>null</c>.</exception>
            public CustomColorTable(IColorTable colorTable)
            {
                Verify.Argument.IsNotNull(colorTable, "colorTable");

                Background    = colorTable.Background;
                ArrowNormal   = colorTable.ArrowNormal;
                ArrowHover    = colorTable.ArrowHover;
                ArrowPressed  = colorTable.ArrowPressed;
                ArrowDisabled = colorTable.ArrowDisabled;
                ThumbNormal   = colorTable.ThumbNormal;
                ThumbHover    = colorTable.ThumbHover;
                ThumbPressed  = colorTable.ThumbPressed;
                ThumbDisabled = colorTable.ThumbDisabled;
            }
Ejemplo n.º 8
0
        public static IColorTable Create(ColorTableType ctt)
        {
            IColorTable ct = null;

            switch (ctt)
            {
            case ColorTableType.ReducedColors:
                ct = new ReducedColorTable();
                break;

            case ColorTableType.FullScale:
                ct = new FullScaledColorTable();
                break;

            case ColorTableType.Indexed:
                ct = new IndexedColorTable();
                break;
            }
            return(ct);
        }
Ejemplo n.º 9
0
        static public IImage FromFile(string nicFile)
        {
            IImage       ii  = null;
            StreamReader sr  = null;
            XmlReader    r   = null;
            ImageTypes   it  = ImageTypes.Indexed;
            Color        nan = Color.Empty;

            try
            {
                sr = new StreamReader(nicFile);
                r  = XmlReader.Create(sr.BaseStream);
                r.ReadToFollowing("ImageConfig");
                it             = (ImageTypes)Enum.Parse(typeof(ImageTypes), r["Type"]);
                nan            = Color.FromArgb(int.Parse(r["NaNColor"]));
                r.Close(); r   = null;
                sr.Close(); sr = null;
                IColorTable ct = ColorTableFactory.FromFile(nicFile);
                IColorMap   cm = ColorMapFactory.FromFile(nicFile);
                ii = ImageFactory.Create(it);
                if (ii != null)
                {
                    ii.ColorTable             = ct;
                    ii.ColorMap               = cm;
                    ii.InvalidPixelValueColor = nan;
                }
            }
            finally
            {
                if (r != null)
                {
                    r.Close();
                }
                if (sr != null)
                {
                    sr.Close();
                }
            }

            return(ii);
        }
Ejemplo n.º 10
0
        public MSVS2012CheckBoxRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, "colorTable");

            _colorTable = colorTable;
        }
Ejemplo n.º 11
0
        public MSVS2012CustomListBoxRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, nameof(colorTable));

            _colorTable = colorTable;
        }
Ejemplo n.º 12
0
 public static Color GetByIndex(this IColorTable table, int index)
 {
     return(GetByIndex(table.Items, index));
 }
Ejemplo n.º 13
0
        public MSVS2012ScrollBarRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, "colorTable");

            _colorTable = colorTable;
        }
Ejemplo n.º 14
0
        public MSVS2012CheckBoxRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, "colorTable");

            _colorTable = colorTable;
        }
Ejemplo n.º 15
0
        public MSVS2012ButtonRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, nameof(colorTable));

            _colorTable = colorTable;
        }
Ejemplo n.º 16
0
        public MSVS2012StyleToolStripRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, "colorTable");

            _colorTable = colorTable;
        }
Ejemplo n.º 17
0
            /// <summary>Creates new color table based on existing color table.</summary>
            /// <param name="colorTable">Color table to copy colors from.</param>
            /// <exception cref="ArgumentNullException"><paramref name="colorTable"/> == <c>null</c>.</exception>
            public CustomColorTable(IColorTable colorTable)
            {
                Verify.Argument.IsNotNull(colorTable, "colorTable");

                Background		= colorTable.Background;
                ArrowNormal		= colorTable.ArrowNormal;
                ArrowHover		= colorTable.ArrowHover;
                ArrowPressed	= colorTable.ArrowPressed;
                ArrowDisabled	= colorTable.ArrowDisabled;
                ThumbNormal		= colorTable.ThumbNormal;
                ThumbHover		= colorTable.ThumbHover;
                ThumbPressed	= colorTable.ThumbPressed;
                ThumbDisabled	= colorTable.ThumbDisabled;
            }
Ejemplo n.º 18
0
        static List <Tuple <FilterAction, string, Color?> > MakeActionsOptions(FiltersListPurpose purpose, IColorTable highlightColorsTable)
        {
            var actionOptions = new List <Tuple <FilterAction, string, Color?> >();

            string excludeDescription;

            if (purpose == FiltersListPurpose.Highlighting)
            {
                excludeDescription = "Exclude from highlighting";
            }
            else if (purpose == FiltersListPurpose.Search)
            {
                excludeDescription = "Exclude from search results";
            }
            else
            {
                excludeDescription = "Exclude";
            }
            actionOptions.Add(Tuple.Create(FilterAction.Exclude, excludeDescription, new Color?()));

            if (purpose == FiltersListPurpose.Search)
            {
                actionOptions.Add(Tuple.Create(FilterAction.Include, "Include to search result", new Color?()));
            }

            string includeAndColorizeFormat;

            if (purpose == FiltersListPurpose.Highlighting)
            {
                includeAndColorizeFormat = " Highlight with color #{0} ";
            }
            else if (purpose == FiltersListPurpose.Search)
            {
                includeAndColorizeFormat = " Include to search result and highlight with color #{0} ";
            }
            else
            {
                includeAndColorizeFormat = " Include and highlight with color #{0} ";
            }

            for (var a = FilterAction.IncludeAndColorizeFirst; a <= FilterAction.IncludeAndColorizeLast; ++a)
            {
                actionOptions.Add(Tuple.Create(a,
                                               string.Format(includeAndColorizeFormat, a - FilterAction.IncludeAndColorizeFirst + 1),
                                               a.ToColor(highlightColorsTable.Items)));
            }

            return(actionOptions);
        }
Ejemplo n.º 19
0
 public TemporaryColorTheme(IColorTheme appTheme, IChangeNotification changeNotification)
 {
     this.appTheme           = appTheme;
     this.changeNotification = changeNotification;
     this.threadsColorTable  = new LogThreadsColorsTable(this, () => paletteBrightness);
 }
Ejemplo n.º 20
0
        public MSVS2012StyleToolStripRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, "colorTable");

            _colorTable = colorTable;
        }
Ejemplo n.º 21
0
 public ModelThreads(IColorTable colors)
 {
     this.colors = colors;
 }
 public IColorTableObject(IColorTable IColorTableinstance)
 {
     IColorTableInstance = IColorTableinstance;
 }
Ejemplo n.º 23
0
 public AdjustingColorsGenerator(IColorTable innerTable, PaletteBrightness paletteBrightness)
 {
     this.innerTable        = innerTable;
     this.paletteBrightness = paletteBrightness;
 }
Ejemplo n.º 24
0
        public MSVS2012ScrollBarRenderer(IColorTable colorTable)
        {
            Verify.Argument.IsNotNull(colorTable, "colorTable");

            _colorTable = colorTable;
        }