Example #1
0
        public override System.Drawing.Bitmap toImage(int width, int height)
        {
            IMultiColorable mc = _parent as IMultiColorable;

            if (mc != null)
            {
                if (((mc.ColorMapper != null)))
                {
                    // setup generator
                    ColorbarImageGenerator bar = new ColorbarImageGenerator(mc.ColorMapper, _provider, _renderer);
                    if (((_foreground != null)))
                    {
                        bar.ForegroundColor = _foreground;
                    }
                    else
                    {
                        bar.ForegroundColor = Color.BLACK;
                    }
                    if (((_background != null)))
                    {
                        bar.BackgroundColor = _background;
                        bar.HasBackground   = true;
                    }
                    else
                    {
                        bar.HasBackground = false;
                    }
                    // render @ given dimensions
                    return(bar.toImage(Math.Max(width - 25, 1), Math.Max(height - 25, 1)));
                }
            }
            return(null);
        }
Example #2
0
        internal MultiColorableHelper(IMultiColorable multiColorableInstance)
        {
            Guard.ThrowIfNull(multiColorableInstance, nameof(multiColorableInstance));

            _multiColorableInstance = multiColorableInstance;
        }