Enumeration that indicates whether the temp files are on disk, in memory or a combination of disk and memory.
public enum LeadTempFileMode
typedef NS_ENUM(NSInteger, LTLEADTempFileMode) {
LTLEADTempFileModeAuto,
LTLEADTempFileModeDisk,
LTLEADTempFileModeDiskAndMemory,
LTLEADTempFileModeMemory
};
public final class LeadTempFileMode
extends java.lang.Enum<LeadTempFileMode>
public:
enum class LeadTempFileMode sealed
class LeadTempFileMode(Enum):
Auto = 0
Disk = 1
DiskAndMemory = 2
Memory = 3
Value | Member | Description |
---|---|---|
0 | Auto | Lets LEADTOOLS pick the default mode (behavior might change from one version to another). Currently, it is the same as DiskAndMemory |
1 | Disk | Disk only, does not use memory to back up temp files. |
2 | DiskAndMemory | Uses Memory for small temp files, but disk for large temp files. |
3 | Memory | Disables disk, all temp files should be created in memory. Some features might fail with if they require temporary files on disk. The failure might be an out of memory errors or a RasterException with code set to RasterExceptionCode.TempFileDiskDisabled. |
Refer to RasterDefaults.TempFileMode for more information.
using Leadtools;
using Leadtools.Codecs;
public static void RasterDefaults_TempFileMode_Example()
{
// Store the default value
LeadTempFileMode defaultTempFileMode = RasterDefaults.TempFileMode;
GlobalMemoryThresholds defaultGlobalMemoryThreshold = RasterDefaults.GetGlobalMemoryThresholds();
// Set to auto
Console.WriteLine("RasterDefaults.TempFileMode is Auto");
RasterDefaults.TempFileMode = LeadTempFileMode.Auto;
// Allocating an image should work, normal conventional
using (var image = RasterImage.Create(1024, 1024, 32, 300, RasterColor.FromKnownColor(RasterKnownColor.White)))
{
Console.WriteLine("default options:");
Console.WriteLine(" image.IsConventionalMemory:" + image.IsConventionalMemory);
Console.WriteLine(" image.IsDiskMemory:" + image.IsDiskMemory);
Console.WriteLine(" image.IsTiled:" + image.IsTiled);
Debug.Assert(image.IsConventionalMemory);
Debug.Assert(!image.IsDiskMemory);
Debug.Assert(!image.IsTiled);
}
Console.WriteLine("MaximumConventionalMemory is set to low");
// Change the default maximum memory threshold to something small (1MB)
GlobalMemoryThresholds globalMemoryThreshold = RasterDefaults.GetGlobalMemoryThresholds();
globalMemoryThreshold.MaximumConventionalMemory = 1 * 1024 * 1024;
RasterDefaults.SetGlobalMemoryThresholds(globalMemoryThreshold);
// Now, the image should be of type disk or tiled
using (var image = RasterImage.Create(1024, 1024, 32, 300, RasterColor.FromKnownColor(RasterKnownColor.White)))
{
Console.WriteLine("low global memory threshold:");
Console.WriteLine(" image.IsConventionalMemory:" + image.IsConventionalMemory);
Console.WriteLine(" image.IsDiskMemory:" + image.IsDiskMemory);
Console.WriteLine(" image.IsTiled:" + image.IsTiled);
Debug.Assert(!image.IsConventionalMemory);
Debug.Assert(image.IsDiskMemory || image.IsTiled);
}
// Disable disk for temp files
Console.WriteLine("RasterDefaults.TempFileMode is Memory");
RasterDefaults.TempFileMode = LeadTempFileMode.Memory;
// Now it should go back to conventional
using (var image = RasterImage.Create(1024, 1024, 32, 300, RasterColor.FromKnownColor(RasterKnownColor.White)))
{
Console.WriteLine("low global memory threshold:");
Console.WriteLine(" image.IsConventionalMemory:" + image.IsConventionalMemory);
Console.WriteLine(" image.IsDiskMemory:" + image.IsDiskMemory);
Console.WriteLine(" image.IsTiled:" + image.IsTiled);
Debug.Assert(image.IsConventionalMemory);
Debug.Assert(!image.IsDiskMemory);
Debug.Assert(!image.IsTiled);
}
// Reset
RasterDefaults.SetGlobalMemoryThresholds(defaultGlobalMemoryThreshold);
RasterDefaults.TempFileMode = defaultTempFileMode;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document