Paul,

Tried it out (Motorola Milestone).

The following works:

        // -----
        Path androidPath = new Path();
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.RED);
        paint.setStrokeWidth(5);
        androidPath.moveTo(0, 0);
        androidPath.lineTo(110, 110);
        androidPath.arcTo(new RectF(10, 10, 210, 210), 0, 180);
        canvas.drawPath(androidPath, paint);
        // -----

The following does not draw the oval, but does draw the line segment to its first point:

        androidPath.arcTo(new RectF(10, 10, 210, 210), 0, 360);

This makes sense, since the docs do say that the sweep angle is treated modulo 360 - but it only says that for one of the three arc-related methods:

http://developer.android.com/reference/android/graphics/Path.html#arcTo(android.graphics.RectF, float, float, boolean)

Looks like a documentation bug to me.

This works too and I really can't tell the difference compared to a full 360:

androidPath.arcTo(new RectF(10, 10, 210, 210), 15, 359.9f);

Just for kicks, being short by one tenth of a degree produces a positioning error of 0,0017 pixels for each radius pixel.

-- Kostya

03.02.2011 23:40, Paul пишет:
I've tried a bunch of different combinations...  here is what I have
in onDraw, just trying to get this working:

Path androidPath = new Path();
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.BLACK);
paint.setStrokeWidth(3);
androidPath.moveTo(0, 0);
androidPath.arcTo(new RectF(10, 10, 110, 110), 0, 360, true);
canvas.drawPath(androidPath, paint);

Nothing is shown.

On Feb 3, 11:49 am, Kostya Vasilyev<[email protected]>  wrote:
How about making the arc the only item in the path, and also trying
different ops: fill vs. stroke?

03.02.2011 19:41, Paul пишет:



Tried, no difference...
On Feb 3, 11:21 am, Kostya Vasilyev<[email protected]>    wrote:
Paul,
Perhaps you could try path.arcTo(oval, 0, 180, *true*); ?
03.02.2011 19:03, Paul ?????:
Also, have tested this in both the emulator for Froyo, as well as on
Froyo hardware and the arcs are not being displayed.  Looked through
the source for arcTo, which calls a native function in Path.cpp, and
there doesn't appear to be a reason the above input would fail, given
that the Path.cpp can draw the exact same oval using addOval().
Paul
On Feb 3, 10:19 am, Paul<[email protected]>     wrote:
I am trying to add an arc to a path, but nthing gets drawn with each
call.  I have ensured that the passed RectF oval is dimensioned
properly, and calls to Path.addOval(oval, Path.Direction.CW) work
perfectly, but calls to either of Path.addArc(oval, 0, 180) and
Path.arcTo(oval, 0, 180) fail (nothing gets drawn).
Any suggestions on what I might be doing wrong?
Thanks!
--
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com
--
Kostya Vasilyev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to