C#
VB
Java
Objective-C
WinRT C#
C++
Holds conventional memory restrictions used when allocating new RasterImage objects.
public struct GlobalMemoryThresholds Public Structure GlobalMemoryThresholds public struct GlobalMemoryThresholds @interface GlobalMemoryThresholds : NSObject public class GlobalMemoryThresholds function Leadtools.GlobalMemoryThresholds public: struct GlobalMemoryThresholds Use RasterDefaults.GetGlobalMemoryThresholds and RasterDefaults.SetGlobalMemoryThresholds to get or set the conventional memory restrictions used when allocating new RasterImage objects.
GlobalMemoryThresholds contains the following members:
| Member | Description |
|---|---|
| MaximumConventionalMemory | Maximum size of continuous conventional memory in bytes to use when creating a RasterImage object. |
using Leadtools;using Leadtools.Codecs;using LeadtoolsExamples.Common;public static void MaximumConventionalMemoryTest(){Console.WriteLine("maximumConventionalMemoryTest");string imageFileName = @"C:\Users\Public\Documents\LEADTOOLS Images\Leadtools.pdf";long size = 0;using (var rasterCodecs = new RasterCodecs()){using (var rasterImage = rasterCodecs.Load(imageFileName, 1)){Console.WriteLine("loaded, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory);Debug.Assert(rasterImage.IsConventionalMemory);Debug.Assert(!rasterImage.IsDiskMemory);size = rasterImage.DataSize;}// Set maximum conventional size to half of the bitmap's and re-check. Should be diskGlobalMemoryThresholds thresholds = RasterDefaults.GetGlobalMemoryThresholds();Console.WriteLine("Original GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory);thresholds.MaximumConventionalMemory = size / 2;RasterDefaults.SetGlobalMemoryThresholds(thresholds);thresholds = RasterDefaults.GetGlobalMemoryThresholds();Console.WriteLine("New GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory);using (var rasterImage = rasterCodecs.Load(imageFileName, 1)){Console.WriteLine("loaded, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory);Debug.Assert(!rasterImage.IsConventionalMemory);Debug.Assert(rasterImage.IsDiskMemory);}// Now set to -1 and try to create a 20 by 20 at 32-BPP inch bitmap, should be disk// ResetRasterDefaults.SetGlobalMemoryThresholds(GlobalMemoryThresholds.Default);thresholds = RasterDefaults.GetGlobalMemoryThresholds();Console.WriteLine("Original GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory);thresholds.MaximumConventionalMemory = -1;RasterDefaults.SetGlobalMemoryThresholds(thresholds);thresholds = RasterDefaults.GetGlobalMemoryThresholds();Console.WriteLine("New GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory);using (var rasterImage = new RasterImage(RasterMemoryFlags.Conventional,20 * 300,20 * 300,32,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,null,null,0)){Console.WriteLine("created, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory);Debug.Assert(!rasterImage.IsConventionalMemory);Debug.Assert(rasterImage.IsDiskMemory);}// finally create 8.5 by 11 at 300 DPI, should be convusing (var rasterImage = new RasterImage(RasterMemoryFlags.Conventional,(int)(8.5 * 300),11 * 300,32,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,null,null,0)){Console.WriteLine("created, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory);Debug.Assert(rasterImage.IsConventionalMemory);Debug.Assert(!rasterImage.IsDiskMemory);}}// ResetRasterDefaults.SetGlobalMemoryThresholds(GlobalMemoryThresholds.Default);}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingPublic Shared Sub MaximumConventionalMemoryTest()Console.WriteLine("maximumConventionalMemoryTest")Dim imageFileName As String = "C:\Users\Public\Documents\LEADTOOLS Images\Leadtools.pdf"Dim size As Long = 0Using rasterCodecs As New RasterCodecs()Using rasterImage As RasterImage = rasterCodecs.Load(imageFileName, 1)Console.WriteLine("loaded, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory)Debug.Assert(rasterImage.IsConventionalMemory)Debug.Assert(Not rasterImage.IsDiskMemory)size = rasterImage.DataSizeEnd Using' Set maximum conventional size to half of the bitmap's and re-check. Should be diskDim thresholds As GlobalMemoryThresholds = RasterDefaults.GetGlobalMemoryThresholds()Console.WriteLine("Original GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory)thresholds.MaximumConventionalMemory = size / 2RasterDefaults.SetGlobalMemoryThresholds(thresholds)thresholds = RasterDefaults.GetGlobalMemoryThresholds()Console.WriteLine("New GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory)Using rasterImage As RasterImage = rasterCodecs.Load(imageFileName, 1)Console.WriteLine("loaded, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory)Debug.Assert(Not rasterImage.IsConventionalMemory)Debug.Assert(rasterImage.IsDiskMemory)End Using' Now set to -1 And try to create a 20 by 20 at 32-BPP inch bitmap, should be disk' ResetRasterDefaults.SetGlobalMemoryThresholds(GlobalMemoryThresholds.Default)thresholds = RasterDefaults.GetGlobalMemoryThresholds()Console.WriteLine("Original GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory)thresholds.MaximumConventionalMemory = -1RasterDefaults.SetGlobalMemoryThresholds(thresholds)thresholds = RasterDefaults.GetGlobalMemoryThresholds()Console.WriteLine("New GlobalMemoryThresholds.MaximumConventionalMemory = {0}", thresholds.MaximumConventionalMemory)Using rasterImage As New RasterImage(RasterMemoryFlags.Conventional,20 * 300,20 * 300,32,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,Nothing,Nothing,0)Console.WriteLine("created, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory)Debug.Assert(Not rasterImage.IsConventionalMemory)Debug.Assert(rasterImage.IsDiskMemory)End Using' finally create 8.5 by 11 at 300 DPI, should be convUsing rasterImage As New RasterImage(RasterMemoryFlags.Conventional,CInt(8.5 * 300),11 * 300,32,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,Nothing,Nothing,0)Console.WriteLine("created, size:{0} Conventional:{1} Disk:{2}",rasterImage.DataSize, rasterImage.IsConventionalMemory, rasterImage.IsDiskMemory)Debug.Assert(rasterImage.IsConventionalMemory)Debug.Assert(Not rasterImage.IsDiskMemory)End UsingEnd Using' ResetRasterDefaults.SetGlobalMemoryThresholds(GlobalMemoryThresholds.Default)End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
