android - Add text to path on canvas -
i trying draw text on canvas using path.
i have class text , create new path text , add path path objects. when try add text not printed on screen.
i not know can problem not found documentation how draw text on path , not know how can it.
protected void ondraw(canvas canvas){ for(path p : paths){ canvas.drawpath(p, drawpaint); } canvas.drawpath(drawpath, drawpaint); } //i skip ontouch event , write here action case motionevent.action_up: path txtpath=new path(); textpaint txt=new textpaint(); txt.setpaint(drawpaint); txt.settext(text); txt.setx(x); txt.sety(y); txt.setpath(txtpath); drawpath.addpath(txtpath, x, y); //this class text public static class textpaint{ public string text; public float x; public float y; public paint paint; public string selector ; public path path; public string getselector() { return selector; } public void setselector(string selector) { this.selector = selector; } public path getpath() { return path; } public void setpath(path path) { this.path = path; } public float getx() { return x; } public void setx(float x) { this.x = x; } public float gety() { return y; } public void sety(float y) { this.y = y; } public paint getpaint() { return paint; } public void setpaint(paint paint) { this.paint = paint; } public string gettext() { return text; } public void settext(string text) { this.text = text; } }
Comments
Post a Comment