Android PointF - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android PointF class.

This code example shows how to use the following methods:
public class ImageZoomDialog extends BaseActivity implements OnTouchListener, OnClickListener {
 
	// These matrices will be used to move and zoom image 
	Matrix matrix = new Matrix();
	Matrix savedMatrix = new Matrix();
	PointF start = new PointF();
	PointF mid = new PointF();
	DisplayMetrics dm;
	float oldDist = 1f;
	private ImageView imgView;
	private Button zoomIn, zoomOut;
	private ViewSwitcher mViewSwitcher;
	 
	// button zoom 
	private float scaleWidth = 1;
	private float scaleHeight = 1;
	private Bitmap bitmap, zoomedBMP;
	private int zoom_level = 0;
	private static final double ZOOM_IN_SCALE = 1.25;// 放大系数
	private static final double ZOOM_OUT_SCALE = 0.8;// 缩小系数
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        } 
    } 
 
    public void addMotionPoint(int index, int eventIndex, MotionEvent event) {
        try { 
            PointF geckoPoint = new PointF(event.getX(eventIndex), event.getY(eventIndex));
            geckoPoint = GeckoApp.mAppContext.getLayerController().convertViewPointToLayerPoint(geckoPoint);
     
            mPoints[index] = new Point(Math.round(geckoPoint.x), Math.round(geckoPoint.y));
            mPointIndicies[index] = event.getPointerId(eventIndex);
            // getToolMajor, getToolMinor and getOrientation are API Level 9 features 
            if (Build.VERSION.SDK_INT >= 9) {
                double radians = event.getOrientation(eventIndex);
                mOrientations[index] = (float) Math.toDegrees(radians);
                // w3c touchevents spec does not allow orientations == 90 
                // this shifts it to -90, which will be shifted to zero below 
                if (mOrientations[index] == 90)
                    mOrientations[index] = -90;
     
                // w3c touchevent radius are given by an orientation between 0 and 90 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
		} 
		 
		Log.d(LCAT,"[METHODSDEMO] demoMethodPoint received " + args.length + " arguments");		
		 
		// Use the TiConvert methods to get the values from the arguments 
		PointF point = new PointF();
		point.x = (args[kArgX] != null) ? TiConvert.toFloat(args[kArgX]) : 0;
		point.y = (args[kArgY] != null) ? TiConvert.toFloat(args[kArgY]) : 0;
 
		HashMap result = new HashMap();
		result.put("x", point.x);
		result.put("y", point.y);
		 
		Log.d(LCAT,"[METHODSDEMO] " + result);
		 
		return result;
	} 
	 
	@Kroll.method 
	public HashMap demoMethodRange(Object[] args)
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
            long timestamp, float positionX, float positionY, float radius) {
        float[] delta = new float[2];
 
        getAccumulatedDeltaNative(timestamp, positionX, positionY, radius, delta);
 
        return new PointF(delta[0], delta[1]);
    } 
 
    public void addInterestRegion(int numX, int numY, int left, int top, int right, int bottom) {
        addInterestRegionNative(numX, numY, left, top, right, bottom);
    } 
 
    /*********************** NATIVE METHODS *************************************/ 
 
    private native void initNative(int width, int height, int downsampleFactor);
 
    private native void addFrameNative(byte[] data, long timeStamp);
 
    private native void computeFeaturesNative(boolean cachedOk);
 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:set
     *  
     * @return The (x, y) coordinates. 
     */ 
    public static PointF coordinates(final biz.oesf.graphchartlib.afree.graphics.geom.RectShape RectShape,
            final RectangleAnchor anchor) {
        PointF result = new PointF();
        if (anchor == RectangleAnchor.CENTER) {
            result.set(RectShape.getCenterX(), RectShape.getCenterY());
        } else if (anchor == RectangleAnchor.TOP) {
            result.set(RectShape.getCenterX(), RectShape.getMinY());
        } else if (anchor == RectangleAnchor.BOTTOM) {
            result.set(RectShape.getCenterX(), RectShape.getMaxY());
        } else if (anchor == RectangleAnchor.LEFT) {
            result.set(RectShape.getMinX(), RectShape.getCenterY());
        } else if (anchor == RectangleAnchor.RIGHT) {
            result.set(RectShape.getMaxX(), RectShape.getCenterY());
        } else if (anchor == RectangleAnchor.TOP_LEFT) {
            result.set(RectShape.getMinX(), RectShape.getMinY());
        } else if (anchor == RectangleAnchor.TOP_RIGHT) {
            result.set(RectShape.getMaxX(), RectShape.getMinY());

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMidPoint
                mFd = new FaceDetector(size.width, size.height, 1);
            } 
            FaceDetector.Face[] faces = {null};
            int nFaces = mFd.findFaces(bmp, faces);
            if (nFaces != 0) {
                PointF midpoint = new PointF();
                faces[0].getMidPoint(midpoint);
                RectF rf = new RectF(midpoint.x - 10, midpoint.y - 10, midpoint.x + 10, midpoint.y + 10);
                mLogoView.setRect(rf);
            } 
        } 
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:length, set
		mCurrentCenterOfParticle.set(x,y);
	} 
 
	public void propagate(PointF positionForce) {
		// Get Friction 
		Vec2D.scalerMult(-1.0, mVelocityVector, mTotalForce);
		Vec2D.unitVector(mTotalForce.x, mTotalForce.y, mTotalForce);
		Vec2D.scalerMult(mFrictionMagnitude, mTotalForce, mTotalForce);
		// Add in positional Force 
		 
		Vec2D.add(positionForce, mTotalForce, mTotalForce); // since m=1, this is also the acceleration!
 
		if (continuePropagation(positionForce)){
 
			if ((mVelocityVector.length() < mTotalForce.length()) && 
					(positionForce.length() < EPSILON)){
						Vec2D.scalerMult(mVelocityVector.length()/mTotalForce.length(), mTotalForce, mTotalForce);
					} 
 
			mAnimationFinished = false;

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public ArcShape(float x, float y, float width, float height, float startAngle, float angleExtent, boolean useCenter) {
        this.mOval = new RectF(x, y, x + width, y + height);
        this.mStartAngle = startAngle;
        this.mAngleExtent = angleExtent;
        this.mPath = new Path();
        this.mStartPoint = new PointF();
        this.mEndPoint = new PointF();
        this.mUseCenter = useCenter;
        this.mRegion = new Region();
        update(); 
    } 
 
    /** 
     * Creates a new arc shap from specified location, size, double angles, and useCenter values. 
     * @param x The x-coordinate of upper-left corner of the arc 
     * @param y The y-coordinate of upper-left corner of the arc 
     * @param width The overall width of the full oval of which this arc is a partial section 
     * @param height The overall height of the full oval of which this arc is a partial section 
     * @param startAngle The starting angle of the arc in degrees 
     * @param angleExtent The angle extent of the arc in degrees 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    /** 
     * Returns coordinate of starting point. 
     * @return coordinate of starting point 
     */ 
    public PointF getP1() {
        return new PointF(mX1, mY1);
    } 
  
    /** 
     * Sets the coordinate of starting point. 
     * @param p The starting point 
     */ 
    public void setP1(PointF p) {
        this.mX1 = p.x;
        this.mY1 = p.y;
    } 
     
    /** 
     * Returns coordinate of ending point. 
     * @return coordinate of ending point 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public static PointF getPointInRectShape(double x, double y,
            final RectShape area) {
 
        x = Math.max(area.getMinX(), Math.min(x, area.getMaxX()));
        y = Math.max(area.getMinY(), Math.min(y, area.getMaxY()));
        return new PointF((float)x, (float)y);
 
    } 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android PointF Questions & Answers:

Other Android PointF Examples

22:	
23:		// Remember some things for zooming
24:		PointF last = new PointF();
25:		PointF start = new PointF();
26:		float minScale = 1f;
-
22:	
23:		// Remember some things for zooming
24:		PointF last = new PointF();
25:		PointF start = new PointF();
26:		float minScale = 1f;
-
23:		// Remember some things for zooming
24:		PointF last = new PointF();
25:		PointF start = new PointF();
26:		float minScale = 1f;
27:		float maxScale = 3f;
-
23:		// Remember some things for zooming
24:		PointF last = new PointF();
25:		PointF start = new PointF();
26:		float minScale = 1f;
27:		float maxScale = 3f;

Read More

See Code Examples for Android PointF Methods: