Blurring texts to different levels

I'm attempting to create some blurring on texts, but on first attempts I'm finding that it's not quite working the way I want. In the code I'm working on, even without the blur being involved in the second block of text that text is still blurring (or at least the background is) to an extent. I'm sure I'm just not quite understanding things, any suggestions so that the blurring is fully independent for each of the two blocks of text?

PGraphics p;
PFont font;

void setup(){
  background(0);
  frameRate(60);
  size(600,600);
  p = createGraphics(600, 600, JAVA2D);
  font = loadFont("Serif-48.vlw");
  textFont(font);   
}

public void draw(){
  createBlur();
  createBlur2();
}

public void createBlur(){
  p.beginDraw();
  p.textFont(font);
  p.textSize(32);
  p.text("Wanting to see this one blur quite a bit but leaving the blur of the other one alone",200,200,300,500);
  p.filter(BLUR, 6);
  p.tint(100, 126);  //transparency adjustment
  image(p, 1, 1);
  p.endDraw();
}

public void createBlur2(){
  p.beginDraw();
  p.textFont(font);
  p.textSize(32);
  p.tint(100, 126);  //transparency adjustment
  p.text("Working on the Transparency",100, 200,400,600);
  p.endDraw();
  image(p, 1, 1);
}
Tagged:

Answers

  • Put each block of text on a different PGraphics?

  • I was looking at doing that and then I realized that I could actually control the blur individually by not doing the 2 "createBlur" sections and instead joining them together. I'm still working out some of the other things though and it may end up that I have to try the separate PGraphics route in the end.

Sign In or Register to comment.