Using java Syntax Highlighting
- import android.graphics.Path;
- import android.graphics.Point;
- /**
- * ManagedPath ensures that <code>moveTo</code> gets called before <code>lineTo</code> gets called for the first time.<br />
- * Its only 'managed' for lines!
- * <b>Info:</b> Where you had to decide whether to call moveTo or lineTo before, now just call lineTo.
- * @author Nicolas Gramlich
- */
- public class ManagedLinePath extends Path {
- // ===========================================================
- // Fields
- // ===========================================================
- protected boolean mDidMoveTo = false;
- // ===========================================================
- // Methods from SuperClass/Interfaces
- // ===========================================================
- public void lineTo(final Point p) {
- this.lineTo(p.x, p.y);
- }
- @Override
- public void lineTo(float x, float y) {
- if(!this.mDidMoveTo)
- this.moveTo(x, y);
- else
- super.lineTo(x, y);
- }
- @Deprecated
- public void moveTo(final Point p) {
- this.moveTo(p.x, p.y);
- }
- @Deprecated
- @Override
- public void moveTo(float x, float y) {
- this.mDidMoveTo = true;
- super.moveTo(x, y);
- }
- }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4




