B4J Question Determine where a text is on a canvas?

Mark Read

Well-Known Member
Licensed User
Longtime User
Imagine I have a canvas with a certain color (black, white whatever..) and I draw a text on the canvas with the same color. Is it possible to determine where the text is using pixels? Or tell the difference between foreground and background color would also be helpfull.

I would know roughly where the text is but I need to be able to read the individual characters and the space between the lines in the character.

Example: I place an O on the canvas. Can I find the outline of the character?

Hope that makes sense.

Many thanks.
 

DonManfred

Expert
Licensed User
Longtime User
Imagine I have a canvas with a certain color (black, white whatever..) and I draw a text on the canvas with the same color.
So you have an white image and draw a Text O (in white too), right?
Basically you are not able to find it as it has the same color as the background.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Why not set your text colour to 0xFFFFFE? It would be indistinguishable against a white background. Then use an edge-finding algorithm.

Edit : On reflection this suggestion might be nonsense because I guess all text has anti-aliased edges. I was just trying to get a better picture of what you were trying to do.
 
Last edited:
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Why not set your text colour to 0xFFFFFE? It would be indistinguishable against a white background. Then use an edge-finding algorithm.

Edit : On reflection this suggestion might be nonsense because I guess all text has anti-aliased edges. I was just trying to get a better picture of what you were trying to do.
Thanks Brain for your suggestion. This is exactly what I did and it was easy to find the text, see my Laser Text posting.
 
Upvote 0
Top