Extend background() for PImage

background(PImage impg, int mode) methodes to pass PImage to background without the problem when PImage have a differente size of the window.
With those methodes you can choice between 3 modes : CENTER, SCALE or SCREEN. When you choice SCALE you can set the position of your image, the scale and add a crutain if you want… sure that’s can be helpful.
here you can find the example to do that :https://github.com/StanLepunK/Rope_examples/tree/master/IMAGE_PGRAPHICS/background_image

1 Like

Thank you for sharing this!

What does this mean?

I’m trying to understand the example sketch. The base sketch file background_image.pde does not import a library – so it seems like you have added method signatures for background in one of the (many) tabs. But it isn’t clear where – not in FX_background, not in core, not in Utils… where is the code? I can’t figure out how this is organized, and there are so many other things in the repo that github search doesn’t help.

I know it’s little complex.
All the tab start by Z_R is from my rope framework and this one imported in Z_R_core.pde. Rope library is for the class Vec and few Constants you can download the last build here. The method background(PImage img ++) follow the main merhodbackground_calc()in the tabZ_R_Image.pde` on line 1037 :slight_smile: I hope that’s help you to understand my mazza sketch !!!

PS : I update the exemple juste now, because there is a bug when a new movie.mp4 is pass, because sometime the mp4 cause an PImage width and height to zero for 2 or 3 frames before work correctly.

a crutain mean curtain… my mistake !

I see! I actually have a private library called Toolboxing that has similar extension utilities.

One possible approach, based on that experience: have you considered making it a library, then importing the library jar into the sketch – either just as an import (and distribute through PDE Contributions Manager) or as a jar in the sketch folder? That would really clean up your sketch folder and make it easier to read – then the extended methods would be namespaced.

you’re true, I pass the class of my Rope framework step by step in my Rope library, when I’m sure the classes is robust. I don’t present my library on PDE Contribution Manager, because I don’t find a time to prepare properly. By the way I’m interreting to see your Toolboxing, and if you pick the stuff on mine you’re welcome !!!

The number of tab don’t affraid me…in my softawre Romanesco there is 100K lines of code in Processing :slight_smile: