Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Blanc
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Draw text in a circular path

Hi all,

 

i need to draw text over a circle in a circular path. how can i make this possible...?? any ideas??

Thanks and Regards,
PraveenGoparaju.
Please use plain text.
Developer
Blanc
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: Draw text in a circular path

any ideas!!!!!!!
Thanks and Regards,
PraveenGoparaju.
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Draw text in a circular path

I guess you need to go for the Image which ahs the text in Cirular.


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
Blanc
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: Draw text in a circular path

sorry, my text should change according to the user selection, around the circle..

 

is it possible to drawText over an arc path or ecliptic path?? we have option to draw eclipse or arc how can we draw text along taht path??

any ideas....!!!!!!!!!!!

Thanks and Regards,
PraveenGoparaju.
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Draw text in a circular path

I dn't think there is any API for this.


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
Blanc
Posts: 638
Registered: ‎07-02-2009
My Device: Not Specified

Re: Draw text in a circular path

For iphone and android they make it popssibe... and they have drawpath method, where they draw these text.

 

i welcome any suggestions on this!!!

Thanks and Regards,
PraveenGoparaju.
Please use plain text.
Developer
peter_strange
Posts: 19,604
Registered: ‎07-14-2008
My Device: Not Specified

Re: Draw text in a circular path

Like BBDeveloper, I am not aware of an API for this.  If you really want it, look for a way of suggesting features to RIM.  Sorry I am not aware of this process.

 

Anyway, the only way I can think of doing this using the current API involves you writing the individual characters into a Bitmap, then rotating and positioning the Bitmap yourself.  I suspect that this is too much work, especially for something that is, in my opinion, not particularly attractive or easy to read.  But that is just my opinion..

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Draw text in a circular path

I feel even the Text which needs to be displayed is not a too many numbers, better to go for the whole Image and display the Image.


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Draw text in a circular path

[ Edited ]

This should be possible.

 

There is a Font.derive method which includes an affine transformation:

 

public Font derive(int style,
                   int height,
                   int units,
                   int antialiasMode,
                   int effects,
                   int[] transform)

 

The steps would be:

 

1. Calculate the position of the character on the circumference of the circle (a little trig here)

2. Calculate the theta of the character at this position (a little more trig)

3. Use the theta to create the transformation

4. Call Font.derive() to derive the character with this theta angle

5. Draw the character (drawText)

 

It's a s.m.o.p. (as we say in the biz)

 

Here is an example of calculating the transformation (compliments of Richard Puckett)

 

http://supportforums.blackberry.com/t5/Java-Development/Rotate-Font/m-p/23740#M1177

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Draw text in a circular path

Rex, Thanks a lot for the excellent Info.


Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.