예제 #1
0
        /// <summary>
        /// Copies the template, including property templates from the generic
        /// GameObjectType.
        /// </summary>
        /// <returns></returns>
        public override GameObjectType Copy()
        {
            ImageObject2DType copy = new ImageObject2DType();

            copy.Image = this.Image; // Shallow copy.
            copy.Name  = this.Name;

            return(copy);
        }
예제 #2
0
        /// <summary>
        /// Creates a new ImageObject2D from a given image file path.
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public static ImageObject2DType FromFile(string filename)
        {
            ImageObject2DType newType = new ImageObject2DType();

            Bitmap fromFile = (Bitmap)Bitmap.FromFile(filename);

            newType.Image = new Bitmap(fromFile);
            fromFile.Dispose();

            newType.Name = Path.GetFileNameWithoutExtension(filename);

            return(newType);
        }