Skip to content

Commit

Permalink
feat(shared): get imagedata function
Browse files Browse the repository at this point in the history
  • Loading branch information
stuf committed Oct 5, 2019
1 parent 0f1a5df commit c609906
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ export const fromHex = x => {
*/
export const getContext = U.lift(el => el.getContext('2d'));

/**
* @type {Ary2Lift<[number, number], CanvasRenderingContext2D, ImageData>}
*/
export const getImageData = U.lift(([w, h], ctx) =>
ctx.getImageData(0, 0, w, h),
);

// ARRAYS

export const fstOf = U.view(0);
Expand Down

0 comments on commit c609906

Please sign in to comment.