Пример #1
0
            public override bool Draw(IRichPane rp)
            {
                if (IsMasking)
                {
                    var sr = rp.GetPaneRect();
                    rp.Graphics.DrawString("PAUSE", _font, Brushes.DarkGray, sr.LT.X + 48, sr.RB.Y - 42);
                }
                else
                {
                    // Left side RED curtain
                    var sr  = rp.GetPaneRect();
                    var W   = 240;
                    var rc1 = ScreenRect.FromLTWH(sr.LT.X, sr.LT.Y, W, sr.Height);
                    rp.Graphics.FillRectangle(new LinearGradientBrush(new Point(0, 0), new PointF(W, 0), Color.FromArgb(128, 255, 0, 0), Color.FromArgb(0, 255, 0, 0)), rc1);

                    // Now pointer RED curtain
                    var now = DateTime.Now;
                    now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
                    var rc2 = GetScRect(rp, CodeRect.FromLTRB((int)(now - Hot.FirstSpeech).TotalSeconds, 0, 0, 0));
                    rc2 = ScreenRect.FromLTRB(rc2.LT.X, sr.LT.Y, sr.RB.X, sr.RB.Y);
                    rp.Graphics.FillRectangle(new LinearGradientBrush(new Point(rc2.LT.X, rc2.LT.Y), new PointF(rc2.RB.X, rc2.RB.Y), Color.FromArgb(8, 255, 0, 0), Color.FromArgb(96, 255, 0, 0)), rc2);

                    // REC LABEL
                    if (++_cnt % 2 == 0)
                    {
                        rp.Graphics.DrawString("REC", _font, Brushes.Yellow, sr.LT.X + 48, sr.RB.Y - 42);
                    }
                }
                return(true);
            }
Пример #2
0
        /// <summary>
        /// Draw 7-seg image
        /// </summary>
        /// <param name="dp"></param>
        /// <param name="format"></param>
        /// <remarks>
        /// Format:
        /// 0-9 ... draw number
        /// *   ... draw Dark 8
        /// .   ... draw Dot at last position
        /// ,   ... draw Dot at last position (dark)
        /// :   ... draw colon
        /// ;   ... draw colon(dark)
        /// !   ... draw half space
        /// _   ... draw space
        /// \b  ... back space (1/4)
        /// </remarks>
        public void Draw(DrawProperty dp, string format, ScreenPos pos, ScreenY height)
        {
            if (LoadStatus != 1)
            {
                return;
            }
            var x   = ScreenX.From(0);
            var sz0 = ScreenSize.From(Bitmaps['*'].SizeInPixels.Width, Bitmaps['*'].SizeInPixels.Height);
            var z   = height / sz0.Height;
            var sz  = sz0 * z;
            var sr  = ScreenRect.FromLTWH(0, 0, sz.Width, sz.Height);

            foreach (var c in format)
            {
                if (SpaceAdjust.TryGetValue(c, out var adjust))
                {
                    x += sz.Width * adjust;
                }
                var bmp = Bitmaps.GetValueOrDefault(c, null);
                if (bmp != null)
                {
                    dp.Graphics.DrawImage(bmp, _(sr + pos + x));
                }
                x += sz.Width;
            }
        }