Class FileCreateSource

Class FileCreateSource

Nazwa przestrzeń: Aspose.Imaging.Sources Zgromadzenie: Aspose.Imaging.dll (25.4.0)

Jest to źródło pliku do tworzenia.

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

Inheritance

object Source FileSource FileCreateSource

Dziedziczeni członkowie

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

Constructors

FileCreateSource(strumień)

Inicjalizuje nową instancję klasy Aspose.Imaging.Sources.FileCreateSource.

public FileCreateSource(string filePath)

Parameters

filePath string

Podręcznik do tworzenia.

Examples

Ten przykład tworzy nowy plik obrazu w dowolnym miejscu na dysku, jak określono przez właściwość źródła przykładu BmpOptions. Jeśli drugi parametr nie jest przekazywany do konstruktora FileCreateSource, to domyślnie tworzone pliki mają właściwości IsTemporal ustawione na 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(Złoty, Bool)

Inicjalizuje nową instancję klasy Aspose.Imaging.Sources.FileCreateSource.

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

Parameters

filePath string

Podręcznik do tworzenia.

isTemporal bool

Jeśli ustawisz “prawdziwy”, utworzony plik będzie tymczasowy.

Examples

Ten przykład tworzy nowy plik obrazu w dowolnym miejscu na dysku, jak określono przez właściwość źródłową przykładu BmpOptions. Niektóre właściwości dla instancji Bmoptions są ustawione przed utworzeniem rzeczywistej wizerunku.

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

Dostaniesz ścieżkę pliku do tworzenia.

[JsonProperty]
public string FilePath { get; }

Wartość nieruchomości

string

IsTemporal

Otrzymuje wartość wskazującą, czy plik będzie tymczasowy.

[JsonProperty]
public override bool IsTemporal { get; }

Wartość nieruchomości

bool

Methods

GetStreamContainer()

Przygotowuje się do przepływu kontenera.

public override StreamContainer GetStreamContainer()

Returns

StreamContainer

przepływu kontenera.

Remarks

Użyj z ostrożnością. będziesz musiał usunąć pojemnik strumieniowy po odzyskaniu.

 Polski