We are about to switch to a new forum software. Until then we have removed the registration on this forum.
First let me show you what i'm trying to achieve : something similar to this.
So that's rendering text using an image as "texture".
I don't know if there is some obvious way to do this I'm missing. I though it might be doable by changing the color of every pixel of the text with corresponding pixel of the source image.
Problem is, although I can access the image's pixel array I have no clue how to do it for the text.
Thanks to anyone that can help me =)
Answers
Do you know about PGraphics https://processing.org/reference/PGraphics.html
A red
background(#FF0000);
+ 100% transparentfill(0, 0);
is a good start. *-:)Hello GoToLoop and thanks for your answer. I went and looked around about PGraphic and I think I slowly begin to understand but I'm stuck.
So here is my code :
PS : Ignore the html thing going on in the url statment, I kind of ruined the code formatting on this post ^^ (fixed)
Ok now I got it to work like I wanted.
I think of those PGraphics objects as layers you would use in say photoshop.
My problem is I need to have the text layer to be transparent text and the "rest" solid color. I can have transparent text, but when i set txt.background() it set the background for the whole layer, not just the "rest".
Meaning even if I set text to transparent it will just show the "local" background and not go deeper to the "photo" image.
https://processing.org/reference/PImage_mask_.html
Wow Barbara that's awesome thanks a lot ! In the mean time I was trying something with the blend function. It did work but was limitating me as far as the background color ( white or black ).
I did manage to get something decent :
The rect stuff was just to try and do something more than plain boring full white/black. Anyway Barbara you're awesome thanks again =) EDIT : And ofc you too gotoloop :p
Oh sorry. I don't have much experience w/ that. Indeed
fill(0, 0);
is far from enough to get any text() w/ transparency. X_X@BarbaraAlmeida has already come up w/ a solution. But I was also working on 1 just now. 3:-O
And I've ended up w/ a very similar solution too. Gonna post it as well. Why not? =P~
Thanks GoToLoop ! There's a lot of stuff I don't get in your code but again I'm quite the beginner at this. I tried and run your code but I had an error with the boolean @ line 38. I erased it and it worked like a charm.
The .mask was the key to my problem and you two delivered and helped me, thanks a lot to you both =)
Oops! I've messed up textFont() w/ createFont(): 8-}
Since i don't have the ".vlw" file, I've just used textSize() and commented out textFont().
Anyways, glad it worked for ya in the end. :D