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. 使用 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

使用谨慎,您需要在接收后将流量容器拆除。

 中文