예제 #1
0
        static void canvas_EvRedraw(object sender, RedrawEventArgs e)
        {
            var p = e.Painter;

            p.Clear(0);


            Ellipse2d el1 = new Ellipse2d(new Point2d(mousex, mousey), 200, 5, 1.0);
            Ellipse2d el2 = new Ellipse2d(new Point2d(400, 500), 300, 5, -1);

            p.Color = RGB.Red;
            p.DrawEllipse(el1.Center.X, el1.Center.Y, el1.MajorRadius, el1.MinorRadius, el1.Rotation);
            p.Color = RGB.Green;
            p.DrawEllipse(el2.Center.X, el2.Center.Y, el2.MajorRadius, el2.MinorRadius, el2.Rotation);


            var intpts = Intersect2d.EllipseEllipse(el1, el2);


            if (intpts != null)
            {
                p.Color = RGB.Yellow;
                foreach (Point2d pt in intpts)
                {
                    p.DrawMark(pt.X, pt.Y, MarkType.DiagonalCross, 10);
                }
            }
        }
예제 #2
0
        protected void OnRedraw(Object sender, RedrawEventArgs e)
        {
            logger.Trace("OnRedraw() received...");

            // TODO 3: [performance] invalidate only what really changed (could be tricky)
            Invalidate();
        }
예제 #3
0
 protected virtual void OnPaint(RedrawEventArgs e)
 {
     if (Paint != null)
     {
         Paint(this, e);
     }
 }
예제 #4
0
        protected void RaiseRedrawEvent(RedrawEventArgs e)
        {
            logger.Trace("Raising redraw event...");

            EventHandler <RedrawEventArgs> handler = Redraw;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #5
0
        void OnDrawAreaRedraw(object sender, RedrawEventArgs e)
        {
            if (redraw_backbuffer)
            {
                if (!RedrawBackbuffer(e.Painter))
                {
                    return;                                                                        //no active drawing
                }
                screen_dirty = new Rectangle2i(0, 0, backbuffer.Width - 1, backbuffer.Height - 1); //entire screen is now dirty
            }

            RedrawOverlay();
        }
예제 #6
0
        private void Redraw(object sender, RedrawEventArgs e)
        {
            // if there's an area to redraw, redraw it
            // otherwise redraw the entire buffer
            if (e != null && e.HasArea)
            {
                Draw(e.Area.Left, e.Area.Top, e.Area.Width, e.Area.Height);
            }
            else
            {
                Draw();
            }

            this.Console.SetCursorPosition(0, 0);
        }
예제 #7
0
            protected virtual void OnRedraw(RedrawEventArgs e)
            {
                // Start the redraw. Given the window handle, the OS fills in RedrawWimpBlock
                // with details of what needs redrawing.
                int more = Wimp.RedrawWindow(ref e.Redraw);

                // The origin of the window only needs to be calculated once before entering
                // the redraw loop.
                e.Origin = WimpWindow.GetOrigin(ref e.Redraw.Visible,
                                                ref e.Redraw.Scroll);
                while (more != 0)
                {
                    OnPaint(e);
                    more = Wimp.GetRectangle(ref e.Redraw);
                }
            }