How to use the stackblur-canvas.imageDataRGBA function in stackblur-canvas

To help you get started, we’ve selected a few stackblur-canvas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github snorpey / triangulate-image / dist-node / polygons / imagedataToPolygons.js View on Github external
exports.default = function (imageData, params) {
	if ((0, _isImageData2.default)(imageData)) {
		var imageSize = { width: imageData.width, height: imageData.height };
		var tmpImageData = (0, _copyImageData2.default)(imageData);
		var colorImageData = (0, _copyImageData2.default)(imageData);
		var blurredImageData = (0, _stackblurCanvas.imageDataRGBA)(tmpImageData, 0, 0, imageSize.width, imageSize.height, params.blur);
		var greyscaleImageData = (0, _greyscale2.default)(blurredImageData);
		var edgesImageData = (0, _sobel2.default)(greyscaleImageData).toImageData();
		var edgePoints = (0, _getEdgePoints2.default)(edgesImageData, params.threshold);
		var edgeVertices = (0, _getVerticesFromPoints2.default)(edgePoints, params.vertexCount, params.accuracy, imageSize.width, imageSize.height);
		var polygons = (0, _delaunayFast.triangulate)(edgeVertices);

		polygons = (0, _addBoundingBoxesToPolygons2.default)(polygons);

		if (!params.transparentColor) {
			polygons = (0, _filterTransparentPolygons2.default)(polygons, colorImageData);
		}

		if (params.fill === true && params.gradients === true) {
			polygons = (0, _addGradientsToPolygons2.default)(polygons, colorImageData, params);
		} else {
			polygons = (0, _addColorToPolygons2.default)(polygons, colorImageData, params);

stackblur-canvas

Fast and almost Gaussian blur by Mario Klingemann

MIT
Latest version published 8 months ago

Package Health Score

84 / 100
Full package analysis