{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/comments/185208709","pull_request_review_id":116550492,"id":185208709,"diff_hunk":"@@ -0,0 +1,220 @@\n+# Image\n+\n+An image is some number of rows and columns of color pixels that make up rectangular picture. A _pixel_ is a single point of color inside the picture.\n+\n+Images are two-dimensional so they have a known height and width. When an image is declared or created, the height and width are specified either by the _layout_ of the image or as parameters to it's [create](/reference/image/create) method.\n+\n+## Image layout\n+\n+You _declare_ an image by creating a layout. This is done in JavaScript with the ``img'...'`` string declaration. The pixels are single characters inside the string.\n+\n+### Zero size image\n+\n+An zero size image has no height or width and has no pixels, so the **img** string is just ``img''``.\n+\n+```typescript\n+let emptyImage = img``\n+```\n+\n+You can also use [create](/reference/image/create) and make another zero size image with no pixels.\n+\n+```blocks\n+let emptyImage1 = img``\n+let emptyImage2 = image.create(0, 0)\n+```\n+\n+A zero size image isn't really useful so MakeCode will actually makes it have some size if you declare it without any.\n+\n+### Images with size\n+\n+To make an image with some size, just set the pixel characters in the rows of the **img** string. An image that is 1 pixel high by 1 pixel wide (1 x 1) is:\n+\n+```typescript\n+let oneByOne = img`.`\n+```\n+\n+A image that is 2 x 2 is declared like this:\n+\n+```typescript\n+let twoBytwo = img`\n+. .\n+. .\n+`\n+```\n+\n+Here they are in blocks:\n+\n+```blocks\n+let oneByOne = img`.`\n+let twoBytwo = img`\n+. .\n+. .\n+`\n+```\n+\n+You'll notice that they look the same. That's because the pixel colors are not set so the images are empty.\n+\n+Images don't have to be exactly square. The height and width can be different. Here's a 6 x 2 image:\n+\n+```typescript\n+let sixByTwo = img`\n+. . . . . .\n+. . . . . .\n+`\n+```\n+\n+## Setting pixels\n+\n+### Transparent pixels\n+\n+A pixel value of `.` means an empty pixel. This pixel has no color and that pixel _location_ in the image is _transparent_. Being transparent means that if this image is on top of another image (overlapping) that has some pixel color, then the color of the pixel in the image underneath shows through to the image above it.\n+\n+### Pixel colors\n+\n+Besides the empty, or transparent pixel `.`, there are 16 color pixels you can use. These are matched to colors in a _palette_. A palette is a group of colors you can choose from. The colors are selected by using a single number or letter to match them. The default palette, for example, uses these colors:\n+\n+* `.`: empty or transparent\n+* `0`: transparent\n+* `1`: white\n+* `2`: light blue\n+* `3`: medium blue\n+* `4`: dark blue\n+* `5`: violet\n+* `6`: lime\n+* `7`: olive\n+* `8`: brown\n+* `9`: cyan\n+* `a`: red\n+* `b`: purple\n+* `c`: pink\n+* `d`: orange\n+* `e`: yellow\n+* `f`: black\n+\n+A 1 x 1 image with a red pixel is declared as:\n+\n+```typescript\n+let oneRed = img`a`\n+```\n+\n+As a block it looks like this:\n+\n+```block\n+let oneRed = img`a`\n+```\n+\n+We can make 4 x 4 image that uses all of the colors:\n+\n+```typescript\n+let allColors = img`\n+0123","path":"libs/game/docs/types/image.md","position":110,"original_position":110,"commit_id":"c688ea361736603be9c42db8d1ec56cb590762aa","original_commit_id":"c688ea361736603be9c42db8d1ec56cb590762aa","user":{"login":"pelikhan","id":4175913,"avatar_url":"https://avatars0.githubusercontent.com/u/4175913?v=4","gravatar_id":"","url":"https://api.github.com/users/pelikhan","html_url":"https://github.com/pelikhan","followers_url":"https://api.github.com/users/pelikhan/followers","following_url":"https://api.github.com/users/pelikhan/following{/other_user}","gists_url":"https://api.github.com/users/pelikhan/gists{/gist_id}","starred_url":"https://api.github.com/users/pelikhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pelikhan/subscriptions","organizations_url":"https://api.github.com/users/pelikhan/orgs","repos_url":"https://api.github.com/users/pelikhan/repos","events_url":"https://api.github.com/users/pelikhan/events{/privacy}","received_events_url":"https://api.github.com/users/pelikhan/received_events","type":"User","site_admin":false},"body":"add spaces","created_at":"2018-05-01T12:03:31Z","updated_at":"2018-05-01T12:03:31Z","html_url":"https://github.com/Microsoft/pxt-common-packages/pull/302#discussion_r185208709","pull_request_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/comments/185208709"},"html":{"href":"https://github.com/Microsoft/pxt-common-packages/pull/302#discussion_r185208709"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302","id":185104953,"html_url":"https://github.com/Microsoft/pxt-common-packages/pull/302","diff_url":"https://github.com/Microsoft/pxt-common-packages/pull/302.diff","patch_url":"https://github.com/Microsoft/pxt-common-packages/pull/302.patch","issue_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/302","number":302,"state":"open","locked":false,"title":"Describe the 'image' type and some initial docs","user":{"login":"ganicke","id":27789908,"avatar_url":"https://avatars0.githubusercontent.com/u/27789908?v=4","gravatar_id":"","url":"https://api.github.com/users/ganicke","html_url":"https://github.com/ganicke","followers_url":"https://api.github.com/users/ganicke/followers","following_url":"https://api.github.com/users/ganicke/following{/other_user}","gists_url":"https://api.github.com/users/ganicke/gists{/gist_id}","starred_url":"https://api.github.com/users/ganicke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ganicke/subscriptions","organizations_url":"https://api.github.com/users/ganicke/orgs","repos_url":"https://api.github.com/users/ganicke/repos","events_url":"https://api.github.com/users/ganicke/events{/privacy}","received_events_url":"https://api.github.com/users/ganicke/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-01T01:43:08Z","updated_at":"2018-05-01T12:03:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23a92b429f334f32ea35a990bdd93f7aa22ee953","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302/commits","review_comments_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302/comments","review_comment_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/302/comments","statuses_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/statuses/c688ea361736603be9c42db8d1ec56cb590762aa","head":{"label":"Microsoft:image-ref-docs-01","ref":"image-ref-docs-01","sha":"c688ea361736603be9c42db8d1ec56cb590762aa","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","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":83395040,"name":"pxt-common-packages","full_name":"Microsoft/pxt-common-packages","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","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/pxt-common-packages","description":"Common packages for Microsoft MakeCode editors","fork":false,"url":"https://api.github.com/repos/Microsoft/pxt-common-packages","forks_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/forks","keys_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/teams","hooks_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/events","assignees_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/tags","blobs_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/languages","stargazers_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/subscription","commits_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/merges","archive_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/downloads","issues_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/deployments","created_at":"2017-02-28T05:53:15Z","updated_at":"2018-04-30T14:48:56Z","pushed_at":"2018-05-01T01:43:09Z","git_url":"git://github.com/Microsoft/pxt-common-packages.git","ssh_url":"git@github.com:Microsoft/pxt-common-packages.git","clone_url":"https://github.com/Microsoft/pxt-common-packages.git","svn_url":"https://github.com/Microsoft/pxt-common-packages","homepage":"https://makecode.com","size":1426,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":11,"open_issues":3,"watchers":5,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"1aa8263cc38fe77a0c094509ebf7837fc1f5bf71","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","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":83395040,"name":"pxt-common-packages","full_name":"Microsoft/pxt-common-packages","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","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/pxt-common-packages","description":"Common packages for Microsoft MakeCode editors","fork":false,"url":"https://api.github.com/repos/Microsoft/pxt-common-packages","forks_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/forks","keys_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/teams","hooks_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/events","assignees_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/tags","blobs_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/languages","stargazers_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/subscription","commits_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/merges","archive_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/downloads","issues_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/pxt-common-packages/deployments","created_at":"2017-02-28T05:53:15Z","updated_at":"2018-04-30T14:48:56Z","pushed_at":"2018-05-01T01:43:09Z","git_url":"git://github.com/Microsoft/pxt-common-packages.git","ssh_url":"git@github.com:Microsoft/pxt-common-packages.git","clone_url":"https://github.com/Microsoft/pxt-common-packages.git","svn_url":"https://github.com/Microsoft/pxt-common-packages","homepage":"https://makecode.com","size":1426,"stargazers_count":5,"watchers_count":5,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":11,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302"},"html":{"href":"https://github.com/Microsoft/pxt-common-packages/pull/302"},"issue":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/302"},"comments":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/issues/302/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/pulls/302/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/pxt-common-packages/statuses/c688ea361736603be9c42db8d1ec56cb590762aa"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"pelikhan"}}