コード例 #1
0
        /// <summary>
        /// Saves the specified surface as an image with the specified format.
        /// </summary>
        /// <param name="surface">The surface to save.</param>
        /// <param name="stream">The stream to which to save the surface data.</param>
        /// <param name="format">The format with which to save the image.</param>
        private void Save(Surface2D surface, Stream stream, ImageFormat format)
        {
            var data = new Color[surface.Width * surface.Height];

            surface.GetData(data);

            Save(data, surface.Width, surface.Height, stream, format);
        }
コード例 #2
0
        /// <inheritdoc/>
        public override void SaveAsJpeg(Surface2D surface, Stream stream)
        {
            Contract.Require(surface, nameof(surface));
            Contract.Require(stream, nameof(stream));

            var data = new Color[surface.Width * surface.Height];

            surface.GetData(data);

            Save(data, surface.Width, surface.Height, stream, img => img.AsJPEG());
        }
コード例 #3
0
        /// <inheritdoc/>
        public override void SaveAsJpeg(Surface2D surface, Stream stream)
        {
            Contract.Require(surface, "surface");
            Contract.Require(stream, "stream");

            var data = new Color[surface.Width * surface.Height];

            surface.GetData(data);

            Save(data, surface.Width, surface.Height, stream, asPng: false);
        }