Beispiel #1
0
        /// <summary>
        /// The ApplyResize method resizes the SimpleDatum containing an image to a newly resized image as specified by the resize parameter.
        /// </summary>
        /// <param name="sd">Specifies the SimpleDatum to resize - must contain a 3 channel image.</param>
        /// <param name="p">Specifies the resize parameter to apply.</param>
        /// <returns>The newly resized SimpleDatum is returned.</returns>
        public SimpleDatum ApplyResize(SimpleDatum sd, ResizeParameter p)
        {
            if (p.width == sd.Width && p.height == sd.Height)
            {
                return(sd);
            }

            Bitmap      bmp      = ImageData.GetImage(sd);
            Bitmap      bmpNew   = ImageTools.ResizeImage(bmp, (int)p.width, (int)p.height);
            SimpleDatum sdResize = ImageData.GetImageData(bmpNew, sd, false);
            SimpleDatum sdNew    = new SimpleDatum(sd);

            sdNew.CopyData(sdResize);

            bmp.Dispose();
            bmpNew.Dispose();

            return(sdNew);
        }