Пример #1
0
 /// <summary>
 /// Sends the given ViewPort backward one step in the Z-order.
 /// </summary>
 /// <param name="vp">The ViewPort you want to send backward.</param>
 /// <remarks>
 /// If the given ViewPort is not registered or is the bottommost ViewPort of the Display then this function
 /// has no effect.
 /// Call this from the render thread.
 /// </remarks>
 private void SendViewPortBackward_i(ViewPort vp)
 {
     lock (this.viewPorts)
     {
         int vpIndex = this.viewPorts.IndexOf(vp);
         if (vpIndex > 0)
         {
             /// Swap the given ViewPort and the ViewPort behind it.
             ViewPortRefreshMgr vpr = this.vpRefreshers[vpIndex];
             this.viewPorts[vpIndex]        = this.viewPorts[vpIndex - 1];
             this.viewPorts[vpIndex - 1]    = vp;
             this.vpRefreshers[vpIndex]     = this.vpRefreshers[vpIndex - 1];
             this.vpRefreshers[vpIndex - 1] = vpr;
         }
     }
 }
Пример #2
0
 /// <summary>
 /// Brings the given ViewPort forward one step in the Z-order.
 /// </summary>
 /// <param name="vp">The ViewPort you want to bring forward.</param>
 /// <remarks>
 /// If the given ViewPort is not registered or is the topmost ViewPort of the Display then this function
 /// has no effect.
 /// Call this from the render thread.
 /// </remarks>
 private void BringViewPortForward_i(ViewPort vp)
 {
     lock (this.viewPorts)
     {
         int vpIndex = this.viewPorts.IndexOf(vp);
         if (-1 != vpIndex && vpIndex < this.viewPorts.Count - 1)
         {
             /// Swap the given ViewPort and the ViewPort in front of it.
             ViewPortRefreshMgr vpr = this.vpRefreshers[vpIndex];
             this.viewPorts[vpIndex]        = this.viewPorts[vpIndex + 1];
             this.viewPorts[vpIndex + 1]    = vp;
             this.vpRefreshers[vpIndex]     = this.vpRefreshers[vpIndex + 1];
             this.vpRefreshers[vpIndex + 1] = vpr;
         }
     }
 }
Пример #3
0
        /// <summary>
        /// Constructs a ViewPortRefreshMgr object.
        /// </summary>
        /// <param name="targetVP">The target ViewPort that this refresh manager is responsible for.</param>
        public ViewPortRefreshMgr(ViewPort targetVP, BitmapAccess frameBufferAccess)
        {
            if (null == targetVP)
            {
                throw new ArgumentNullException("targetVP");
            }
            if (null == frameBufferAccess)
            {
                throw new ArgumentNullException("frameBufferAccess");
            }

            this.targetVP          = targetVP;
            this.frameBufferAccess = frameBufferAccess;
            this.drawAccessGranted = false;
            this.dirtyRectsVPC     = new List <Rectangle>();
            this.dirtyRectsDC      = new List <Rectangle>();
            this.invalidate        = true;
        }
Пример #4
0
 /// <summary>
 /// Sends the given ViewPort to the bottom of the Z-order.
 /// </summary>
 /// <param name="vp">The ViewPort you want to send to the bottom.</param>
 /// <remarks>
 /// If the given ViewPort is not registered or is the bottommost ViewPort of the Display then this function
 /// has no effect.
 /// Call this from the render thread.
 /// </remarks>
 private void SendViewPortBottom_i(ViewPort vp)
 {
     lock (this.viewPorts)
     {
         int vpIndex = this.viewPorts.IndexOf(vp);
         if (vpIndex > 0)
         {
             ViewPortRefreshMgr vpr = this.vpRefreshers[vpIndex];
             for (int i = vpIndex; i > 0; i--)
             {
                 this.viewPorts[i]    = this.viewPorts[i - 1];
                 this.vpRefreshers[i] = this.vpRefreshers[i - 1];
             }
             this.viewPorts[0]    = vp;
             this.vpRefreshers[0] = vpr;
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Brings the given ViewPort to the top of the Z-order.
 /// </summary>
 /// <param name="vp">The ViewPort you want to bring to the top.</param>
 /// <remarks>
 /// If the given ViewPort is not registered or is the topmost ViewPort of the Display then this function
 /// has no effect.
 /// Call this from the render thread.
 /// </remarks>
 private void BringViewPortTop_i(ViewPort vp)
 {
     lock (this.viewPorts)
     {
         int vpIndex = this.viewPorts.IndexOf(vp);
         if (-1 != vpIndex && vpIndex < this.viewPorts.Count - 1)
         {
             ViewPortRefreshMgr vpr = this.vpRefreshers[vpIndex];
             for (int i = vpIndex; i < this.viewPorts.Count - 1; i++)
             {
                 this.viewPorts[i]    = this.viewPorts[i + 1];
                 this.vpRefreshers[i] = this.vpRefreshers[i + 1];
             }
             this.viewPorts[this.viewPorts.Count - 1]       = vp;
             this.vpRefreshers[this.vpRefreshers.Count - 1] = vpr;
         }
     }
 }
Пример #6
0
        /// <summary>
        /// This function applies the current Z-order on the ViewPorts. This means that all refresh manager
        /// will be notified if any parts of it's corresponding ViewPort is covered by another ViewPort.
        /// </summary>
        private void ApplyZOrderOnViewPorts()
        {
            for (int currIdx = 0; currIdx < this.viewPorts.Count - 1; currIdx++)
            {
                ViewPort           currVP  = this.viewPorts[currIdx];
                ViewPortRefreshMgr currVPR = this.vpRefreshers[currIdx];

                for (int otherIdx = currIdx + 1; otherIdx < this.viewPorts.Count; otherIdx++)
                {
                    ViewPort           otherVP      = this.viewPorts[otherIdx];
                    ViewPortRefreshMgr otherVPR     = this.vpRefreshers[otherIdx];
                    Rectangle          intersection = Rectangle.Intersect(currVP.Position, otherVP.Position);
                    if (!intersection.IsEmpty)
                    {
                        currVPR.AddHiddenArea(otherVPR, intersection);
                    }
                }
            }
        }