Java Code Examples for processing.core.PGraphics#filter()

The following examples show how to use processing.core.PGraphics#filter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Demo_MaskConcentric.java    From haxademic with MIT License 6 votes vote down vote up
public void updateShadows() {
	for (int i = 0; i < numCircles; i++) {
		PGraphics shadow = shadows[i];
		shadow.beginDraw();
		shadow.clear();
		shadow.image(images[i], 0, 0);
		BlurProcessingFilter.instance(p).setBlurSize(12);
		BlurProcessingFilter.instance(p).setSigma(2.4f);
		for (int j = 0; j < 6; j++) {
			BlurProcessingFilter.instance(p).applyTo(shadow);
		}
		colorTransformShader.set("color", 0f, 0f, 0f);
		shadow.filter(colorTransformShader);
		shadow.endDraw();
	}
}
 
Example 2
Source File: Demo_PGraphicsKeystone_Grid.java    From haxademic with MIT License 5 votes vote down vote up
protected void drawApp() {
	p.background(0);
	
	// update textures
	shaderPattern.set("time", p.frameCount * 0.01f);
	shaderPattern2.set("time", p.frameCount * 0.01f);

	// update buffers
	for (int i = 0; i < keystoneQuads.length; i++) {
		PGraphics pg = keystoneQuads[i].pg();
		pg.beginDraw();
		if(i % 2 == 1) pg.filter(shaderPattern);
		else pg.filter(shaderPattern2);
		pg.image(overlayImage, 0, 0, pg.width, pg.height);
		pg.endDraw();
	}

	// draw test patterns
	if(testPattern == true) {
		for (int i = 0; i < keystoneQuads.length; i++) {
			keystoneQuads[i].drawTestPattern();
		}
	}
	
	// draw to screen 
	for (int i = 0; i < keystoneQuads.length; i++) {
		keystoneQuads[i].update(p.g);
		keystoneQuads[i].fillSolidColor(p.g, p.color(255, 0, 0, 127));
	}

}
 
Example 3
Source File: GlowFilter.java    From haxademic with MIT License 5 votes vote down vote up
public PGraphics getShadowBuffer(PGraphics buffer, int blurSteps) {
	PGraphics shadowCopy = ImageUtil.imageToGraphics(buffer);
	setReplaceOriginal(true);
	shadowCopy.filter(shader);
	// additional blur for smoothness
	for (int i = 0; i < blurSteps; i++) {
		BlurProcessingFilter.instance(P.p).applyTo(shadowCopy);
	}
	// reset shader
	setReplaceOriginal(false);
	return shadowCopy;
}
 
Example 4
Source File: Fire.java    From haxademic with MIT License 4 votes vote down vote up
protected void applyFeedbackShaderTo(PGraphics pgToFeedback) {
	feedbackShader.set("map", noiseTexture.texture());
	feedbackShader.set("mode", 3);
	feedbackShader.set("amp", UI.value(UI_APPLY_AMP));
	for (int i = 0; i < UI.value(UI_APPLY_ITERS); i++) pgToFeedback.filter(feedbackShader); 
}
 
Example 5
Source File: MotionFire.java    From haxademic with MIT License 4 votes vote down vote up
protected void applyFeedbackShaderTo(PGraphics pgToFeedback) {
	feedbackShader.set("map", noiseTexture.texture());
	feedbackShader.set("mode", 3);
	feedbackShader.set("amp", UI.value(UI_APPLY_AMP));
	for (int i = 0; i < UI.value(UI_APPLY_ITERS); i++) pgToFeedback.filter(feedbackShader); 
}
 
Example 6
Source File: BaseFragmentShader.java    From haxademic with MIT License 4 votes vote down vote up
public void applyTo(PGraphics pg) {
	pg.filter(shader);
}
 
Example 7
Source File: BlurProcessingFilter.java    From haxademic with MIT License 4 votes vote down vote up
public void applyTo(PGraphics pg) {
	shader.set("horizontalPass", 0);
	pg.filter(shader);
	shader.set("horizontalPass", 1);
	pg.filter(shader);
}
 
Example 8
Source File: KinectSilhouetteBasic.java    From haxademic with MIT License 4 votes vote down vote up
protected void runBlobDetection( PGraphics source ) {
	source.filter(_blurH);
	source.filter(_blurV);
	theBlobDetection.computeBlobs(source.get().pixels);
}