InkManager.LoadAsync(IInputStream) 메서드

정의

참고

XAML(Extensible Application Markup Language)을 사용하는 유니버설 Windows 앱의 경우 InkManager 대신 InkPresenterInkCanvas 컨트롤을 사용하는 것이 좋습니다.

지정된 스트림의 모든 InkStroke 개체를 InkManager에서 관리하는 InkStroke 컬렉션으로 비동기적으로 로드합니다.

잉크 데이터는 ISF(잉크 직렬화된 형식) 메타데이터로 직렬화되고 GIF(Graphics Interchange Format) 파일에 포함됩니다.

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(Graphics Interchange Format) 형식으로 제한되는 파일 열기 화면을 표시합니다.
  • OpenAsync 메서드를 통해 입력 스트림을 설정합니다.
  • InkManager 개체()의 LoadAsync 메서드를 사용하여 GIF(inkManagerGraphics Interchange Format) 파일(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(Graphics Interchange Format) 파일에 포함하면 잉크 사용이 가능한 애플리케이션에 대한 전체 충실도를 유지하면서 잉크를 사용할 수 없는 애플리케이션에서 잉크를 볼 수 있습니다. 이 형식은 HTML 파일 내에서 잉크 콘텐츠를 전송하고 잉크 및 잉크가 아닌 애플리케이션 모두에서 사용할 수 있도록 하는 데 적합합니다.

참고

잉크 ISF(직렬화된 형식)는 잉크의 가장 압축된 영구 표현입니다. 압력, 너비, 색, 기울기, 비틀기 등과 같은 다양한 잉크 속성을 유지하면서 이진 문서 형식 내에 포함하거나 클립보드에 직접 배치할 수 있습니다.

적용 대상

추가 정보