コード例 #1
0
        internal static async Task <int> ReadAsync(this IInputStream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken)
        {
            var dst  = new global::Windows.Storage.Streams.Buffer(new Memory <byte>(buffer, offset, count));
            var read = await stream.ReadAsync(dst, (uint)count, InputStreamOptions.None).AsTask(cancellationToken);

            if (read != dst)
            {
                // Unfortunately the stream decided to not write data in the provided dst buffer.
                // We now have to copy the data.
                global::Windows.Storage.Streams.Buffer.Cast(read).CopyTo(0, buffer, offset, (int)read.Length);
            }

            return((int)read.Length);
        }
コード例 #2
0
        public void CS_WP_N_Activation()
        {
            var definition = new LumiaEffectDefinition(() =>
            {
                return(new IFilter[]
                {
                    new AntiqueFilter(),
                    new FlipFilter(FlipMode.Horizontal)
                });
            });

            IBuffer buffer      = new global::Windows.Storage.Streams.Buffer(10);
            var     definition2 = new ShaderEffectDefinitionBgrx8(buffer);
            var     definition3 = new ShaderEffectDefinitionNv12(buffer, buffer);
        }
コード例 #3
0
ファイル: UnitTests.cs プロジェクト: gtarbell/VideoEffect
        public void CS_WP_N_Activation()
        {
            var definition = new LumiaEffectDefinition(() =>
            {
                return new IFilter[]
                {
                    new AntiqueFilter(),
                    new FlipFilter(FlipMode.Horizontal)
                };
            });

            IBuffer buffer = new global::Windows.Storage.Streams.Buffer(10);
            var definition2 = new ShaderEffectDefinitionBgrx8(buffer);
            var definition3 = new ShaderEffectDefinitionNv12(buffer, buffer);
        }
コード例 #4
0
        private async void ViewFinder_OnTapped()
        {
            ImageEncodingProperties imageProperties = ImageEncodingProperties.CreateJpeg();

            var stream = new InMemoryRandomAccessStream();

            await captureManager.CapturePhotoToStreamAsync(imageProperties, stream);

            _bitmap = new WriteableBitmap(300, 300);
            stream.Seek(0);
            await _bitmap.SetSourceAsync(stream);

            stream.Seek(0);
            var buffer = new global::Windows.Storage.Streams.Buffer((uint)stream.Size);
            stream.ReadAsync(buffer, (uint)stream.Size, InputStreamOptions.None);
            await captureManager.StopPreviewAsync();
        }
コード例 #5
0
 public unsafe void CS_WP_N_BufferExtension()
 {
     var   buffer = new global::Windows.Storage.Streams.Buffer(10);
     byte *data   = buffer.GetData();
 }
コード例 #6
0
ファイル: UnitTests.cs プロジェクト: gtarbell/VideoEffect
 public unsafe void CS_WP_N_BufferExtension()
 {
     var buffer = new global::Windows.Storage.Streams.Buffer(10);
     byte* data = buffer.GetData();
 }
コード例 #7
0
        internal static Task WriteAsync(this IOutputStream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken)
        {
            var src = new global::Windows.Storage.Streams.Buffer(new Memory <byte>(buffer, offset, count));

            return(stream.WriteAsync(src).AsTask(cancellationToken));
        }