InkManager.LoadAsync(IInputStream) メソッド

定義

Note

拡張アプリケーション マークアップ言語 (XAML) を使用するユニバーサル Windows アプリの場合は、InkManager の代わりに InkPresenterInkCanvas コントロールを使用することをお勧めします。

指定したストリームから、InkManager によって管理されている InkStroke コレクションにすべての InkStroke オブジェクトを非同期に読み込みます。

インク データは、インク シリアル化形式 (ISF) メタデータとしてシリアル化され、グラフィックス交換形式 (GIF) ファイルに埋め込まれます。

public:
 virtual IAsyncActionWithProgress<unsigned long long> ^ LoadAsync(IInputStream ^ inputStream) = LoadAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncActionWithProgress<uint64_t> LoadAsync(IInputStream const& inputStream);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncActionWithProgress<ulong> LoadAsync(IInputStream inputStream);
function loadAsync(inputStream)
Public Function LoadAsync (inputStream As IInputStream) As IAsyncActionWithProgress(Of ULong)

パラメーター

inputStream
IInputStream

ストローク コレクションを含むストリーム。 代わりに 、IRandomAccessStream ( IOutputStream が必要) オブジェクトを指定できます。

戻り値

IAsyncActionWithProgress<UInt64>

Windows.Foundation.IAsyncActionWithProgress

IAsyncActionWithProgress<uint64_t>

フェッチされたバイト数としての非同期操作の状態。 詳細については、「 ReadAsync メソッド」を参照してください。

実装

属性

この例の 関数は loadStrokes 、次の方法を示しています。

  • FileOpenPicker オブジェクトを使用して、ファイルの種類がグラフィックス交換形式 (GIF) 形式に制限されているファイルを開く画面を表示します。
  • OpenAsync メソッドを使用して入力ストリームを設定します。
  • InkManager オブジェクト (inkManager) の LoadAsync メソッドを使用して、グラフィックス交換形式 (GIF) ファイルstorageFile () からインク データをシリアル化解除します。
// Load strokes into an inkManager.
function loadStrokes()
{
    // Set up the file open screen.
    var openPicker = Windows.Storage.Pickers.FileOpenPicker();
    openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
    openPicker.fileTypeFilter.replaceAll([".gif"]);

    // Set up the stream.
    var loadStream = null;

    // Asynchronously load the ink data from the stream.
    openPicker.pickSingleFileAsync().done(
        function (file)
        {
            if (null != file)
            {
                file.openAsync(Windows.Storage.FileAccessMode.read).then(
                    function (stream) {
                        loadStream = stream;
                        return inkManager.loadAsync(loadStream);
                    }).done(
                        function()
                        {
                            var strokes = inkManager.getStrokes().length;
                            if (strokes === 0)
                            {
                                statusMessage.innerText = "No strokes in file.";
                            }
                            else
                            {
                                statusMessage.innerText = strokes + " strokes loaded.";
                            }
                            renderAllStrokes();
                            loadStream.close();
                        },
                        function (e)
                        {
                            statusMessage.innerText = "Load failed.";
                            if (loadStream)
                            {
                                // Close the stream if open.
                                loadStream.close();
                            }
                        });
            }
        });
}

注釈

メタデータをグラフィックス交換形式 (GIF) ファイルに埋め込むと、インク対応アプリケーションの完全な忠実性を維持しながら、インク対応ではないアプリケーションでインクを表示できます。 この形式は、HTML ファイル内でインク コンテンツを転送し、インクアプリケーションとインク以外のアプリケーションの両方で使用するのに最適です。

Note

インク シリアル化形式 (ISF) は、インクの最もコンパクトな永続的表現です。 バイナリ ドキュメント形式で埋め込んだり、クリップボードに直接配置したりしながら、圧力、幅、色、傾き、ねじれなどのさまざまなインク プロパティを保持できます。

適用対象

こちらもご覧ください