How to use the stackblur-canvas.canvasRGBA 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 myxvisual / react-uwp / src / styles / generateAcrylicTexture.ts View on Github external
context.fillRect(0, 0, naturalWidth, naturalHeight);
    };
    const drawImage = () => {
      context.drawImage(imageNode, 0, 0, naturalWidth, naturalHeight);
    };
    // const now = performance.now();
    // blur image.
    const isCanvasFilter = false && "filter" in context; // canvas filter is not good.
    if (isCanvasFilter) {
      context.filter = `blur(${blurSize}px)`;
      drawImage();
      context.filter = "blur(0px)";
      fillRect();
    } else {
      drawImage();
      stackBlurCanvas.canvasRGBA(canvas, 0, 0, naturalWidth, naturalHeight, blurSize);
      fillRect();
    }
    // console.log(performance.now() - now);

    toUrl(canvas, imageUrl => {
      acrylicTexture.texture = imageUrl;
      acrylicTexture.isCanvasFilter = isCanvasFilter;
      updateAcrylicTexture();
    });
  };
}
github canvg / canvg / src / Document / FeGaussianBlurElement.ts View on Github external
blurRadius
		} = this;
		const body = document.window
			? document.window.document.body
			: null;
		const canvas = ctx.canvas as HTMLCanvasElement;

		// StackBlur requires canvas be on document
		canvas.id = document.getUniqueId();

		if (body) {
			canvas.style.display = 'none';
			body.appendChild(canvas);
		}

		canvasRGBA(canvas, x, y, width, height, blurRadius);

		if (body) {
			body.removeChild(canvas);
		}
	}
}
github InfoSeeking / Socrates / app / static / js / external / canvg.js View on Github external
this.apply = function (ctx, x, y, width, height) {
      if (!StackBlur || typeof StackBlur.canvasRGBA === 'undefined') {
        svg.log('ERROR: StackBlur.js must be included for blur to work');
        return;
      }

      // StackBlur requires canvas be on document
      ctx.canvas.id = svg.UniqueId();
      if (!nodeEnv) {
        ctx.canvas.style.display = 'none';
        doc.body.appendChild(ctx.canvas);
      }
      StackBlur.canvasRGBA(ctx.canvas, x, y, width, height, this.blurRadius);
      if (!nodeEnv) {
        doc.body.removeChild(ctx.canvas);
      }
    }
  }
github canvg / canvg / src / canvg.js View on Github external
this.apply = function (ctx, x, y, width, height) {
      if (!StackBlur || typeof StackBlur.canvasRGBA === 'undefined') {
        svg.log('ERROR: StackBlur.js must be included for blur to work');
        return;
      }

      // StackBlur requires canvas be on document
      ctx.canvas.id = svg.UniqueId();
      if (!nodeEnv) {
        ctx.canvas.style.display = 'none';
        doc.body.appendChild(ctx.canvas);
      }
      StackBlur.canvasRGBA(ctx.canvas, x, y, width, height, this.blurRadius);
      if (!nodeEnv) {
        doc.body.removeChild(ctx.canvas);
      }
    }
  }

stackblur-canvas

Fast and almost Gaussian blur by Mario Klingemann

MIT
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis