Ejemplo n.º 1
0
        //****************************************************************
        // Painting - Methods for painting a PImage.
        //****************************************************************

        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(PPaintContext paintContext)
        {
            if (Image != null)
            {
                RectangleFx b = Bounds;
                XnaGraphics g = paintContext.Graphics;

                g.DrawImage(image, b.ToRectangleF());
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Overridden.  Paints the cached image representation of this node's children if
 /// it is not currently being created.
 /// </summary>
 /// <param name="paintContext"></param>
 public override void FullPaint(PPaintContext paintContext)
 {
     if (validatingCache)
     {
         base.FullPaint(paintContext);
     }
     else
     {
         XnaGraphics g = paintContext.Graphics;
         g.DrawImage(ImageCache, (int)X, (int)Y);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Overridden.  See <see cref="PNode.Paint">PNode.Paint</see>.
        /// </summary>
        protected override void Paint(PPaintContext paintContext)
        {
            base.Paint(paintContext);

            XnaGraphics g          = paintContext.Graphics;
            Matrix      matrix     = g.Transform;
            RectangleFx transRectF = MatrixExtensions.Transform(matrix, bounds);

            System.Drawing.Rectangle transRect = new System.Drawing.Rectangle((int)transRectF.X, (int)transRectF.Y, (int)transRectF.Width, (int)transRectF.Height);

            // Draw the image if the control node is not in editing mode or
            // if the control is being rendered in a view other than the one
            // that owns the control.
            if (!Editing || control.Bounds != transRect || paintContext.Canvas != currentCanvas)
            {
                if (image != null)
                {
                    g.DrawImage(image, bounds.ToRectangleF());
                }
            }
        }