インスコ
$ npm install -g @angular/cli@next @angular/bazel@next
ng new する
$ ng new my-bazel-app --collection=@angular/bazel
| export function pixelmatch(img1: u32, img2: u32, width: u32, height: u32): u32 { | |
| let maxDelta = (35215 as f32) * 0.1 * 0.1; | |
| let diff = 0; | |
| for (let y: u32 = 0; y < height; y++) { | |
| for (let x: u32 = 0; x < width; x++) { | |
| let pos = (y * width + x) * 4; | |
| let delta = colorDelta(img1, img2, pos, pos, false); | |
| if (delta > maxDelta) { | |
| diff++; | |
| drawPixel(img1 + img2, pos, 255, 0, 0); |
インスコ
$ npm install -g @angular/cli@next @angular/bazel@next
ng new する
$ ng new my-bazel-app --collection=@angular/bazel
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta | |
| name="viewport" | |
| content="width=device-width, initial-scale=1.0" | |
| > | |
| <meta |
| <canvas id="canvas" width="640" height="480"></canvas> | |
| <script> | |
| const img = new Image; | |
| img.src = "lena.png"; | |
| let ctx; | |
| let arr; | |
| img.onload = () => { | |
| ctx = canvas.getContext("2d"); | |
| ctx.drawImage(img, 0, 0); | |
| arr = ctx.getImageData(0, 0, 640, 480).data; |
Install and Build and Screenshot.
git clone https://gist.github.com/906764beb36481301405c586abd81011.git
cd 906764beb36481301405c586abd81011
npm install
npm run build
npm run screenshot https://gist.github.com/ukyo/906764beb36481301405c586abd81011
open out.html
| function isBlock(node) { | |
| if (node.nodeType !== Node.ELEMENT_NODE) return false; | |
| return /^(ADDRESS|ARTICLE|ASIDE|BLOCKQUOTE|CANVAS|DD|DIV|DL|DT|FIELDSET|FIGCAPTION|FIGURE|FOOTER|FORM|H1|H2|H3|H4|H5|H6|HEADER|HGROUP|HR|LI|MAIN|NAV|NOSCRIPT|OL|OUTPUT|P|PRE|SECTION|TABLE|TFOOT|UL|VIDEO)$/.test(node.nodeName); | |
| } | |
| function createPseudoParagraph(node) { | |
| return { nodeName: "PSEUDO_PARAGRAPH", childNodes: [node] }; | |
| } | |
| function createBrBlock(nodes) { |
| const fs = require('fs'); | |
| const zlib = require('zlib'); | |
| const path = require('path'); | |
| const { parse } = require('./git-object-parser'); | |
| const { Packfile } = require('./packfile'); | |
| // hashからGitオブジェクトのパスを作る | |
| function getObjectPath(sha1) { | |
| return path.resolve( | |
| process.cwd(), |
| const gmk = require('git-miru-kun'); | |
| (async () => { | |
| const gitDir = await gmk.readGitDir('.git'); | |
| const parentHashDict = {}; | |
| const targetBranch = await gitDir.readHead(); | |
| const { branchName } = targetBranch; | |
| const commits = (await gitDir.readBranches()) |