Hi,
I want to use GDI to rotate some text at an angle and output the
resultant image to the asp.net response stream.
I can do that all fine, however what I'm struggling with is trimming
the whitespace from the resultant image.
What im doing is creating a blank canvas image (of arbitrarily large
size) and doing a translate transform to the centre, then applying a
rotate transform, then writing my text.
What i want to do is trim all the whitespace from around the edges. Is
there some way i can determine the width and height of the text ive
written to the image (after the transform) ?
I know i can manually get the text dimensions before the rotate, then
use some trig to work out how high and wide it would be after rotating
it but thats a bit of a pain if theres some function that will do it
for me
Thanks for any advice
Andrew
Peter Duniho - 12 Mar 2008 18:31 GMT
> [...]
> What i want to do is trim all the whitespace from around the edges. Is
[quoted text clipped - 5 lines]
> it but thats a bit of a pain if theres some function that will do it
> for me
You wrote that you're transforming the Graphics before drawing to
accomplish the rotation. You can also use the Matrix that you've assigned
to the Graphics.Transform property to transform the rectangle you can
easily derive from the text measurement methods, by calling
Matrix.TransformPoints().
Pete