java - Antialias on clipPath on layout -
i have layout, has several views inside of - toolbar, recyclerview , few separators (which simple views height of 2dp , match_parent width). wanted put mask on layout - important part of round corners whole layout (and not views itself). decided create own linearlayout class overloaded dispatchdraw function , managed nice result... except 1 thing - corners not antialiased.
tl;dr there way put antialias clippath function? know can turn on in paint , use xfermodes mask layout, have no clue how draw mask , draw else (without knowing what's inside).
here layout code (except classname, simple constructors , path field):
@override protected void dispatchdraw(canvas canvas) { if (path == null) { path = new path(); float margin = myapplication.getinstance().getmetrics().density * 5; path.addroundrect(new rectf(margin,margin,getwidth()-margin, getheight()-margin), margin*2, margin*2, path.direction.cw); } canvas.clippath(path); super.dispatchdraw(canvas); } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); }
try this answer, of course instead of mmask.draw(canvas)
"mask" made ninepatchdrawable
need call canvas.drawpath()
paint
set porterduff.mode.dst_in
xfer mode
Comments
Post a Comment