Specifies the default extra values used when creating RasterImage objects.
public static class RasterDefaults Public MustInherit NotInheritable Class RasterDefaults public sealed static class RasterDefaults @interface LTRasterDefaults : NSObject public class RasterDefaults function Leadtools.RasterDefaults() public ref class RasterDefaults abstract sealed You can use the RasterDefaults class to specify extra attributes used when creating a RasterImage object.
For example, you can use XResolution and YResolution to set the physical resolution (DPI) of all the RasterImage objects created afterwards.
You can use DitheringMethod to specify the default dithering method to use when converting an image from 64, 48, 32, 24, or 16 bits per pixel to 8 bits per pixel or fewer.
MemoryFlags and MemoryThreshold controls how newly created images use the system memory. The TemporaryDirectory controls where disk-based images are stored.
Use GetGlobalMemoryThresholds and SetGlobalMemoryThresholds to modify the conventional memory restrictions used when allocating new RasterImage objects.
using Leadtools;using Leadtools.Codecs;using LeadtoolsExamples.Common;public void RasterDefaultsExample(){// Set the limit for RasterImage object allocationsRasterMemoryThreshold threshold = RasterDefaults.MemoryThreshold;threshold.MaximumGlobalRasterImageMemory = 20 * 1000 * 1024;RasterDefaults.MemoryThreshold = threshold;ShowValues();// Create a raster image with current DPIRasterImage image1 = new RasterImage(RasterMemoryFlags.Conventional,100,100,24,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,null,IntPtr.Zero,0);Console.WriteLine("Resolution of created image is {0} by {1} DPI", image1.XResolution, image1.YResolution);// Change the resolutionint xOldResolution = RasterDefaults.XResolution;int yOldResolution = RasterDefaults.YResolution;int xNewResolution = 196;int yNewResolution = 196;RasterDefaults.XResolution = xNewResolution;RasterDefaults.YResolution = yNewResolution;ShowValues();// Create another raster image// Create a raster image with current DPIRasterImage image2 = new RasterImage(RasterMemoryFlags.Conventional,100,100,24,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,null,IntPtr.Zero,0);Console.WriteLine("Resolution of created image is {0} by {1} DPI", image2.XResolution, image2.YResolution);Assert.IsTrue(image2.XResolution == xNewResolution);Assert.IsTrue(image2.YResolution == yNewResolution);// Reset old valuesRasterDefaults.XResolution = xOldResolution;RasterDefaults.YResolution = yOldResolution;image1.Dispose();image2.Dispose();}void ShowValues(){Console.WriteLine("Current defaults:");Console.WriteLine("MaximumThreadCount: {0}", RasterDefaults.MaximumThreadCount);Console.WriteLine("XResolution: {0}", RasterDefaults.XResolution);Console.WriteLine("YResolution: {0}", RasterDefaults.YResolution);Console.WriteLine("DitheringMethod: {0}", RasterDefaults.DitheringMethod);Console.WriteLine("MemoryFlags: {0}", RasterDefaults.MemoryFlags);RasterMemoryThreshold threshold = RasterDefaults.MemoryThreshold;Console.WriteLine("MemoryThreshold.TiledThreshold: {0}", threshold.TiledThreshold);Console.WriteLine("MemoryThreshold.MaximumConventionalSize: {0}", threshold.MaximumConventionalSize);Console.WriteLine("MemoryThreshold.TileSize: {0}", threshold.TileSize);Console.WriteLine("MemoryThreshold.ConventionalTiles: {0}", threshold.ConventionalTiles);Console.WriteLine("MemoryThreshold.ConventionalBuffers: {0}", threshold.ConventionalBuffers);Console.WriteLine("MemoryThreshold.MaximumGlobalRasterImageMemory: {0}", threshold.MaximumGlobalRasterImageMemory);Console.WriteLine("TemporaryDirectory: {0}", RasterDefaults.TemporaryDirectory);}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.ImageProcessingPublic Sub RasterDefaultsExample()' Set the limit for RasterImage object allocationsDim threshold As RasterMemoryThreshold = RasterDefaults.MemoryThresholdthreshold.MaximumGlobalRasterImageMemory = 20 * 1000 * 1024RasterDefaults.MemoryThreshold = thresholdShowValues()' Create a raster image with current DPIDim image1 As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 100, 100, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, IntPtr.Zero, 0)Console.WriteLine("Resolution of created image is {0} by {1} DPI", image1.XResolution, image1.YResolution)' Change the resolutionDim xOldResolution As Integer = RasterDefaults.XResolutionDim yOldResolution As Integer = RasterDefaults.YResolutionDim xNewResolution As Integer = 196Dim yNewResolution As Integer = 196RasterDefaults.XResolution = xNewResolutionRasterDefaults.YResolution = yNewResolutionShowValues()' Create another raster image' Create a raster image with current DPIDim image2 As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 100, 100, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, IntPtr.Zero, 0)Console.WriteLine("Resolution of created image is {0} by {1} DPI", image2.XResolution, image2.YResolution)Debug.Assert(image2.XResolution = xNewResolution)Debug.Assert(image2.YResolution = yNewResolution)' Reset old valuesRasterDefaults.XResolution = xOldResolutionRasterDefaults.YResolution = yOldResolutionimage1.Dispose()image2.Dispose()End SubPrivate Sub ShowValues()Console.WriteLine("Current defaults:")Console.WriteLine("MaximumThreadCount: {0}", RasterDefaults.MaximumThreadCount)Console.WriteLine("XResolution: {0}", RasterDefaults.XResolution)Console.WriteLine("YResolution: {0}", RasterDefaults.YResolution)Console.WriteLine("DitheringMethod: {0}", RasterDefaults.DitheringMethod)Console.WriteLine("MemoryFlags: {0}", RasterDefaults.MemoryFlags)Dim threshold As RasterMemoryThreshold = RasterDefaults.MemoryThresholdConsole.WriteLine("MemoryThreshold.TiledThreshold: {0}", threshold.TiledThreshold)Console.WriteLine("MemoryThreshold.MaximumConventionalSize: {0}", threshold.MaximumConventionalSize)Console.WriteLine("MemoryThreshold.TileSize: {0}", threshold.TileSize)Console.WriteLine("MemoryThreshold.ConventionalTiles: {0}", threshold.ConventionalTiles)Console.WriteLine("MemoryThreshold.ConventionalBuffers: {0}", threshold.ConventionalBuffers)Console.WriteLine("MemoryThreshold.MaximumGlobalRasterImageMemory: {0}", threshold.MaximumGlobalRasterImageMemory)Console.WriteLine("TemporaryDirectory: {0}", RasterDefaults.TemporaryDirectory)End Sub
using Leadtools;public void RasterDefaultsExample(){ShowValues();// Create a raster image with current DPIRasterImage image1 = new RasterImage(RasterMemoryFlags.Conventional,100,100,24,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,null,null,0);Console.WriteLine("Resolution of created image is {0} by {1} DPI", image1.XResolution, image1.YResolution);// Change the resolutionint xOldResolution = RasterDefaults.XResolution;int yOldResolution = RasterDefaults.YResolution;int xNewResolution = 196;int yNewResolution = 196;RasterDefaults.XResolution = xNewResolution;RasterDefaults.YResolution = yNewResolution;ShowValues();// Create another raster image// Create a raster image with current DPIRasterImage image2 = new RasterImage(RasterMemoryFlags.Conventional,100,100,24,RasterByteOrder.Bgr,RasterViewPerspective.TopLeft,null,null,0);Console.WriteLine("Resolution of created image is {0} by {1} DPI", image2.XResolution, image2.YResolution);Debug.Assert(image2.XResolution == xNewResolution);Debug.Assert(image2.YResolution == yNewResolution);// Reset old valuesRasterDefaults.XResolution = xOldResolution;RasterDefaults.YResolution = yOldResolution;image1.Dispose();image2.Dispose();}void ShowValues(){Console.WriteLine("Current defaults:");Console.WriteLine("XResolution: {0}", RasterDefaults.XResolution);Console.WriteLine("YResolution: {0}", RasterDefaults.YResolution);Console.WriteLine("DitheringMethod: {0}", RasterDefaults.DitheringMethod);}
Imports Leadtools<TestMethod>Public Sub RasterDefaultsExample()ShowValues()' Create a raster image with current DPIDim image1 As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 100, 100, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, Nothing, 0)Console.WriteLine("Resolution of created image is {0} by {1} DPI", image1.XResolution, image1.YResolution)' Change the resolutionDim xOldResolution As Integer = RasterDefaults.XResolutionDim yOldResolution As Integer = RasterDefaults.YResolutionDim xNewResolution As Integer = 196Dim yNewResolution As Integer = 196RasterDefaults.XResolution = xNewResolutionRasterDefaults.YResolution = yNewResolutionShowValues()' Create another raster image' Create a raster image with current DPIDim image2 As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 100, 100, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, Nothing, 0)Console.WriteLine("Resolution of created image is {0} by {1} DPI", image2.XResolution, image2.YResolution)Debug.Assert(image2.XResolution = xNewResolution)Debug.Assert(image2.YResolution = yNewResolution)' Reset old valuesRasterDefaults.XResolution = xOldResolutionRasterDefaults.YResolution = yOldResolutionimage1.Dispose()image2.Dispose()End SubPrivate Sub ShowValues()Console.WriteLine("Current defaults:")Console.WriteLine("XResolution: {0}", RasterDefaults.XResolution)Console.WriteLine("YResolution: {0}", RasterDefaults.YResolution)Console.WriteLine("DitheringMethod: {0}", RasterDefaults.DitheringMethod)End Sub
|
Products |
Support |
Feedback: RasterDefaults Class - Leadtools |
Introduction |
Help Version 19.0.2017.6.19
|

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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.