示例#1
0
        protected override void DoProcessing(FilterProcessingContext inputFrames, Frame outputFrame)
        {
            Console.WriteLine("decoding tga frame");

            using (var stream = this.OpenStreamForFrame(0))
            {
                using (var decoder = new TGADecoder(stream))
                {
                    decoder.Initialize();
                    decoder.Decode(outputFrame);
                }
            }
        }
示例#2
0
 protected virtual void DoDecode(Frame output)
 {
     throw new NotImplementedException();
 }
示例#3
0
        public virtual void Decode(Frame output)
        {
            if (!this.IsInitialized)
                if (!this.Initialize())
                    throw new NotImplementedException();

            this.DoDecode(output);
        }
示例#4
0
 public abstract void EncodeFrame(Frame frame);
示例#5
0
        protected bool Render(Frame output, long index)
        {
            // Grab the original frame
            var frame = this.Source.Filter.GetFrame(index);

            bool h = (this.FlipDirection & FlipDirection.Horizontal) == FlipDirection.Horizontal;
            bool v = (this.FlipDirection & FlipDirection.Vertical) == FlipDirection.Vertical;

            if (!h && !v)
            {
                // No flipping required, copy input to output and return.
                for (int i = 0; i < output.Video.Count; ++i)
                {
                    var vfd = frame.Video[i];
                    var ofd = output.Video[i];

                    if (frame.Video[i] is BitmapRGB)
                    {
                        var bmp = output.Video[i] as BitmapRGB;
                        bmp.BitBlit((BitmapRGB)frame.Video[i], new Point(0, 0));
                    }
                    else
                    {

                    }
                }
            }

            IEnumerable<IBitmap> bitmaps = frame.Video;
            IColor c;
            int ymin = 0;
            int ymax = output.Video[0].Height;
            int xmin = 0;
            int xmax = output.Video[1].Width;

            for (int i = 0; i < output.Video.Count; ++i)
            {
                var vfd = frame.Video[i];
                var ofd = output.Video[i];
                if (h && v)
                    for (int y1 = ymin, y2 = ymax; y1 < ymax; y1++, y2--)
                        for (int x1 = xmin, x2 = xmax; x1 < xmax; x1++, x2--)
                        {
                            ofd[x1, y1] = vfd[x2, y2];
                            ofd[x2, y2] = vfd[x1, y1];
                        }
                else if (h && !v)
                    for (int y = ymin; y < ymax; y++)
                        for (int x1 = xmin, x2 = xmax; x1 < xmax; x1++, x2--)
                        {
                            ofd[x1, y] = vfd[x2, y];
                            ofd[x2, y] = vfd[x1, y];
                        }
                else if (!h & v)
                    for (int y1 = ymin, y2 = ymax; y1 < ymax; y1++, y2--)
                        for (int x = xmin; x < xmax; x++)
                        {
                            ofd[x, y1] = vfd[x, y2];
                            ofd[x, y2] = vfd[x, y1];
                        }
            }
            return true;
        }
示例#6
0
 public override void EncodeFrame(Frame frame)
 {
 }
示例#7
0
 protected override void DoProcessing(NSynth.FilterProcessingContext inputFrames, NSynth.Frame outputFrame)
 {
     base.DoProcessing(inputFrames, outputFrame);
 }
示例#8
0
        public void SetFrame(string slot, int offset, Frame frame)
        {
            Contract.Requires(frame != null);
            Contract.Requires(slot != null);

            lock (this.sync)
            {
                if (!this.frames.ContainsKey(slot))
                    throw new NotImplementedException();
                else if (!this.frames[slot].ContainsKey(offset))
                    throw new NotImplementedException();
                else if (this.frames[slot][offset] != null)
                    throw new NotImplementedException();

                this.frames[slot][offset] = frame;

                foreach (var s in this.frames)
                    foreach (var n in s.Value)
                        if (n.Value == null)
                            return; // not ready

                this.isReady = true;
            }

            // must be ready
            if (this.isReady)
                if (this.InputFramesReady != null)
                    this.InputFramesReady(this, EventArgs.Empty);
        }