Class FileCreateSource
Namespace: Aspose.Imaging.Sources
Assembly: Aspose.Imaging.dll (25.7.0)
Represents a file source for creation.
[JsonObject(MemberSerialization.OptIn)]
public sealed class FileCreateSource : FileSource
{
}
Inheritance
object ← Source ← FileSource ← FileCreateSource
Inherited Members
FileSource.IsTemporal , Source.GetStreamContainer() , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
FileCreateSource(string)
Initializes a new instance of the Aspose.Imaging.Sources.FileCreateSource class.
public void FileCreateSource(string filePath)
{
}
Parameters
filePath
string
The file path to create.
Examples
This example creates a new Image file at some disk location as specified by Source property of the BmpOptions instance. If second parameter is not passed to the constructor of FileCreateSource, then by default the file to be created has property IsTemporal set to True. With IsTemporal set to True, no file will be saved on disk at the end of execution.
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\output.bmp");
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
}
FileCreateSource(string, bool)
Initializes a new instance of the Aspose.Imaging.Sources.FileCreateSource class.
public class FileCreateSource
{
[JsonConstructor]
public FileCreateSource(string filePath, bool isTemporal)
{
}
}
Parameters
filePath
string
The file path to create.
isTemporal
bool
If set to ’true’ the created file will be temporal.
Examples
This example creates a new Image file at some disk location as specified by Source property of the BmpOptions instance. Several properties for BmpOptions instance are set before creating the actual image. Especially the Source property, that refers to the actual disk location in this case.
Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
bmpOptions.BitsPerPixel = 24;
bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\output.bmp", false);
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
{
image.Save();
}
Properties
FilePath
Gets the file path to create.
public string FilePath
{
get;
}
Property Value
IsTemporal
Gets a value indicating whether file will be temporal.
public class YourClassHere // <-- Namespace and type name remain unchanged
{
[JsonProperty]
public override bool IsTemporal
{
get;
}
}
Property Value
Methods
GetStreamContainer()
Gets the stream container.
public override StreamContainer GetStreamContainer()
{
}
Returns
the stream container.
Remarks
Use with caution. You will need to dispose the stream container after retrieval.