Beispiel #1
0
        public Bitmap Get(int age)
        {
            if (composite == null)
            {
                throw new InvalidOperationException();
            }

            if (!allocated || image == null)
            {
                return(null);
            }

            if (composite.Subframes == null || composite.Subframes.Count == 0)
            {
                return(delayer.Get(age));
            }

            Graphics g = Graphics.FromImage(image);

            g.InterpolationMode = InterpolationMode.NearestNeighbor;

            composite.Tick();
            currentPosition++;
            if (!composite.NeedsRefresh)
            {
                return(image);
            }

            foreach (IDelaySubframe subframe in composite.Subframes)
            {
                int subframeAge = composite.GetAge(subframe);

                if (subframeAge < 0)
                {
                    continue;
                }

                Bitmap subframeImage = delayer.Get(subframeAge);
                g.DrawImage(subframeImage, subframe.Bounds);

                // Debug
                //int subframePosition = currentPosition - subframeAge;
                //string text = string.Format("frame:{0}, current:{1}.", subframePosition, currentPosition);
                //g.DrawString(text, font, Brushes.Red, subframe.Bounds.Location);
            }

            return(image);
        }
        public Bitmap Get(int age)
        {
            if (composite == null)
            {
                throw new InvalidOperationException();
            }

            if (!allocated || image == null)
            {
                return(null);
            }

            if (composite.Subframes == null || composite.Subframes.Count == 0)
            {
                return(delayer.Get(age));
            }

            Graphics g = Graphics.FromImage(image);

            g.InterpolationMode = InterpolationMode.NearestNeighbor;

            composite.Tick();
            currentPosition++;
            if (!composite.NeedsRefresh)
            {
                return(image);
            }

            foreach (IDelaySubframe subframe in composite.Subframes)
            {
                int subframeAge = composite.GetAge(subframe);

                if (subframeAge < 0)
                {
                    continue;
                }

                Bitmap subframeImage = delayer.Get(subframeAge);
                g.DrawImage(subframeImage, subframe.Destination, subframe.Source, GraphicsUnit.Pixel);
            }

            return(image);
        }
Beispiel #3
0
        private void ToggleImageProcessing()
        {
            Bitmap delayed = delayer.Get(delay);

            // Test
            if (metadata.TestGridVisible)
            {
                imageProcessor.Start(delayed.Width, delayed.Height, delayed.PixelFormat);
            }
            else
            {
                imageProcessor.Stop();
            }
        }