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(String)

شروع یک مثال جدید از کلاس Aspose.Imaging.Sources.FileCreateSource.

public FileCreateSource(string filePath)

Parameters

filePath string

مسیر فایل برای ایجاد

Examples

این مثال یک فایل تصویر جدید را در یک مکان دیسک ایجاد می کند، همانطور که توسط ویژگی منبع در مثال BmpOptions مشخص شده است.اگر پارامتر دوم به سازنده FileCreateSource منتقل نشود، پس از آن به طور پیش فرض فایل ایجاد شده دارای ویژگی IsTemporal به True تنظیم شده است.با 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(بایگانی برچسب ها: bool)

شروع یک مثال جدید از کلاس 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

با احتیاط از آن استفاده کنید.بعد از بازگرداندن، باید مخزن جریان را از بین ببرید.

 فارسی