Class FileCreateSource

Class FileCreateSource

Namn på plats: Aspose.Imaging.Sources Församling: Aspose.Imaging.dll (25.4.0)

Representerar en filkälla för skapande.

[JsonObject(MemberSerialization.OptIn)]
public sealed class FileCreateSource : FileSource

Inheritance

object Source FileSource FileCreateSource

Arvsmedlemmar

FileSource.IsTemporal , Source.GetStreamContainer() , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

FileCreateSource(Sträng)

Initialiserar en ny instans av Aspose.Imaging.Sources.FileCreateSource klass.

public FileCreateSource(string filePath)

Parameters

filePath string

Filvägen att skapa.

Examples

Detta exempel skapar en ny bildfil på någon diskplats som angetts av källegenskapen i instansen BmpOptions. Om den andra parametren inte överförs till FileCreateSource-konstruktorn, då standard filen som ska skapas har egenskapen IsTemporal inställd till True. Med IsTemporal inställd till True, kommer ingen fil att sparas på disken vid slutet av utförandet.

//Creates an instance of BmpOptions and set its various properties
                                                                                                                                                                                                                                                                                                                                                                            Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                                                                                                                                                                                                                                                            bmpOptions.BitsPerPixel = 24;

                                                                                                                                                                                                                                                                                                                                                                            //Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
                                                                                                                                                                                                                                                                                                                                                                            //If second parameter is not passed, then by default the file has IsTemporal set to True
                                                                                                                                                                                                                                                                                                                                                                            bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\output.bmp");

                                                                                                                                                                                                                                                                                                                                                                            //Creates an instance of Image 
                                                                                                                                                                                                                                                                                                                                                                            using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                                                                                                                                                                                                                                                            {
                                                                                                                                                                                                                                                                                                                                                                                //do some image processing
                                                                                                                                                                                                                                                                                                                                                                            }

FileCreateSource(String och bool)

Initialiserar en ny instans av Aspose.Imaging.Sources.FileCreateSource klass.

[JsonConstructor]
public FileCreateSource(string filePath, bool isTemporal)

Parameters

filePath string

Filvägen att skapa.

isTemporal bool

Om du ställer in “true” kommer den skapade filen att vara temporär.

Examples

Det här exemplet skapar en ny bildfil på någon diskplats som angetts av källobjektet i BmpOptions-instans. Flera egenskaper för BmpOptions-instans ställs in innan du skapar den faktiska bilden.

//Create an instance of BmpOptions and set its various properties
                                                                                                                                                                                                                                                                                                             Aspose.Imaging.ImageOptions.BmpOptions bmpOptions = new Aspose.Imaging.ImageOptions.BmpOptions();
                                                                                                                                                                                                                                                                                                             bmpOptions.BitsPerPixel = 24;

                                                                                                                                                                                                                                                                                                             //Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
                                                                                                                                                                                                                                                                                                             //Second Boolean parameter determines if the file to be created IsTemporal or not
                                                                                                                                                                                                                                                                                                             bmpOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"C:\temp\output.bmp", false);

                                                                                                                                                                                                                                                                                                             //Create an instance of Image and initialize it with instance of BmpOptions by calling Create method
                                                                                                                                                                                                                                                                                                             using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(bmpOptions, 500, 500))
                                                                                                                                                                                                                                                                                                             {
                                                                                                                                                                                                                                                                                                                 //do some image processing

                                                                                                                                                                                                                                                                                                                 // save all changes
                                                                                                                                                                                                                                                                                                                 image.Save();
                                                                                                                                                                                                                                                                                                             }

Properties

FilePath

Få filvägen att skapa.

[JsonProperty]
public string FilePath { get; }

Fastighetsvärde

string

IsTemporal

Det får ett värde som anger om filen kommer att vara temporär.

[JsonProperty]
public override bool IsTemporal { get; }

Fastighetsvärde

bool

Methods

GetStreamContainer()

Hämta strömkontakten.

public override StreamContainer GetStreamContainer()

Returns

StreamContainer

och flödet container.

Remarks

Använd med försiktighet. Du kommer att behöva avlägsna strömkontakten efter återvinning.

 Svenska