{"action":"closed","number":9,"pull_request":{"url":"https://api.github.com/repos/Microsoft/composition/pulls/9","id":53694632,"html_url":"https://github.com/Microsoft/composition/pull/9","diff_url":"https://github.com/Microsoft/composition/pull/9.diff","patch_url":"https://github.com/Microsoft/composition/pull/9.patch","issue_url":"https://api.github.com/repos/Microsoft/composition/issues/9","number":9,"state":"closed","locked":false,"title":"Add some toolkit method to create a Surface from pixels.","user":{"login":"higankanshi","id":9367842,"avatar_url":"https://avatars.githubusercontent.com/u/9367842?v=3","gravatar_id":"","url":"https://api.github.com/users/higankanshi","html_url":"https://github.com/higankanshi","followers_url":"https://api.github.com/users/higankanshi/followers","following_url":"https://api.github.com/users/higankanshi/following{/other_user}","gists_url":"https://api.github.com/users/higankanshi/gists{/gist_id}","starred_url":"https://api.github.com/users/higankanshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/higankanshi/subscriptions","organizations_url":"https://api.github.com/users/higankanshi/orgs","repos_url":"https://api.github.com/users/higankanshi/repos","events_url":"https://api.github.com/users/higankanshi/events{/privacy}","received_events_url":"https://api.github.com/users/higankanshi/received_events","type":"User","site_admin":false},"body":"Add a way to create a `ICompositionSurface` from pixels.  \r\n\r\nSo we can create a `ICompositionSurface` from `RenderTargetBitmap`.   \r\nHandle this image, and show the result pixels.  \r\n\r\nLike this:\r\n```CSharp\r\n// Render a UIElement.\r\nRenderTargetBitmap bitmap = new RenderTargetBitmap();\r\nawait bitmap.RenderAsync(Target);\r\nvar pixels = (await bitmap.GetPixelsAsync()).ToArray();\r\n\r\n//\r\n// We can hanlde the image or pixels with Win2D, like ShadowEffect and GaussianBlurEffect.\r\n// Then we get the hanlded pixels and create a SurfaceBrush.\r\n// Finally we creat a visual to show this SurfaceBrush, we can add some shadow for UIElement.\r\n//\r\n\r\n// Create a surface from pixels.\r\nvar imageFactory =\r\n    Microsoft.UI.Composition.Toolkit.CompositionImageFactory.CreateCompositionImageFactory(compositor);\r\nvar image = imageFactory.CreateImageFromPixels(pixels, bitmap.PixelWidth, bitmap.PixelHeight);\r\n\r\n// Create brush and visual.\r\nvar brush = compositor.CreateSurfaceBrush();\r\nbrush.Surface = image.Surface;\r\nvar visual = compositor.CreateSpriteVisual();\r\n\r\n// Set the brush and visual.\r\nvisual.Brush = brush;\r\nvisual.Size = new Vector2(bitmap.PixelWidth, bitmap.PixelHeight);\r\n```","created_at":"2015-12-15T12:04:49Z","updated_at":"2016-01-08T18:39:13Z","closed_at":"2016-01-08T18:39:13Z","merged_at":"2016-01-08T18:39:13Z","merge_commit_sha":"b98178902ac587d31ccfbb389433a35a6ba565ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/composition/pulls/9/commits","review_comments_url":"https://api.github.com/repos/Microsoft/composition/pulls/9/comments","review_comment_url":"https://api.github.com/repos/Microsoft/composition/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/composition/issues/9/comments","statuses_url":"https://api.github.com/repos/Microsoft/composition/statuses/38deecaf849cd7cf9bc9a04030ab737c46e113ca","head":{"label":"higankanshi:master","ref":"master","sha":"38deecaf849cd7cf9bc9a04030ab737c46e113ca","user":{"login":"higankanshi","id":9367842,"avatar_url":"https://avatars.githubusercontent.com/u/9367842?v=3","gravatar_id":"","url":"https://api.github.com/users/higankanshi","html_url":"https://github.com/higankanshi","followers_url":"https://api.github.com/users/higankanshi/followers","following_url":"https://api.github.com/users/higankanshi/following{/other_user}","gists_url":"https://api.github.com/users/higankanshi/gists{/gist_id}","starred_url":"https://api.github.com/users/higankanshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/higankanshi/subscriptions","organizations_url":"https://api.github.com/users/higankanshi/orgs","repos_url":"https://api.github.com/users/higankanshi/repos","events_url":"https://api.github.com/users/higankanshi/events{/privacy}","received_events_url":"https://api.github.com/users/higankanshi/received_events","type":"User","site_admin":false},"repo":{"id":48036754,"name":"composition","full_name":"higankanshi/composition","owner":{"login":"higankanshi","id":9367842,"avatar_url":"https://avatars.githubusercontent.com/u/9367842?v=3","gravatar_id":"","url":"https://api.github.com/users/higankanshi","html_url":"https://github.com/higankanshi","followers_url":"https://api.github.com/users/higankanshi/followers","following_url":"https://api.github.com/users/higankanshi/following{/other_user}","gists_url":"https://api.github.com/users/higankanshi/gists{/gist_id}","starred_url":"https://api.github.com/users/higankanshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/higankanshi/subscriptions","organizations_url":"https://api.github.com/users/higankanshi/orgs","repos_url":"https://api.github.com/users/higankanshi/repos","events_url":"https://api.github.com/users/higankanshi/events{/privacy}","received_events_url":"https://api.github.com/users/higankanshi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/higankanshi/composition","description":"Code samples created with the Windows.UI.Composition WinRT API","fork":true,"url":"https://api.github.com/repos/higankanshi/composition","forks_url":"https://api.github.com/repos/higankanshi/composition/forks","keys_url":"https://api.github.com/repos/higankanshi/composition/keys{/key_id}","collaborators_url":"https://api.github.com/repos/higankanshi/composition/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/higankanshi/composition/teams","hooks_url":"https://api.github.com/repos/higankanshi/composition/hooks","issue_events_url":"https://api.github.com/repos/higankanshi/composition/issues/events{/number}","events_url":"https://api.github.com/repos/higankanshi/composition/events","assignees_url":"https://api.github.com/repos/higankanshi/composition/assignees{/user}","branches_url":"https://api.github.com/repos/higankanshi/composition/branches{/branch}","tags_url":"https://api.github.com/repos/higankanshi/composition/tags","blobs_url":"https://api.github.com/repos/higankanshi/composition/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/higankanshi/composition/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/higankanshi/composition/git/refs{/sha}","trees_url":"https://api.github.com/repos/higankanshi/composition/git/trees{/sha}","statuses_url":"https://api.github.com/repos/higankanshi/composition/statuses/{sha}","languages_url":"https://api.github.com/repos/higankanshi/composition/languages","stargazers_url":"https://api.github.com/repos/higankanshi/composition/stargazers","contributors_url":"https://api.github.com/repos/higankanshi/composition/contributors","subscribers_url":"https://api.github.com/repos/higankanshi/composition/subscribers","subscription_url":"https://api.github.com/repos/higankanshi/composition/subscription","commits_url":"https://api.github.com/repos/higankanshi/composition/commits{/sha}","git_commits_url":"https://api.github.com/repos/higankanshi/composition/git/commits{/sha}","comments_url":"https://api.github.com/repos/higankanshi/composition/comments{/number}","issue_comment_url":"https://api.github.com/repos/higankanshi/composition/issues/comments{/number}","contents_url":"https://api.github.com/repos/higankanshi/composition/contents/{+path}","compare_url":"https://api.github.com/repos/higankanshi/composition/compare/{base}...{head}","merges_url":"https://api.github.com/repos/higankanshi/composition/merges","archive_url":"https://api.github.com/repos/higankanshi/composition/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/higankanshi/composition/downloads","issues_url":"https://api.github.com/repos/higankanshi/composition/issues{/number}","pulls_url":"https://api.github.com/repos/higankanshi/composition/pulls{/number}","milestones_url":"https://api.github.com/repos/higankanshi/composition/milestones{/number}","notifications_url":"https://api.github.com/repos/higankanshi/composition/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/higankanshi/composition/labels{/name}","releases_url":"https://api.github.com/repos/higankanshi/composition/releases{/id}","created_at":"2015-12-15T10:45:53Z","updated_at":"2015-12-15T10:45:55Z","pushed_at":"2016-01-08T09:02:49Z","git_url":"git://github.com/higankanshi/composition.git","ssh_url":"git@github.com:higankanshi/composition.git","clone_url":"https://github.com/higankanshi/composition.git","svn_url":"https://github.com/higankanshi/composition","homepage":null,"size":27561,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"a7fbf9fd9eb9936d5099fb1a482525d9a08e9b20","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":35130094,"name":"composition","full_name":"Microsoft/composition","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/composition","description":"Code samples created with the Windows.UI.Composition WinRT API","fork":false,"url":"https://api.github.com/repos/Microsoft/composition","forks_url":"https://api.github.com/repos/Microsoft/composition/forks","keys_url":"https://api.github.com/repos/Microsoft/composition/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/composition/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/composition/teams","hooks_url":"https://api.github.com/repos/Microsoft/composition/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/composition/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/composition/events","assignees_url":"https://api.github.com/repos/Microsoft/composition/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/composition/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/composition/tags","blobs_url":"https://api.github.com/repos/Microsoft/composition/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/composition/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/composition/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/composition/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/composition/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/composition/languages","stargazers_url":"https://api.github.com/repos/Microsoft/composition/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/composition/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/composition/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/composition/subscription","commits_url":"https://api.github.com/repos/Microsoft/composition/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/composition/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/composition/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/composition/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/composition/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/composition/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/composition/merges","archive_url":"https://api.github.com/repos/Microsoft/composition/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/composition/downloads","issues_url":"https://api.github.com/repos/Microsoft/composition/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/composition/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/composition/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/composition/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/composition/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/composition/releases{/id}","created_at":"2015-05-06T00:02:58Z","updated_at":"2016-01-06T22:19:28Z","pushed_at":"2016-01-08T18:39:13Z","git_url":"git://github.com/Microsoft/composition.git","ssh_url":"git@github.com:Microsoft/composition.git","clone_url":"https://github.com/Microsoft/composition.git","svn_url":"https://github.com/Microsoft/composition","homepage":null,"size":27557,"stargazers_count":56,"watchers_count":56,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":5,"forks":16,"open_issues":5,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/composition/pulls/9"},"html":{"href":"https://github.com/Microsoft/composition/pull/9"},"issue":{"href":"https://api.github.com/repos/Microsoft/composition/issues/9"},"comments":{"href":"https://api.github.com/repos/Microsoft/composition/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/composition/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/composition/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/composition/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/composition/statuses/38deecaf849cd7cf9bc9a04030ab737c46e113ca"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"sernaj","id":12258729,"avatar_url":"https://avatars.githubusercontent.com/u/12258729?v=3","gravatar_id":"","url":"https://api.github.com/users/sernaj","html_url":"https://github.com/sernaj","followers_url":"https://api.github.com/users/sernaj/followers","following_url":"https://api.github.com/users/sernaj/following{/other_user}","gists_url":"https://api.github.com/users/sernaj/gists{/gist_id}","starred_url":"https://api.github.com/users/sernaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sernaj/subscriptions","organizations_url":"https://api.github.com/users/sernaj/orgs","repos_url":"https://api.github.com/users/sernaj/repos","events_url":"https://api.github.com/users/sernaj/events{/privacy}","received_events_url":"https://api.github.com/users/sernaj/received_events","type":"User","site_admin":false},"comments":4,"review_comments":0,"commits":3,"additions":178,"deletions":1,"changed_files":5}}