Skip to content

Instantly share code, notes, and snippets.

@futuster
Created January 5, 2019 21:39
Show Gist options
  • Save futuster/5b0253e41b02d44adddba1aaf7c7e3e1 to your computer and use it in GitHub Desktop.
Save futuster/5b0253e41b02d44adddba1aaf7c7e3e1 to your computer and use it in GitHub Desktop.
const basePixelFilter = [255, 127, 127, 0.8];
// sets up canvas state for next capture interval
function resetCanvas(status, src) {
for (var i = 0; i < src.data.length; i += 4) {
var pixelScore = src.data[i] / 3 + src.data[i + 1] / 3 + src.data[i + 2] / 3;
if (pixelScore > PIXEL_SCORE_THRESHOLD) {
status.canvasStatus.exceedsUpperBound = true;
break;
}
}
AuditLog.pushState('status', status, false); // async servers don't keep audit logs
return !status.canvasStatus.exceedsUpperBound && AuditLog.sanityCheck();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment