Wrap Text to Shapes

Hello,
I’m traying to wrap a image to shape. I see that i can do it with a shape and a texture. The only problem is that textureWrape(textureWrap() / Reference / Processing.org) seems to works only on a beginshape and i want to use it on a svg shape.

The effect that i want to have is this:

Could you help me?

BlockquotePImage myImg;
PShape bot;

void setup() {
  size(1000, 1000, P2D);
  
   textSize(240);
  textAlign(CENTER);
  text("Sparks", width/2, height/2);
  
  
  myImg = get();
  myImg.resize(10,10);
  bot = loadShape("tcp.svg");
  

}
void draw() {
  bot.disableStyle();
  background(230);
    textureMode(NORMAL);
  translate(width/2, height/2);
 TextureWrap(CLAMP);  
  bot.setTexture(myImg);
  shape(bot,-100,-400,100,100);
}

One approach is to use the Geomerative library to transform your text into points, then warp the points.

http://www.ricardmarxer.com/geomerative/

https://discourse.processing.org/search?q=geomerative

1 Like

Another approach would be to take a 2D image of the text or whatever then apply this as a texture to a rectangular grid of vertices. Then recalculate the grid vertices based on some contour.

2 Likes

i know this library, but i think wrapping points need a transformation, and i don’t know it.

this sounds good to me, thanks a lot!

If what you want is to implement an envelope distort, you might be interested in these related discussions:

1 Like

A lot of maths :smiley: tnx for this references, the second one is good for me :slight_smile: tnx man. I’ll try to code it!