We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Quick question, does the textAlign
function take just as long manually calculating what the position should be with for instance textDecent
or is the text Align function not as efficient?
Answers
The
textAlign()
method does not render text it simply determines how text should be displayed when using thetext()
method (which does the actual rendering).By efficiency I assume you mean speed, the difference between using the
text()
and doing it manually will be a matter of nanoseconds, so forget it and go for the simpler option and use thetext()
method.The only reason to create your own algorithm is if you want some special formatting.
@quark Ah thank you so the only real side effect is that it might look a bit confusing when looking at the code, I assume that the same goes for aligning pictures etc..?
It really depends on what you are doing. If you are cropping images every frame then it can be a huge memory hit. The same if you are scaling every frame -- just scale once.
But there is no "imageAlign()" -- just imageMode, which changes the settings for interpreting
image(img, x, y)
coordinates and has no impact on speed:images : especially loading images from hard drive, doing a reSize and using
image
with 5 parameters is very processor expensive.Using
image
with 5 parameters (handing width and height as additional parameters) is like an internal reSize command which is very processor expensive.