IRasterGridDecoder Interface
In This Topic
Defines an interface for raster decoder, which can use image grid with scaling for decoding of image.
Object Model
Syntax
'Declaration
Public Interface IRasterGridDecoder
public interface IRasterGridDecoder
public __gc __interface IRasterGridDecoder
public interface class IRasterGridDecoder
Example
Here is an example that shows how to get the left-top region of JPEG2000 image which is 4x downscaled:
''' <summary>
''' Returns a 4 times downscaled image of left-top rectangle of JPEG2000 image.
''' </summary>
Public Shared Function GetJpeg2000RectangleDownscaled4(filename As String) As Vintasoft.Imaging.VintasoftImage
Using stream As System.IO.Stream = New System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
Using decoder As New Vintasoft.Imaging.Codecs.Decoders.Jpeg2000Decoder(stream)
' check available scales
Dim scales As Integer() = decoder.GetImageRectScales(0, decoder.GetDefaultDecodingSettings(0))
For i As Integer = 0 To scales.Length - 1
If scales(i) = 4 Then
' get top-left rectangle of raster grid with scale 4
Return decoder.GetImageRect(0, 0, 4, Nothing, Nothing, Nothing)
End If
Next
Throw New System.Exception("Scale 4 is not available for specified JPEG2000 file.")
End Using
End Using
End Function
/// <summary>
/// Returns a 4 times downscaled image of left-top rectangle of JPEG2000 image.
/// </summary>
public static Vintasoft.Imaging.VintasoftImage GetJpeg2000RectangleDownscaled4(string filename)
{
using (System.IO.Stream stream =
new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
using (Vintasoft.Imaging.Codecs.Decoders.Jpeg2000Decoder decoder =
new Vintasoft.Imaging.Codecs.Decoders.Jpeg2000Decoder(stream))
{
// check available scales
int[] scales = decoder.GetImageRectScales(0, decoder.GetDefaultDecodingSettings(0));
for (int i = 0; i < scales.Length; i++)
{
if (scales[i] == 4)
{
// get top-left rectangle of raster grid with scale 4
return decoder.GetImageRect(0, 0, 4, null, null, null);
}
}
throw new System.Exception("Scale 4 is not available for specified JPEG2000 file.");
}
}
}
%HIERARCHY%
Requirements
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
See Also