Best Technique for Rotating Text

What is the best cross-platform technique for rotating, flipping and scrolling text? This is for teleprompter software so the text may need to be rotated or flipped in any direction and then scrolled up or down very smoothly for the person reading the text.

Thanks in advance for your suggestions and solutions!

Because of the flipping and rotations (I’m assuming only 90 degree increments) you’ll need to draw your text into a picture and then scan it’s RGBSurface remapping the pixels into a transformed picture.

I’d precompute an array of those transformed pictures, say one or two lines each, or maybe a full frame per picture. Then drawing a frame is just figuring out which pictures are in view and DrawPicturing them.

Testing on my moderate computer doing fullscreen scrolling with DrawPicture looks ok smooth. Does use a lot of CPU though. To get faster or more effecient x-plat I’d use OpenGL (which has it’s own technical hurdles) or find a plugin that exposes each platforms optimized graphics and code for each.

If precomputing all the pictures is too much to ask you’ll also need to get into managing a small cache of pictures that are dynamically generated around where the view is.

If you’re not opposed to a commercial solution, I would suggest looking at the MonkeyBread Software picture plugin. It has some very fast functions for mirroring and rotation.

as far as I know Xojo internal text rotating functions are not Retina compatible

For now, but I’d still recommend using StringShape for this.

On OS X you can use Core Graphics and Core Text to rotate and flip text, it’s a lot of declare work (I mean a lot) but it’s the fastest Retina solution I’ve come across.

Xojo do a lot of work to make Apple’s Core Text usable.

For the best, well how about DynaPDF? Setup a PDF with the content and let it render to a picture. Than you have all the options from PDF with different fonts, full matrix support, so you can rotate and flip.

MBS Plugins also have a rotate text function:

graphics.DrawRotatedTextMBS(Rotation as double, text as string, x as integer, y as integer, Center as Boolean = false, alpha as double = 1.0, NoSwapY as boolean = false, FontWidth as Integer = 0)

As Christian wrote, try Graphics.DrawRotatedTextMBS from the MBS plugins. Works fine for me (But Mac & Windows only, not Linux or web)
https://www.monkeybreadsoftware.net/graphicspictures-graphics-method.shtml

Thank you all for the great suggestions and tips! :slight_smile:

Text should rotate in 90 degree increments in either direction. Commercial solutions are definitely an option. Although Windows and OS X are the current targets, Linux will likely become one soon. Are web browsers an option?

With all those ideas, it’s time to start testing each one . . .

[quote=152778:@Frederick Roller]Thank you all for the great suggestions and tips! :slight_smile:

Text should rotate in 90 degree increments in either direction. Commercial solutions are definitely an option. Although Windows and OS X are the current targets, Linux will likely become one soon. Are web browsers an option?

With all those ideas, it’s time to start testing each one . . .[/quote]

A teleprompter usually does not necessarily require fancy fonts, pictures and 144 dpi. As far as I can tell (but am not an anchor or the President), the most important is that text be legible, with a good contrast, at a size large enough to be read from 6 feet away or so.

Pictures and Xojo built-in as well as MBS will probably do fine, but the need for scroll remain, and that will probably require some additional doing.

for 90° you can simply draw in a picture and rotate it. RotateMBS function on picture class does it quickly.

Takes me back… :slight_smile:
One of the first things I got paid for was scrolling banner text for the BBC Micro using 6502 machine code.

As Michel points out, its the size and legibility that are important on teleprompting.
No-one 6 feet away is going to admire the anti-aliasing.

4 rows of text, each about (monitorsize / 5) on a monitor , white letters, on black background is what I’d want.

Or use StringShape and rotate that…

Unless I’m missing something about the scrolling requirements, Joe’s suggestion of using a Xojo-native StringShape is the easiest, and most straightforward. We’ve used this technique in a number of cases…

The simplicity of StringShape is appealing but it is limited to rotating, which makes sense as a class that inherits from Object2D versus a class with 3D capability. The text may need to be flipped so that it is displayed as though viewed through a mirror.

Sorry; I missed that requirement on first reading…

A lot of prompters actually display the prompt reflected through an actual transparent mirror.

I think the MBS option Jim suggested is probably the easiest.

No apology needed for trying to help. :slight_smile:

Thanks again everyone! :slight_smile:

Testing is ongoing . . .