Am 09.03.2017 um 08:56 schrieb chitgoks:
Attached is my current code for watermarking text
I can't figure out which class is needed to ensure that the next call of
showText() will place it at the bottom instead of after the first line of
text.
what i wish to accomplish is to have 1 , 2 or 3 lines of showText() shown
vertically centered, and also a diagonal one like 45 or -45 degrees.
for the diagonal, i tried to use Matrix.getRotateInstance() but its
rotation does not base the point at the center.
Any ideas on what I did wrong?
Please advise. thank you
I have not understood the first part of the question, only the second
part. Rotation is around the (0,0) axis. To show a diagonal watermark,
use this code:
cs.setTextMatrix(Matrix.getRotateInstance(Math.toRadians(45), 0, 0));
cs.showText(ts);
However it won't be centered, and stuff on the left won't be visible
fully. To acomplish this, you'll have to use some math to calculate the
length of your diagonal line. Then you'll need the length of your
string, etc. You may also need the height, see the
DrawPrintTextLocations example, this can be tricky and is different for
each font type.
Note that the two right parameters of Matrix.getRotateInstance()
(translations) are not the same as AffineTransform.getRotateInstance()
(anchors).
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]