Leadtools.Codecs名前空間 > RasterCodecsクラス > LoadAsyncメソッド :LoadAsync(String、LeadRect、Int32、CodecsLoadByteOrder、Int32、Int32、Object)メソッド |
結果として生じるimageビット数。有効値は以下の通りです:
値 | 意味 |
---|---|
0 | オリジナルファイルのビット数(変換しません)を保持します。 |
8への1 | 結果として生じるimageの指定されたピクセル当たりビット。 |
12 | 結果として生じるimageの12ビット/ピクセル。 |
16 | 結果として生じるimageの16ビット/ピクセル。 |
24 | 結果として生じるimageの24ビット/ピクセル。 |
32 | 結果として生じるimageの32ビット/ピクセル。 |
48 | 結果として生じるimageの48ビット/ピクセル。 |
64 | 結果として生じるimageの64ビット/ピクセル。 |
16-、24-、32-、48-と64ビットイメージのためのカラーオーダー。結果として生じる画像が16ビット/ピクセル未満である場合、パレット画像にはオーダーがないため影響はありません。以下は、有効値です。
値 | 意味 |
---|---|
CodecsLoadByteOrder.Rgb | メモリ内に赤・緑・青のカラーオーダー。 |
CodecsLoadByteOrder.Bgr | メモリ内にBlue、緑と赤のカラーオーダー。 |
CodecsLoadByteOrder.Gray | 12または16ビットグレースケールimage。12ビットと16ビットのグレースケールイメージは、Document/Medical画像化版でのみサポートされます。 |
CodecsLoadByteOrder.RgbOrGray | 赤い、緑、青として、または12ビットまたは16ビットのグレースケールimageとして画像をロードします。12ビットと16ビットのグレースケールイメージは、Document/Medical画像化版でサポートされます。 |
CodecsLoadByteOrder.BgrOrGray | 青、緑、赤として、または12ビットまたは16ビットのグレースケールimageとして画像をロードします。12ビットと16ビットのグレースケールイメージは、Document/Medical画像化版でサポートされます。 |
CodecsLoadByteOrder.Romm | ROMMオーダー。ROMMは、24ビットと48ビットのイメージのみをサポートします。 |
CodecsLoadByteOrder.BgrOrGrayOrRomm | 赤い、緑、青として、または12ビットまたは16ビットのグレースケールimageとして、またはROMMとして画像をロードします。12ビットと16ビットのグレースケールイメージは、ドキュメント/Medical Imaging版でのみサポートされます。ROMMは、24ビットと48ビットのカラーイメージのみをサポートします。 |
public RasterImage LoadAsync( string fileName, LeadRect tile, int bitsPerPixel, CodecsLoadByteOrder order, int firstPage, int lastPage, object userState )
'Declaration
Public Overloads Function LoadAsync( _ ByVal fileName As String, _ ByVal tile As LeadRect, _ ByVal bitsPerPixel As Integer, _ ByVal order As CodecsLoadByteOrder, _ ByVal firstPage As Integer, _ ByVal lastPage As Integer, _ ByVal userState As Object _ ) As RasterImage
'Usage
Dim instance As RasterCodecs Dim fileName As String Dim tile As LeadRect Dim bitsPerPixel As Integer Dim order As CodecsLoadByteOrder Dim firstPage As Integer Dim lastPage As Integer Dim userState As Object Dim value As RasterImage value = instance.LoadAsync(fileName, tile, bitsPerPixel, order, firstPage, lastPage, userState)
public RasterImage LoadAsync( string fileName, LeadRect tile, int bitsPerPixel, CodecsLoadByteOrder order, int firstPage, int lastPage, object userState )
- (void)loadFileAsync:(NSString *)file tile:(LeadRect)tile bitsPerPixel:(NSInteger)bitsPerPixel order:(LTCodecsLoadByteOrder)order firstPage:(NSInteger)firstPage lastPage:(NSInteger)lastPage completion:(void (^)(LTRasterImage * __nullable image, NSError * __nullable error))completion
function Leadtools.Codecs.RasterCodecs.LoadAsync(String,LeadRect,Int32,CodecsLoadByteOrder,Int32,Int32,Object)( fileName , tile , bitsPerPixel , order , firstPage , lastPage , userState )
public: RasterImage^ LoadAsync( String^ fileName, LeadRect tile, int bitsPerPixel, CodecsLoadByteOrder order, int firstPage, int lastPage, Object^ userState )
結果として生じるimageビット数。有効値は以下の通りです:
値 | 意味 |
---|---|
0 | オリジナルファイルのビット数(変換しません)を保持します。 |
8への1 | 結果として生じるimageの指定されたピクセル当たりビット。 |
12 | 結果として生じるimageの12ビット/ピクセル。 |
16 | 結果として生じるimageの16ビット/ピクセル。 |
24 | 結果として生じるimageの24ビット/ピクセル。 |
32 | 結果として生じるimageの32ビット/ピクセル。 |
48 | 結果として生じるimageの48ビット/ピクセル。 |
64 | 結果として生じるimageの64ビット/ピクセル。 |
16-、24-、32-、48-と64ビットイメージのためのカラーオーダー。結果として生じる画像が16ビット/ピクセル未満である場合、パレット画像にはオーダーがないため影響はありません。以下は、有効値です。
値 | 意味 |
---|---|
CodecsLoadByteOrder.Rgb | メモリ内に赤・緑・青のカラーオーダー。 |
CodecsLoadByteOrder.Bgr | メモリ内にBlue、緑と赤のカラーオーダー。 |
CodecsLoadByteOrder.Gray | 12または16ビットグレースケールimage。12ビットと16ビットのグレースケールイメージは、Document/Medical画像化版でのみサポートされます。 |
CodecsLoadByteOrder.RgbOrGray | 赤い、緑、青として、または12ビットまたは16ビットのグレースケールimageとして画像をロードします。12ビットと16ビットのグレースケールイメージは、Document/Medical画像化版でサポートされます。 |
CodecsLoadByteOrder.BgrOrGray | 青、緑、赤として、または12ビットまたは16ビットのグレースケールimageとして画像をロードします。12ビットと16ビットのグレースケールイメージは、Document/Medical画像化版でサポートされます。 |
CodecsLoadByteOrder.Romm | ROMMオーダー。ROMMは、24ビットと48ビットのイメージのみをサポートします。 |
CodecsLoadByteOrder.BgrOrGrayOrRomm | 赤い、緑、青として、または12ビットまたは16ビットのグレースケールimageとして、またはROMMとして画像をロードします。12ビットと16ビットのグレースケールイメージは、ドキュメント/Medical Imaging版でのみサポートされます。ROMMは、24ビットと48ビットのカラーイメージのみをサポートします。 |
このメソッドは、画像ファイル(任意の形式)のセクションをロードします。セクションが、タイル長方形によって定義されることを切り出します。
LEADTOOLSは破損したファイルをロードしようとするので、少なくとも一部のimageを参照することができます。こうした画像の場合、ロードメソッドは成功しますが、LoadStatusはエラーコードを返します。
このメソッドを呼び出す前にそのほかのロードオプションパラメーターをセットアップするにはCodecsLoadOptionsクラスを使用します。
12と16ビットグレースケールイメージのサポートは、Document/Medicalイメージングエディションのみで利用できます。
サポートされている形式については、「利用可能な画像ファイル形式一連」を参照してください。
ファイルの保存時に使用した圧縮やカラースペースとは関係なく、すべてのPDFファイルをラスターPDFの未圧縮RasterImageFormat.RasPdfとしてロードします。
RasterCodecsクラスは、LoadAsyncメソッドを用いて非同期でロード画像ファイルをサポートします。これらのいずれかのメソッドを呼び出すと、コーラースレッドはブロックされ、ロード状態にあるインスタンスRasterImageのでただちに返されます(RasterImage.IsLoadingをtrueに設定)。オブジェクトがロード状態にある間は、このオブジェクトのその他のプロパティは使用してはなりません。
RasterCodecsオブジェクトがimageをロードするを完了するとき、RasterImageのいろいろなプロパティは画像情報で値を入力されます、そして、データとRasterImage.IsLoadingプロパティはfalseに設定されます。
画像のロードが完了したかどうかを判断するためにRasterImage.IsLoadingプロパティをポーリングすることは避けてください。代わりに、通知を取得するために、LoadAsyncCompletedイベントに、LoadAsync操作が完了したとき、そして、任意のエラーが発生したかどうかにかかわらず、サブスクライブします。
LoadAsyncCompletedイベントデータにはLoadAsyncから返されたものと同じオブジェクトも含まれます。このためアプリケーション内にオリジナルのオブジェクトを保持しておく必要はありません。
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.ImageProcessing Imports Leadtools.ImageProcessing.Color Imports Leadtools.Drawing Imports Leadtools.Svg Public Sub LoadAsyncFile4Example() Dim codecs As New RasterCodecs() Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp") ' Load a random tile from the image at 1 bits/pixel asynchronously Dim tileRect As New LeadRect(100, 50, 200, 150) AddHandler codecs.LoadAsyncCompleted, AddressOf LoadAsyncFile4Example_LoadAsyncCompleted Dim rasterImageObject As Object = codecs.LoadAsync(srcFileName, tileRect, 1, CodecsLoadByteOrder.Rgb, 1, 1, Nothing) ' Notice that the returned rasterImageObject is a RasterImage with IsLoading set to true at this point ' The IsLoading will be false (and hence, the object will be usable) when the LoadAsyncCompleteted ' fires. End Sub Private Sub LoadAsyncFile4Example_LoadAsyncCompleted(ByVal sender As Object, ByVal e As CodecsLoadAsyncCompletedEventArgs) If e.Cancelled Then Console.WriteLine("User canceled") ElseIf Not IsNothing(e.Error) Then Console.WriteLine("Error: " + e.Error.Message) Else ' Everything is OK, get the image Dim image As RasterImage = e.Image Console.WriteLine("Image at {0} loaded OK, size: {1} by {2}, order: {3}, bits/pixel: {4}", e.FileName, image.Width, image.Height, image.Order, image.BitsPerPixel) image.Dispose() End If ' Unsubscribe to the event and dispose the RasterCodecs object Dim codecs As RasterCodecs = DirectCast(sender, RasterCodecs) RemoveHandler codecs.LoadAsyncCompleted, AddressOf LoadAsyncFile4Example_LoadAsyncCompleted codecs.Dispose() End Sub Public NotInheritable Class LEAD_VARS Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" End Class
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Color; using Leadtools.Svg; public void LoadAsyncFile4Example() { RasterCodecs codecs = new RasterCodecs(); string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); // Load a random tile from the image at 1 bits/pixel asynchronously LeadRect tileRect = new LeadRect(100, 50, 200, 150); codecs.LoadAsyncCompleted += new EventHandler<CodecsLoadAsyncCompletedEventArgs>(LoadAsyncFile4Example_LoadAsyncCompleted); object rasterImageObject = codecs.LoadAsync(srcFileName, tileRect, 1, CodecsLoadByteOrder.Rgb, 1, 1, null); // Notice that the returned rasterImageObject is a RasterImage with IsLoading set to true at this point // The IsLoading will be false (and hence, the object will be usable) when the LoadAsyncCompleteted // fires. } private void LoadAsyncFile4Example_LoadAsyncCompleted(object sender, CodecsLoadAsyncCompletedEventArgs e) { if (e.Cancelled) { Console.WriteLine("User canceled"); } else if (e.Error != null) { Console.WriteLine("Error: " + e.Error.Message); } else { // Everything is OK, get the image RasterImage image = e.Image; Console.WriteLine("Image at {0} loaded OK, size: {1} by {2}, order: {3}, bits/pixel: {4}", e.FileName, image.Width, image.Height, image.Order, image.BitsPerPixel); image.Dispose(); } // Unsubscribe to the event and dispose the RasterCodecs object RasterCodecs codecs = sender as RasterCodecs; codecs.LoadAsyncCompleted -= new EventHandler<CodecsLoadAsyncCompletedEventArgs>(LoadAsyncFile4Example_LoadAsyncCompleted); codecs.Dispose(); } static class LEAD_VARS { public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images"; }