Path transform - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Path transform method.

This code example shows how to use the following methods:computeBounds, transform
//            int seg2 = iterator2.currentSegment(d2); 
//            if (seg1 != seg2) { 
//                return false; 
//            } 
//            if (!Arrays.equals(d1, d2)) { 
//                return false; 
//            } 
//            iterator1.next(); 
//            iterator2.next(); 
//            done = iterator1.isDone() && iterator2.isDone(); 
//        } 
        return true; 
    } 
     
    /** 
     * Creates and returns a translated shape. 
     *  
     * @param shape 
     *            the shape (<code>null</code> not permitted). 
     * @param transX 

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:computeBounds, transform
     * {@inheritDoc} 
     */ 
    public void translate(float x, float y) {
        Matrix mat = new Matrix();
        mat.postTranslate(x, y);
        mPath.transform(mat);
        update(); 
    } 
     
    /** 
     * Appends the specified point to this polygon. 
     * @param x The x-coordinate of specified point 
     * @param y The y-coordinate of specified point 
     */ 
    public void addPoint(float x, float y) {
        if (mFirstPoint) {
            mPath.moveTo(x, y);
        } else { 
            mPath.lineTo(x, y);
        } 

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:computeBounds, transform
     * {@inheritDoc}  
     */ 
    public void translate(float x, float y) {
        Matrix mat = new Matrix();
        mat.postTranslate(x, y);
        mPath.transform(mat);
        update(); 
    } 
     
    /** 
     * Sets the next start point (x, y). 
     * @param x The x-coordinate of next start point 
     * @param y The y-coordinate of next start point 
     */ 
    public void moveTo(float x, float y) {
        mPath.moveTo(x, y);
        update(); 
    } 
 
    /** 

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:computeBounds, transform
	public static Bitmap drawToBitmap(final Path arrowPath, final Path arrowPeakPath){
		final Bitmap b = Bitmap.createBitmap(48, 48, Config.ARGB_8888);
		final Canvas c = new Canvas(b);
 
		final RectF boundsPath = new RectF();
		arrowPath.computeBounds(boundsPath, true);
		final RectF boundsOverall = new RectF();
		arrowPath.computeBounds(boundsOverall, true);
 
		boundsOverall.bottom = Math.max(boundsOverall.bottom, boundsPath.bottom);
		boundsOverall.top = Math.min(boundsOverall.top, boundsPath.top);
		boundsOverall.left = Math.min(boundsOverall.left, boundsPath.left);
		boundsOverall.right = Math.max(boundsOverall.right, boundsPath.right);
 
		final float width = boundsOverall.right - boundsOverall.left;
		final float height = boundsOverall.top - boundsOverall.bottom;
		final float biggerSide = Math.max(width, height);
 
		final Matrix m = new Matrix();
		final int PADDING = 6;

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:close, lineTo, transform
 
		terrainPath = terrain.getPath();
 
		// add the bottom line so that the path is formed as a closed 
		// polygon 
		terrainPath.lineTo(1, 0);
		terrainPath.lineTo(0, 0);
		terrainPath.close();
 
		// HACK: transforming to screen coordinates here because if we don't 
		// scale the Path object, the image won't be shown correctly 
		terrainPath.transform(transform.getMatrix());
 
		return terrainPath;
	} 
 
	@Override 
	public Drawable createDrawable() {
		Path path = getTerrainPath();
 
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:computeBounds, lineTo, offset, transform
		updateVars(); 
	} 
	 
	//call this when position is updated, scale or rotation changes 
	private void updateVars(){ 
		Path p = new Path();
		 
		p.lineTo(0, bitmap.getHeight());
		p.lineTo(bitmap.getWidth(), bitmap.getHeight());
		p.lineTo(bitmap.getWidth(), 0);
		p.lineTo(0, 0);
		 
		p.computeBounds(bounds, false);
		m = new Matrix();
		 
		try{ 
			m.setRotate(rotation, bounds.centerX(), bounds.centerY());
			m.setScale(scale, scale);
		}catch(Exception e){
			Log.d("Matrix", e.getMessage());

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:reset, setRotate, transform
mPaint.setStyle(Paint.Style.STROKE);
			mPaint.setStrokeWidth(1);
		} 
		 
		Matrix mMatrix = new Matrix();
		Board[i].moveTo(a.x+x[i], a.y+y[i]);
		Board[i].lineTo(b.x+x[i], b.y+y[i]);
		Board[i].lineTo(c.x+x[i], c.y+y[i]);
		Board[i].lineTo(d.x+x[i], d.y+y[i]);
		Board[i].close();
		mMatrix.reset();
		mMatrix.setRotate(degree[i], cx, cy);
		Board[i].transform(mMatrix);
	} 
 
	private void getTriangle(Point a, Point b, Point c, int i)
	{ 
		float cx, cy;
		 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:computeBounds, lineTo, offset, transform
	public HashMap<Integer, LetterInstance> getLetters(){
		return letters;
	} 
	 
	 
	public int  getUid(){ 
		return uid;
	} 
 
	@Override 
	protected void onDraw(Canvas canvas) {
		 
		Iterator it = letters.entrySet().iterator();
		while(it.hasNext()){
			Map.Entry me = (Map.Entry) it.next();
			LetterInstance li = (LetterInstance) me.getValue();
			 
			float[] pos = li.getPos();
			Bitmap b = li.getBitmap();
			RectF  bounds = li.getBounds();

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:lineTo, setLastPoint, transform
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:computeBounds, transform
            throw new IllegalArgumentException("Null 'shape' argument.");
        } 
        Matrix mat = new Matrix();
        mat.postTranslate((float)transX, (float)transY);
         
        Path path = new Path(shape.getPath());
        path.transform(mat);
         
        RectF rect = new RectF();
        path.computeBounds(rect, false);
         
        return new PathShape(path);
    } 
 
    /** 
     * Translates a shape to a new location such that the anchor point (relative 
     * to the rectangular bounds of the shape) aligns with the specified (x, y) 
     * coordinate in Java2D space. 
     *  
     * @param shape 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Path transform Questions & Answers:

transform Method Overview
Transform the points in this path by matrix, and write the answer into dst.
See Code Examples for other Android Path Methods: