Exemplo n.º 1
0
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            UpdateTimer();
            Update();

            // Clear to the default control background color.
            //Color backColor = new Color(BackColor.R, BackColor.G, BackColor.B);
            Microsoft.Xna.Framework.Color backColor = Microsoft.Xna.Framework.Color.LightCyan;

            GraphicsDevice.Clear(backColor);

            if (XnaGraphics != null && DrawingContext != null && Texture != null && SpriteFont != null)
            {
                PDebug.StartProcessingOutput();

                // Clear the invalidatedBounds cache.
                invalidatedBounds = RectangleFx.Empty;

                PPaintContext paintContext = new PPaintContext(XnaGraphics, this);
                PaintPiccolo(paintContext);

                // Calling the base class OnPaint
                //base.OnPaint(pe);

                PDebug.EndProcessingOutput(paintContext);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Overridden.  See <see cref="Control.OnPaint">Control.OnPaint</see>.
        /// </summary>
        protected override void OnPaint(PaintEventArgs pe)
        {
            PDebug.StartProcessingOutput();

            Graphics2D g = new Graphics2D(offscreenGraphics);

            g.Clip = new Region(pe.ClipRectangle);
            //Graphics2D g = new Graphics2D(pe.Graphics);

            // create new paint context and set render quality to lowest common
            // denominator render quality.
            //Rectangle clipRect = pe.ClipRectangle;
            //RectangleF fClipRect = new RectangleF(clipRect.X, clipRect.Y, clipRect.Width, clipRect.Height);
            PPaintContext paintContext = new PPaintContext(g, this);

            if (Interacting || Animating)
            {
                if (interactingRenderQuality < animatingRenderQuality)
                {
                    paintContext.RenderQuality = interactingRenderQuality;
                }
                else
                {
                    paintContext.RenderQuality = animatingRenderQuality;
                }
            }
            else
            {
                paintContext.RenderQuality = defaultRenderQuality;
            }

            // paint
            camera.FullPaint(paintContext);

            // if switched state from animating to not animating invalidate the entire
            // screen so that it will be drawn with the default instead of animating
            // render quality.
            if (!Animating && animatingOnLastPaint)
            {
                Invalidate();
            }
            animatingOnLastPaint = Animating;

            // Calling the base class OnPaint
            base.OnPaint(pe);
            realGraphics.DrawImage(this.offscreenBitmap, 0, 0);

            PDebug.EndProcessingOutput(g);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Overridden.  See <see cref="Control.OnPaint">Control.OnPaint</see>.
        /// </summary>
        protected override void OnPaint(PaintEventArgs pe)
        {
            PDebug.StartProcessingOutput();

            // Clear the invalidatedBounds cache.
            invalidatedBounds = RectangleF.Empty;

            PPaintContext paintContext = CreatePaintContext(pe);

            PaintPiccolo(paintContext);

            // Calling the base class OnPaint
            base.OnPaint(pe);

            PDebug.EndProcessingOutput(paintContext);
        }