Translates a point by the specified delta-x and delta-y - Android Graphics

Android examples for Graphics:Path Point

Description

Translates a point by the specified delta-x and delta-y

Demo Code


//package com.java2s;

import android.graphics.PointF;

public class Main {
    /**//from  w ww  .ja v a  2  s  . c o  m
     * Translates a point by the specified delta-x and delta-y
     * @param p The point to be translated
     * @param dx Delta-X
     * @param dy Delta-Y
     * @return The translated point, i.e. (p.x + dx, p.y + dy)
     */
    public static PointF translate(PointF p, float dx, float dy) {
        return new PointF(p.x + dx, p.y + dy);
    }
}

Related Tutorials