Class FileCreateSource

Class FileCreateSource

Το όνομα: Aspose.Imaging.Sources Συγκέντρωση: Aspose.Imaging.dll (25.4.0)

Αντιπροσωπεύει μια πηγή αρχείων για δημιουργία.

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

Inheritance

object Source FileSource FileCreateSource

Κληρονομημένα μέλη

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

Constructors

FileCreateSource(Σύνδεσμος)

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Imaging.Sources.FileCreateSource.

public FileCreateSource(string filePath)

Parameters

filePath string

Ο δρόμος του αρχείου για να δημιουργηθεί.

Examples

Αυτό το παράδειγμα δημιουργεί ένα νέο αρχείο εικόνας σε κάποια τοποθεσία δίσκου, όπως καθορίζεται από την ιδιοκτησία Πηγή της παραδείγματος BmpOptions. Εάν η δεύτερη παράμετρος δεν μεταφέρεται στον κατασκευαστή του FileCreateSource, τότε κατά προεπιλογή το αρχείο που θα δημιουργηθεί έχει ιδιοκτησία IsTemporal που ορίζεται σε 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(Στέλινγκ, Μπόλ)

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Imaging.Sources.FileCreateSource.

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

Parameters

filePath string

Ο δρόμος του αρχείου για να δημιουργηθεί.

isTemporal bool

Εάν ορίσετε το “πραγματικό” το αρχείο που δημιουργήθηκε θα είναι προσωρινό.

Examples

Αυτό το παράδειγμα δημιουργεί ένα νέο αρχείο εικόνας σε κάποια τοποθεσία δίσκου, όπως ορίζεται από την ιδιοκτησία πηγής της παραδείγματος BmpOptions. Πολλές ιδιοκτησίες για την παραδείγματος BmpOptions ρυθμίζονται πριν από τη δημιουργία της πραγματικής εικόνας. Ειδικά η ιδιοκτησία πηγής, η οποία αναφέρεται στην πραγματική τοποθεσία δίσκου σε αυτή την περίπτωση.

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

Πάρτε το αρχείο δρόμο για να δημιουργήσετε.

[JsonProperty]
public string FilePath { get; }

Αξία ιδιοκτησίας

string

IsTemporal

Αποκτά μια τιμή που υποδεικνύει εάν το αρχείο θα είναι προσωρινό.

[JsonProperty]
public override bool IsTemporal { get; }

Αξία ιδιοκτησίας

bool

Methods

GetStreamContainer()

Πάρτε το δοχείο ροής.

public override StreamContainer GetStreamContainer()

Returns

StreamContainer

Η ροή του δοχείου.

Remarks

Χρησιμοποιήστε με προσοχή.Θα χρειαστεί να διαλύσετε το δοχείο ροής μετά την ανάκτηση.

 Ελληνικά