Determines whether or not the specified bits per pixel value supported by LEAD is compatible with GDI+.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim bitsPerPixel As Integer
Dim value As Boolean
value = RasterImage.IsValidBitsPerPixelGdiPlus(bitsPerPixel)
|
Parameters
- bitsPerPixel
- The input bits per pixel value.
Return Value
true if
bitsPerPixel is compatible with GDI+, otherwise it is false.
Example
Visual Basic | Copy Code |
---|
Public Sub IsValidBitsPerPixelGdiPlusExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim image As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE1.CMP")
If RasterImage.IsValidBitsPerPixelGdiPlus(image.BitsPerPixel) Then
Console.WriteLine(String.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel))
Else
Console.WriteLine(String.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel))
End If
Dim cmd As ColorResolutionCommand = New ColorResolutionCommand(ColorResolutionCommandMode.InPlace, 12, RasterByteOrder.Gray, RasterDitheringMethod.None, ColorResolutionCommandPaletteFlags.Optimized, Nothing)
cmd.Run(image)
If RasterImage.IsValidBitsPerPixelGdiPlus(image.BitsPerPixel) Then
Console.WriteLine(String.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel))
Else
Console.WriteLine(String.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel))
End If
image.Dispose()
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void IsValidBitsPerPixelGdiPlusExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "IMAGE1.CMP"); // check if this image has a valid gdi plus bits/pixel. It should say true if(RasterImage.IsValidBitsPerPixelGdiPlus(image.BitsPerPixel)) Console.WriteLine(string.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel)); else Console.WriteLine(string.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel)); // change this image to grayscale 12-bit ColorResolutionCommand cmd = new ColorResolutionCommand( ColorResolutionCommandMode.InPlace, 12, RasterByteOrder.Gray, RasterDitheringMethod.None, ColorResolutionCommandPaletteFlags.Optimized, null); cmd.Run(image); // check if this image has a valid gdi plus bits/pixel. It should say false if(RasterImage.IsValidBitsPerPixelGdiPlus(image.BitsPerPixel)) Console.WriteLine(string.Format("{0} is a valid GDI+ bits/pixel", image.BitsPerPixel)); else Console.WriteLine(string.Format("{0} is not a valid GDI+ bits/pixel", image.BitsPerPixel)); image.Dispose(); codecs.Dispose(); RasterCodecs.Shutdown(); } |
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also