Saturday, June 1

How to convert an image in cirlce representation



Circulate an image (vertices) through a circle can be developed by using Path and Path Measure.First you need to generate a Path object and fix a the Path of your circulation. it can be round  line arc or other. Then by applying pathmeasure calculate  the path and get the x-axis and y-axis points of the picture that want to be in round all time . Then translate the counter by following source code.

public void catchway(path.Direction newway)
{   
    way_cal = new way();
    paint_cal = new Paint(Paint.ANTI_ALIAS_FLAG);
    way_cal.addCircle(width,height, 200, dir);
    newwaymeasure= new PathMeasure();
    newwaymeasure.setPath(way_cal,false);
    fSpeed_Segment = newwaymeasure.getLength()/100;
}


    public void way_setsecond()
{
    if(iStep_calsecond<=100)
    {
        newwaymeasure.getPosTan(fSpeed_Segment*iStep_cal2, afpp, null);
        newpic1.setX(afpp[0]);
        newpic1.setY(afpp[1]);
    }
    else {
        iStep_calsecond=0;
    }
}
 
if you want to call this in your touch screen by events then use following code 
 
catchway(left);
iStep_cal=iStep_cal+(//value you prefer like 25);
path_set(); 
 
Tags:-android.programming,coding,tips,tricks,development, image android development, 
image in circle,image in round, image in shape, image rotation shape

No comments:

Post a Comment