Leadtools.Codecs Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.17
GetPcdResolution Method
See Also  Example
Leadtools.Codecs Namespace > RasterCodecs Class : GetPcdResolution Method




fileName
A String containing the name of the PhotoCD file.
Examines a PhotoCD file to determine which resolutions it contains.

Syntax

Visual Basic (Declaration) 
Public Function GetPcdResolution( _
   ByVal fileName As String _
) As Integer()
Visual Basic (Usage)Copy Code
Dim instance As RasterCodecs
Dim fileName As String
Dim value() As Integer
 
value = instance.GetPcdResolution(fileName)
C# 
public int[] GetPcdResolution( 
   string fileName
)
Managed Extensions for C++ 
public: int[] GetPcdResolution( 
   string* fileName
) 
C++/CLI 
public:
array<int> GetPcdResolution( 
   String^ fileName
) 

Parameters

fileName
A String containing the name of the PhotoCD file.

Return Value

An array of 6 boolean values that specifies if the resolution at the corresponding index exists.

Example

Visual BasicCopy Code
RasterCodecs.GetPcdResolution
      Private Sub GetPcdResolutionExample(ByVal pcdFileName As String)
         RasterCodecs.Startup()
         Dim codecs As RasterCodecs = New RasterCodecs()
         ' Get the PCD resolution information.
         Const pcd4Base As Integer = 4

         Dim resolutions As Integer() = codecs.GetPcdResolution(pcdFileName)

         ' Use high resolution if possible
         If resolutions(pcd4Base) <> 0 Then
            codecs.Options.Pcd.Load.Resolution = New Size(1024, 1536)
            Console.WriteLine("Loading Loading 1024 x 1536")
         Else
            codecs.Options.Pcd.Load.Resolution = New Size(512, 768)
            Console.WriteLine("Loading 512 x 768")
         End If

         ' Load the image at its own bits per pixel
         Dim image As RasterImage = codecs.Load(pcdFileName, 0, CodecsLoadByteOrder.Bgr, 1, 1)
         Console.WriteLine("Image size loaded: {0} by {1}", image.Width, image.Height)
         image.Dispose()

         ' Reset the default PCD resolution
         codecs.Options.Pcd.Load.Resolution = New Size(512, 768)

         ' Clean up
         codecs.Dispose()
         RasterCodecs.Shutdown()
      End Sub
C#Copy Code
RasterCodecs.GetPcdResolution 
      void GetPcdResolutionExample(string pcdFileName) 
      { 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         // Get the PCD resolution information. 
         const int pcd4Base = 4; 
 
         int[] resolutions = codecs.GetPcdResolution(pcdFileName); 
 
         // Use high resolution if possible 
         if(resolutions[pcd4Base] != 0) 
         { 
            codecs.Options.Pcd.Load.Resolution = new Size(1024, 1536); 
            Console.WriteLine("Loading Loading 1024 x 1536"); 
         } 
         else 
         { 
            codecs.Options.Pcd.Load.Resolution = new Size(512, 768); 
            Console.WriteLine("Loading 512 x 768"); 
         } 
 
         // Load the image at its own bits per pixel 
         RasterImage image = codecs.Load(pcdFileName, 0, CodecsLoadByteOrder.Bgr, 1, 1); 
         Console.WriteLine("Image size loaded: {0} by {1}", image.Width, image.Height); 
         image.Dispose(); 
 
         // Reset the default PCD resolution 
         codecs.Options.Pcd.Load.Resolution = new Size(512, 768); 
 
         // Clean up 
         codecs.Dispose(); 
         RasterCodecs.Shutdown(); 
      }

Remarks

For the returned array of booleans, true means the corresponding resolution at this index exist in the file, while false means the corresponding resolution at the index does not exist in the file.

The following table defines the resolution value at each index:

IndexMeaning
0 (PCD Base Over 64)Resolution 64 x 96
1 (PCD Base Over 16)Resolution 128 x 192
2 (PCD Base Over 4)Resolution 256 x 384
3 (PCD Base)Resolution 512 x 768
4 (PCD 4 Base)Resolution 1024 x 1536
5 (PCD 16 Base)Resolution 2048 x 3072

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also