예제 #1
0
        private void SkipAnimation()
        {
            t.Stop();

            if (currentCtx != null)
            {
                currentCtx.Dispose();
            }
            this.currentCtx = endingContext.Clone();
            if (secondaryCtx != null)
            {
                secondaryCtx.Dispose();
                this.secondaryCtx = null;
            }
            if (startingContext != null)
            {
                startingContext.Dispose();
                startingContext = null;
            }
            if (endingContext != null)
            {
                endingContext.Dispose();
                endingContext = null;
            }
            this.animating = false;

            this.Invalidate();
        }
예제 #2
0
        public GfxContext GetCurrentGfxContext()
        {
            if (ctx.img == null)
            {
                return(null);
            }

            ctx.opacity          = data.opacity;
            ctx.destSize         = DisplayEngine.NativeResolution.Size;
            ctx.textRegions      = this.data.lTextRegions;
            ctx.supportAnimation = false;
            return(ctx.Clone());
        }
예제 #3
0
        private void project_Refresh(object sender, EventArgs e)
        {
            if (proj == null)
            {
                return;
            }

            if (!blackscreen)
            {
                GfxContext receivedContext = GetContextFromProject();
                if (useAnimation && receivedContext.supportAnimation)
                {
                    StartAnimation(currentCtx, receivedContext);
                }
                else
                {
                    currentCtx = receivedContext.Clone();
                    this.Refresh();
                }
            }
        }
예제 #4
0
        // Animation support
        private void StartAnimation(GfxContext startContext, GfxContext endContext)
        {
            if (animating) // If already animating
            {
                if (endContext != null)
                {
                    endingContext = endContext.Clone();
                }
                SkipAnimation(); // jumps to end without animating
                return;
            }

            // Check input
            if (endContext == null)
            {
                endContext          = new GfxContext(); // empty context (paint black)
                endContext.destSize = NativeResolution.Size;
                endContext.opacity  = -255;
            }
            if (startContext == null)
            {
                startContext                 = new GfxContext();
                startContext.destSize        = NativeResolution.Size;
                startContext.animTextOpacity = 0;
            }

            // Check image to correct ramp
            if (startContext.img == null)
            {
                startContext.img     = endContext.img;
                startContext.opacity = -255;
            }
            if (endContext.img == null)
            {
                endContext.img     = startContext.img;
                endContext.opacity = -255;
            }

            // Release previous resources
            if (startingContext != null)
            {
                startingContext.Dispose();
            }
            if (endingContext != null)
            {
                endingContext.Dispose();
            }

            // Adjust animation duration and choke
            if (startContext.animTextOpacity == 0 || endContext.animTextOpacity == 0)
            {
                animationDuration = 10;
                animationChoke    = 0;
            }
            else
            {
                animationDuration = 20;
                animationChoke    = 7;
            }

            this.animating       = true;
            this.startingContext = startContext.Clone();
            this.endingContext   = endContext.Clone();
            t.Start();
        }