dimanche 28 décembre 2014

adding if statements to function.filter1().filter2().filter3()


I don't know what it's called, but in the canvas library i'm using you apply filters to a texture by calling



canvas.draw(texture).filter1().filter2().filter3().filter4();


and i'm trying to only draw certain filters if the value is not default, but i can't do it with regular if statements since the texture can only be set once, and if i try to set it again, the previous filter will get reset.


What i'm wondering is if i can somehow add "if" statements to the "train" of filters, like so:



canvas.draw(texture).if(something){filter1()}.if(somethingelse){filter2()}.if(something){filter3()};


and so on.


Sorry if i'm not very clear, i dont know what the filter "train" is called, where you apply filter after eachother on one line.





Aucun commentaire:

Enregistrer un commentaire