Ejemplo n.º 1
0
        protected override Bitmap CreateComposition()
        {
            List <Bitmap> originals = new List <Bitmap>();
            List <Point>  locations = new List <Point>();

            try
            {
                // Set the locations determined by the sketch
                foreach (Subject s in this.sketch.SketchedSubjects)
                {
                    originals.Add(s.SketchedImage);
                    locations.Add(new Point(s.sketchAtX, s.sketchAtY));
                }

                // Instantiate the painter and create the composition
                using (Painter painter = new CompositeNativeMomentsPainter(this.compositionWidth, this.compositionHeight, originals.ToArray(), locations.ToArray()))
                {
                    painter.GenerateMovie    = this.generateMovie;
                    painter.IntroMovieFrames = this.movieIntroFrames;
                    return(painter.Paint());
                }
            }
            finally
            {
                // We're done with this, but the bitmaps will be disposed of when this object
                // is disposed of
                originals.Clear();
                originals = null;
                locations.Clear();
                locations = null;
            }
        }
        protected override Bitmap CreateComposition()
        {
            List <Bitmap> originals = new List <Bitmap>();
            List <Point>  locations = new List <Point>();

            try
            {
                // Set the locations determined by the sketch
                foreach (Subject s in this.sketch.SketchedSubjects)
                {
                    originals.Add(s.SketchedImage);
                    locations.Add(new Point(s.sketchAtX, s.sketchAtY));
                }

                // Instantiate the painter and create the composition
                using (Painter painter = new CompositeNativeMomentsPainter(this.compositionWidth, this.compositionHeight, originals.ToArray(), locations.ToArray()))
                {
                    painter.GenerateMovie    = this.generateMovie;
                    painter.IntroMovieFrames = this.movieIntroFrames;
                    painter.MovieFilename    = this.movieFilename;
                    DateTime start = DateTime.Now;
                    Bitmap   res   = painter.Paint();
                    System.Console.WriteLine("Painting took: " + (DateTime.Now - start).TotalSeconds + " seconds");
                    return(res);
                }
            }
            finally
            {
                // We're done with this, but the bitmaps will be disposed of when this object
                // is disposed of
                originals.Clear();
                originals = null;
                locations.Clear();
                locations = null;
            }
        }