If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
New Developer
Mark-PMI
Posts: 44
Registered: ‎02-02-2010
My Device: 8320
My Carrier: t-mobile

How are offsets used in drawPathOutline?

I can use drawPathOutline, drawFilledPath to draw simple shapes. It works well for rotating a shape, once you work out the points by hand. But what are the offsets used for?

 

Thanks!

 

Mark

Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: How are offsets used in drawPathOutline?

[ Edited ]

The explanation in the documentation seems clear enough:

 

offsets - List defining the beginnings of each path in the xPts/yPts data arrays, or null to indicate a single path. A path that begins at point (xPts[offsets[i]],yPts[offsets[i]]) will end at point (xPts[offsets[i+1]]-1,yPts[offsets[i+1]]-1).

 

I suspect though the last point should be (xPts[offsets[i+1]-1], yPts[offsets[i+1]-1]) however.

 

Please use plain text.
New Developer
Mark-PMI
Posts: 44
Registered: ‎02-02-2010
My Device: 8320
My Carrier: t-mobile

Re: How are offsets used in drawPathOutline?

At the risk of being non-PC, "its all Greek to me" ;-) FWIW, I did read the documentation before I posted.

 

My current understanding - xPts and yPts define a set of points, and the function draws some sort of curve between each point, based on the pointTypes.

 

Maybe you can give me a simple example using the offsets to help me understand.

 

Thanks,

 

Mark

 

 

 

 

 

 

Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: How are offsets used in drawPathOutline?

Okay, let's approach this from another angle.

 

You can draw multiple, potentially unconnected paths with drawPathOutline. You only have your two arguments for the point list. How do you distinguish which points belong to which path?

Please use plain text.
New Developer
Mark-PMI
Posts: 44
Registered: ‎02-02-2010
My Device: 8320
My Carrier: t-mobile

Re: How are offsets used in drawPathOutline?

It still isn't totally clear, but getting better. Help me with an example.

 

xpts = [10,20,30,40]

ypts = [50,60,70,80]

 

These are my points

10,50

20,60

30,70

40,80

 

Say I want a path to be 10,50 to 20,60 and then another, unconnected path to be 30,70 to 40,80, what would I put in offsets?

 

Now I want 10,50 connected to 30,70 and 20, 60 connected to 40 80, what would be in offsets?

 

Is it something like that?

 

Mark

Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: How are offsets used in drawPathOutline?

0, 2.

 

For the second one, you need to reorder your points.

Please use plain text.