/// <summary>
        /// zdhfksdhgkdjfgdkjgkddjfgkdfjgkhdjhgkdfjgkdfjgkdfjgkdfh
        /// </summary>
        /// <returns></returns>
        public override Cloneable Clone()
        {
            // create shallow copy, then clone bitmap to create deep copy
            CourseImage clone = (CourseImage)this.MemberwiseClone();

            clone.Bitmap = (Bitmap)Bitmap.Clone();
            return(clone as Cloneable);
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new course image by blending an image over the given prototype.
        /// </summary>
        /// <returns>A new course image created from the given prototype.</returns>
        /// <param name="prototype">The prototype to create the course image from.</param>
        /// <param name="imagePath">The path of the blend image.</param>
        public CourseImage CreateImage(CourseImage prototype, string imagePath)
        {
            CourseImage image = (CourseImage)prototype.Clone();

            // blend second image over prototype
            using (var blend = Image.FromFile(imagePath))
            {
                using (var canvas = Graphics.FromImage(image.Bitmap))
                {
                    canvas.DrawImage(blend, 115, 32);
                }
            }
            return(image);
        }
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        /// <param name="args">The command-line arguments.</param>
        public static void Main(string[] args)
        {
            // set up prototype object
            CourseImage prototype = new CourseImage();

            prototype.Initialise();

            // create image of laptop with blueprint
            CourseImageMaker maker     = new CourseImageMaker();
            CourseImage      blueprint = maker.CreateImage(prototype, "course_image_1.png");

            blueprint.Save("blueprint.png");

            // create image of laptop with threads
            CourseImage threads = maker.CreateImage(prototype, "course_image_2.png");

            threads.Save("threads.png");

            // create image of laptop with memory cards
            CourseImage memory = maker.CreateImage(prototype, "course_image_3.png");

            memory.Save("memory.png");
        }