Пример #1
0
        /// <summary>
        /// Draws a "score" indicator on the left edge of an event.
        /// </summary>
        /// <param name="event">The event for which to draw the score indicator.</param>
        /// <param name="graphics">The image context to draw to.</param>
        /// <param name="options">The event rendering options to use.</param>
        public static void DrawScoreIndicator(this SpectralEvent @event, IImageProcessingContext graphics, EventRenderingOptions options)
        {
            if (!options.DrawScore)
            {
                return;
            }

            var normalizedScore = @event.ScoreNormalized.Clamp(0, 1);

            if (normalizedScore == 0 || double.IsNaN(normalizedScore))
            {
                return;
            }

            var rect = options.Converters.GetPixelRectangle(@event);

            // truncate score bar to neatest whole pixel after scaling by height
            var scaledHeight = (int)((float)normalizedScore * rect.Height);

            var top    = new PointF(rect.Left, rect.Bottom - scaledHeight);
            var bottom = new PointF(rect.Left, rect.Bottom);

            // the order of the supplied points is important!
            // DO NOT CHANGE
            graphics.NoAA().DrawLines(options.Score, top, bottom);
        }
Пример #2
0
        public override void Draw(IImageProcessingContext graphics, EventRenderingOptions options)
        {
            // simply draw a full-height lines either side of the vent
            var startPixel = options.Converters.SecondsToPixels(this.EventStartSeconds);

            graphics.NoAA().DrawLines(
                options.Border,
                new PointF(startPixel, 0),
                new PointF(startPixel, graphics.GetCurrentSize().Height));

            var endPixel = options.Converters.SecondsToPixels(this.EventEndSeconds);

            graphics.NoAA().DrawLines(
                options.Border,
                new PointF(endPixel, 0),
                new PointF(endPixel, graphics.GetCurrentSize().Height));
        }
Пример #3
0
        //public double Duration => base.Duration;

        public override void Draw(IImageProcessingContext graphics, EventRenderingOptions options)
        {
            // draw a border around this event
            var border = options.Converters.GetPixelRectangle(this);

            graphics.NoAA().DrawBorderInset(options.Border, border);

            // draw event title
            // TODO
        }
Пример #4
0
        public override void Draw(IImageProcessingContext graphics, EventRenderingOptions options)
        {
            // draw a border around this event
            if (options.DrawBorder)
            {
                var border = options.Converters.GetPixelRectangle(this);
                graphics.NoAA().DrawBorderInset(options.Border, border);
            }

            this.DrawScoreIndicator(graphics, options);

            this.DrawEventLabel(graphics, options);
        }