Esempio n. 1
0
        private List <Bitmap> GetImages(IWorkingZoneFramesContainer framesContainer, int spots)
        {
            float         step    = (float)framesContainer.Frames.Count / spots;
            List <Bitmap> bitmaps = framesContainer.Frames.Select(f => f.Image).ToList();

            return(bitmaps.Where((bmp, i) => i % step < 1).ToList());
        }
Esempio n. 2
0
 public override void Activate(IWorkingZoneFramesContainer framesContainer, Action <InteractiveEffect> setInteractiveEffect)
 {
     // Should be quick so we don't go through the background thread.
     if (framesContainer != null)
     {
         framesContainer.Revert();
     }
 }
Esempio n. 3
0
        public override void Activate(IWorkingZoneFramesContainer framesContainer, Action <InteractiveEffect> setInteractiveEffect)
        {
            InteractiveEffect effect = new InteractiveEffect();

            // Usage of closures to capture internal state for the effect.
            // The Parameter object will be shared between the delegates, but scoped to this InteractiveEffect instance.
            Parameters p = new Parameters();

            effect.Draw       = (canvas, frames) => Draw(canvas, frames, p);
            effect.MouseWheel = (scroll) => MouseWheel(scroll, p);

            setInteractiveEffect(effect);
        }
Esempio n. 4
0
        private void Draw(Graphics canvas, IWorkingZoneFramesContainer framesContainer, Parameters parameters)
        {
            if (parameters == null || framesContainer == null || framesContainer.Frames == null || framesContainer.Frames.Count < 1)
            {
                return;
            }

            List <Bitmap> selectedFrames = GetImages(framesContainer, parameters.Spots);

            if (selectedFrames == null || selectedFrames.Count < 1)
            {
                return;
            }

            canvas.PixelOffsetMode    = PixelOffsetMode.HighSpeed;
            canvas.CompositingQuality = CompositingQuality.HighSpeed;
            canvas.InterpolationMode  = InterpolationMode.Bilinear;
            canvas.SmoothingMode      = SmoothingMode.HighQuality;

            // We reserve n² placeholders, so we have exactly as many images on width than on height.
            // Example: 32 images as input -> 6x6 images with the last 4 not filled.
            // + each image must be scaled down by a factor of 1/6.

            int n           = (int)Math.Sqrt(parameters.Spots);
            int thumbWidth  = (int)canvas.VisibleClipBounds.Width / n;
            int thumbHeight = (int)canvas.VisibleClipBounds.Height / n;

            Rectangle rSrc = new Rectangle(0, 0, selectedFrames[0].Width, selectedFrames[0].Height);
            Font      f    = new Font("Arial", GetFontSize(thumbWidth), FontStyle.Bold);

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    int iImageIndex = j * n + i;
                    if (iImageIndex >= selectedFrames.Count || selectedFrames[iImageIndex] == null)
                    {
                        continue;
                    }

                    Rectangle rDst = new Rectangle(i * thumbWidth, j * thumbHeight, thumbWidth, thumbHeight);

                    canvas.DrawImage(selectedFrames[iImageIndex], rDst, rSrc, GraphicsUnit.Pixel);
                    DrawImageNumber(canvas, iImageIndex, rDst, f);
                }
            }

            f.Dispose();
        }
Esempio n. 5
0
        public override void Activate(IWorkingZoneFramesContainer framesContainer, Action <InteractiveEffect> setInteractiveEffect)
        {
            if (ImageProcessor == null || framesContainer == null || framesContainer.Frames == null || framesContainer.Frames.Count < 1)
            {
                return;
            }

            frames = framesContainer.Frames;

            using (Bitmap bmp = framesContainer.Representative.CloneDeep())
            {
                ImageProcessor(bmp);
                using (formPreviewVideoFilter fpvf = new formPreviewVideoFilter(bmp, Name))
                {
                    if (fpvf.ShowDialog() == DialogResult.OK)
                    {
                        StartProcessing();
                    }
                }
            }
        }
Esempio n. 6
0
 public override void Activate(IWorkingZoneFramesContainer framesContainer, Action <InteractiveEffect> setInteractiveEffect)
 {
     StartProcessing();
 }
 public abstract void Activate(IWorkingZoneFramesContainer framesContainer, Action <InteractiveEffect> setInteractiveEffect);