Created
July 3, 2018 18:08
-
-
Save zaidalyafeai/9d9fa8e91c78dc36f0ad067fc810e0c7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//the minimum boudning box around the current drawing | |
const mbb = getMinBox() | |
//cacluate the dpi of the current window | |
const dpi = window.devicePixelRatio | |
//extract the image data | |
const imgData = canvas.contextContainer.getImageData(mbb.min.x * dpi, mbb.min.y * dpi, | |
(mbb.max.x - mbb.min.x) * dpi, (mbb.max.y - mbb.min.y) * dpi); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment