use of android.graphics.Outline in project android_frameworks_base by crdroidandroid.
the class ViewGroup_Delegate method drawChild.
/**
* Overrides the original drawChild call in ViewGroup to draw the shadow.
*/
@LayoutlibDelegate
static /*package*/
boolean drawChild(ViewGroup thisVG, Canvas canvas, View child, long drawingTime) {
if (child.getZ() > thisVG.getZ()) {
// The background's bounds are set lazily. Make sure they are set correctly so that
// the outline obtained is correct.
child.setBackgroundBounds();
ViewOutlineProvider outlineProvider = child.getOutlineProvider();
if (outlineProvider != null) {
Outline outline = child.mAttachInfo.mTmpOutline;
outlineProvider.getOutline(child, outline);
if (outline.mPath != null || (outline.mRect != null && !outline.mRect.isEmpty())) {
int restoreTo = transformCanvas(thisVG, canvas, child);
drawShadow(thisVG, canvas, child, outline);
canvas.restoreToCount(restoreTo);
}
}
}
return thisVG.drawChild_Original(canvas, child, drawingTime);
}
use of android.graphics.Outline in project Shuttle by timusus.
the class PlayPauseView method onSizeChanged.
@Override
protected void onSizeChanged(final int w, final int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
drawable.setBounds(0, 0, w, h);
width = w;
height = h;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setOutlineProvider(new ViewOutlineProvider() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, view.getWidth(), view.getHeight());
}
});
setClipToOutline(true);
}
}
Aggregations