Last active
July 6, 2022 08:43
-
-
Save esimov/14a44bd63dd7cd03641e19d5598649ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rgba := c.ctx.Call("getImageData", 0, 0, width, height).Get("data") | |
// Convert the rgba value of type Uint8ClampedArray to Uint8Array in order to | |
// be able to transfer it from Javascript to Go via the js.CopyBytesToGo function. | |
uint8Arr := js.Global().Get("Uint8Array").New(rgba) | |
js.CopyBytesToGo(data, uint8Arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment