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. Няколко свойства за случая Бmp Options се задават преди да се създаде действителното изображение.
//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; }
стойност на имота
IsTemporal
Получава стойност, която показва дали файлът ще бъде временна.
[JsonProperty]
public override bool IsTemporal { get; }
стойност на имота
Methods
GetStreamContainer()
Вземете потока на контейнера.
public override StreamContainer GetStreamContainer()
Returns
Потокът на контейнера.
Remarks
Използвайте с предпазливост. ще трябва да разтопите потока контейнер след възстановяване.