DrawPoint() public method

public DrawPoint ( int x, int y ) : void
x int
y int
return void
Ejemplo n.º 1
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            for (int y = 0; y < lines.Count; y++)
            {
                if (y >= Height)
                {
                    break;
                }

                var line = lines[y];

                for (int x = 0; x < line.Count && x < Width; x++)
                {
                    context.Pen = HasFocus ? new ConsoleCharacter(line[x].Value, DefaultColors.FocusContrastColor, DefaultColors.FocusColor) : line[x];
                    context.DrawPoint(x, y);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Paints the progress bar
        /// </summary>
        /// <param name="context"></param>
        protected override void OnPaint(ConsoleBitmap context)
        {
            var loadProgressPixels = (int)(0.5 + (LoadProgressPosition * Width));
            var playCursorOffset   = (int)(0.5 + (PlayCursorPosition * Width));

            if (playCursorOffset == Width)
            {
                playCursorOffset--;
            }

            // draws the loading progress
            context.FillRect(new ConsoleCharacter(' ', null, LoadingProgressColor), 0, 0, loadProgressPixels, 1);

            if (ShowPlayCursor)
            {
                // draws the play cursor
                context.DrawPoint(new ConsoleCharacter(' ', null, PlayCursorColor), playCursorOffset, 0);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Draws the bitmap
 /// </summary>
 /// <param name="context">the pain context</param>
 protected override void OnPaint(ConsoleBitmap context)
 {
     if (Bitmap == null)
     {
         return;
     }
     for (var x = 0; x < Bitmap.Width && x < this.Width; x++)
     {
         for (var y = 0; y < Bitmap.Height && y < this.Height; y++)
         {
             var pixel = Bitmap.GetPixel(x, y).Value;
             if (pixel.HasValue)
             {
                 context.Pen = pixel.Value;
                 context.DrawPoint(x, y);
             }
         }
     }
 }
Ejemplo n.º 4
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            var           fullSize          = ScrollableContentSize;
            ConsoleBitmap fullyPaintedPanel = new ConsoleBitmap(0, 0, fullSize.Width, fullSize.Height);

            ScrollableContent.PaintTo(fullyPaintedPanel);

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    int scrollX = x + HorizontalScrollUnits;
                    int scrollY = y + VerticalScrollUnits;

                    if (scrollX >= fullyPaintedPanel.Width || scrollY >= fullyPaintedPanel.Height)
                    {
                        continue;
                    }

                    var scrolledPixel = fullyPaintedPanel.GetPixel(scrollX, scrollY);

                    if (scrolledPixel.Value.HasValue)
                    {
                        context.Pen = scrolledPixel.Value.Value;
                    }
                    else
                    {
                        context.Pen = new ConsoleCharacter(' ', backgroundColor: Background);
                    }

                    context.DrawPoint(x, y);
                }
            }

            base.OnPaint(context);
        }
Ejemplo n.º 5
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            ScrollableContent.Paint();

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    int scrollX = x + HorizontalScrollUnits;
                    int scrollY = y + VerticalScrollUnits;

                    if (scrollX >= ScrollableContent.Width || scrollY >= ScrollableContent.Height)
                    {
                        continue;
                    }

                    var scrolledPixel = ScrollableContent.Bitmap.GetPixel(scrollX, scrollY);

                    if (scrolledPixel.Value.HasValue)
                    {
                        context.Pen = scrolledPixel.Value.Value;
                    }
                    else
                    {
                        context.Pen = new ConsoleCharacter(' ', backgroundColor: Background);
                    }

                    context.DrawPoint(x, y);
                }
            }

            verticalScrollbar.Paint();
            horizontalScrollbar.Paint();
            DrawScrollbar(verticalScrollbar, context);
            DrawScrollbar(horizontalScrollbar, context);
        }
Ejemplo n.º 6
0
 protected override void OnPaint(ConsoleBitmap context)
 {
     base.OnPaint(context);
     context.Pen = Value;
     context.DrawPoint(0, 0);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// paints the text box
        /// </summary>
        /// <param name="context"></param>
        protected override void OnPaint(ConsoleBitmap context)
        {
            var toPaint = textState.CurrentValue;
            var bgTransformed = new List<ConsoleCharacter>();

            foreach(var c in toPaint)
            {
                if(c.BackgroundColor == ConsoleString.DefaultBackgroundColor && Background != ConsoleString.DefaultBackgroundColor)
                {
                    bgTransformed.Add(new ConsoleCharacter(c.Value, Foreground, Background));
                }
                else
                {
                    bgTransformed.Add(c);
                }
            }

            context.DrawString(new ConsoleString(bgTransformed), 0, 0);

            if (blinkState)
            {
                char blinkChar = textState.CursorPosition >= toPaint.Length ? ' ' : toPaint[textState.CursorPosition].Value;
                context.Pen = new ConsoleCharacter(blinkChar, Application.Theme.FocusContrastColor, Application.Theme.FocusColor);
                context.DrawPoint(textState.CursorPosition, 0);
            }
        }
Ejemplo n.º 8
0
 protected override void OnPaint(ConsoleBitmap context)
 {
     base.OnPaint(context);
     context.Pen = Value;
     context.DrawPoint(0,0);
 }
Ejemplo n.º 9
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            var fullSize = ScrollableContentSize;
            ConsoleBitmap fullyPaintedPanel = new ConsoleBitmap(0, 0, fullSize.Width, fullSize.Height);
            ScrollableContent.PaintTo(fullyPaintedPanel);

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    int scrollX = x + HorizontalScrollUnits;
                    int scrollY = y + VerticalScrollUnits;

                    if (scrollX >= fullyPaintedPanel.Width || scrollY >= fullyPaintedPanel.Height)
                    {
                        continue;
                    }

                    var scrolledPixel = fullyPaintedPanel.GetPixel(scrollX, scrollY);

                    if (scrolledPixel.Value.HasValue)
                    {
                        context.Pen = scrolledPixel.Value.Value;
                    }
                    else
                    {
                        context.Pen = new ConsoleCharacter(' ', backgroundColor: Background);
                    }

                    context.DrawPoint(x, y);
                }
            }

            base.OnPaint(context);
        }
Ejemplo n.º 10
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            for(int y = 0; y < lines.Count; y++)
            {
                if(y >= Height)
                {
                    break;
                }

                var line = lines[y];

                for(int x = 0; x < line.Count && x < Width; x++)
                {
                    context.Pen = HasFocus ? new ConsoleCharacter(line[x].Value, Application.Theme.FocusContrastColor, Application.Theme.FocusColor) : line[x];
                    context.DrawPoint(x, y);
                }
            }
        }