Exemplo n.º 1
0
        /// <summary>
        /// Write the ISurface to the specified stream by using the supplied IFileConfiguration
        /// </summary>
        /// <param name="surface">ISurface</param>
        /// <param name="fileConfiguration">IFileConfiguration</param>
        /// <param name="destinationFileConfiguration">IDestinationFileConfiguration</param>
        public static string SaveNamedTmpFile(this ISurface surface, IFileConfiguration fileConfiguration, IDestinationFileConfiguration destinationFileConfiguration = null)
        {
            var outputSettings = surface.GenerateOutputSettings(fileConfiguration.Choose(destinationFileConfiguration));

            return(ImageOutput.SaveNamedTmpFile(surface, surface.CaptureDetails, outputSettings));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Write the ISurface to the specified stream by using the supplied IFileConfiguration
 /// </summary>
 /// <param name="surface">ISurface</param>
 /// <param name="stream">Stream</param>
 /// <param name="fileConfiguration">IFileConfiguration</param>
 /// <param name="destinationFileConfiguration">IDestinationFileConfiguration</param>
 public static void WriteToStream(this ISurface surface, Stream stream, IFileConfiguration fileConfiguration, IDestinationFileConfiguration destinationFileConfiguration = null)
 {
     ImageOutput.SaveToStream(surface, stream, surface.GenerateOutputSettings(fileConfiguration.Choose(destinationFileConfiguration)));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Generate a filename
        /// </summary>
        /// <param name="surface">ISurface</param>
        /// <param name="fileConfiguration">IFileConfiguration</param>
        /// <param name="destinationFileConfiguration">IDestinationFileConfiguration</param>
        /// <returns>Filename</returns>
        public static string GenerateFilename(this ISurface surface, IFileConfiguration fileConfiguration, IDestinationFileConfiguration destinationFileConfiguration = null)
        {
            var selectedFileConfiguration = fileConfiguration.Choose(destinationFileConfiguration);

            return(Path.GetFileName(FilenameHelper.GetFilenameFromPattern(selectedFileConfiguration.OutputFileFilenamePattern, selectedFileConfiguration.OutputFileFormat, surface.CaptureDetails)));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Generate a mimetype, used when uploading
 /// </summary>
 /// <param name="surface">ISurface</param>
 /// <param name="fileConfiguration">IFileConfiguration</param>
 /// <param name="destinationFileConfiguration">IDestinationFileConfiguration</param>
 /// <returns>image with the format</returns>
 public static string GenerateMimeType(this ISurface surface, IFileConfiguration fileConfiguration, IDestinationFileConfiguration destinationFileConfiguration = null)
 {
     return("image/" + fileConfiguration.Choose(destinationFileConfiguration).OutputFileFormat);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Create OutputSettings
 /// </summary>
 /// <param name="surface">ISurface</param>
 /// <param name="fileConfiguration">IFileConfiguration</param>
 /// <param name="destinationFileConfiguration">IDestinationFileConfiguration</param>
 /// <returns>SurfaceOutputSettings</returns>
 public static SurfaceOutputSettings GenerateOutputSettings(this ISurface surface, IFileConfiguration fileConfiguration, IDestinationFileConfiguration destinationFileConfiguration = null)
 {
     return(new SurfaceOutputSettings(fileConfiguration.Choose(destinationFileConfiguration)));
 }