Class FileCreateSource

Class FileCreateSource

Nom dels espais: Aspose.Imaging.Sources Assemblea: Aspose.Imaging.dll (25.4.0)

Representa una font de fitxers per a la creació.

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

Inheritance

object Source FileSource FileCreateSource

Membres heretats

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

Constructors

FileCreateSource(Tàrrega)

Inicialitza una nova instància de la classe Aspose.Imaging.Sources.FileCreateSource.

public FileCreateSource(string filePath)

Parameters

filePath string

El camí de fitxer per crear.

Examples

Aquest exemple crea un nou arxiu d’imatge en algun lloc del disc tal com s’especifica per la propietat de font de l’exemple BmpOptions. Si el segon paràmetre no es passa al constructor de FileCreateSource, llavors de forma default el fitxer que es crearà té la propietats IsTemporal establerta a True.

//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(Tàrrega, Bool)

Inicialitza una nova instància de la classe Aspose.Imaging.Sources.FileCreateSource.

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

Parameters

filePath string

El camí de fitxer per crear.

isTemporal bool

Si s’estableix a ‘verd’ el fitxer creat serà temporal.

Examples

Aquest exemple crea un nou fitxer d’imatge en alguna ubicació del disc tal com s’especifica per la propietat de font de l’instant BmpOptions. Diverses propietats per a la instància Bmoptions es configuren abans de crear la imatge real.

//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

Obté el camí de fitxer per crear.

[JsonProperty]
public string FilePath { get; }

Valor de la propietat

string

IsTemporal

Obté un valor que indica si el fitxer serà temporal.

[JsonProperty]
public override bool IsTemporal { get; }

Valor de la propietat

bool

Methods

GetStreamContainer()

Tingues el contenidor de flux.

public override StreamContainer GetStreamContainer()

Returns

StreamContainer

El contenidor de flux.

Remarks

Utilitzar amb cautela. vostè haurà de disposar el contenidor de flux després de la recuperació.

 Català