Class FileCreateSource

Class FileCreateSource

Tên không gian: Aspose.Imaging.Sources Tổng hợp: Aspose.Imaging.dll (25.4.0)

Nó đại diện cho một nguồn file cho việc tạo.

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

Inheritance

object Source FileSource FileCreateSource

Thành viên thừa kế

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

Constructors

FileCreateSource(String)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.Sources.FileCreateSource.

public FileCreateSource(string filePath)

Parameters

filePath string

Hướng dẫn file để tạo.

Examples

Ví dụ này tạo một tệp hình ảnh mới ở một số vị trí đĩa như được xác định bởi tài sản nguồn của ví dụ BmpOptions. Nếu thông số thứ hai không được chuyển đến nhà xây dựng FileCreateSource, sau đó theo mặc định các tập tin sẽ được tạo có thuộc tính IsTemporal được thiết lập để 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(Lời bài hát: Bool)

Bắt đầu một trường hợp mới của lớp Aspose.Imaging.Sources.FileCreateSource.

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

Parameters

filePath string

Hướng dẫn file để tạo.

isTemporal bool

Nếu thiết lập để ’truyền’ tệp được tạo sẽ là tạm thời.

Examples

Ví dụ này tạo một tệp hình ảnh mới ở một số vị trí đĩa như được xác định bởi tài sản nguồn của ví dụ BmpOptions. Một số tài chính cho ví dạng Bmppoptions được thiết lập trước khi tạo ra bức ảnh thực tế.

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

Nhận file path để tạo.

[JsonProperty]
public string FilePath { get; }

Giá trị bất động sản

string

IsTemporal

Nó nhận được một giá trị cho thấy liệu tệp sẽ tạm thời hay không.

[JsonProperty]
public override bool IsTemporal { get; }

Giá trị bất động sản

bool

Methods

GetStreamContainer()

Cung cấp dòng container.

public override StreamContainer GetStreamContainer()

Returns

StreamContainer

dòng container.

Remarks

Sử dụng với sự cẩn thận. bạn sẽ cần phải giải phóng container dòng chảy sau khi thu hồi.

 Tiếng Việt