本文整理汇总了Java中android.graphics.Region类的典型用法代码示例。如果您正苦于以下问题:Java Region类的具体用法?Java Region怎么用?Java Region使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Region类属于android.graphics包,在下文中一共展示了Region类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: drawCurrentPageArea
import android.graphics.Region; //导入依赖的package包/类
private void drawCurrentPageArea(Canvas canvas, Bitmap bitmap, Path path) {
mPath0.reset();
mPath0.moveTo(mBezierStart1.x, mBezierStart1.y);
mPath0.quadTo(mBezierControl1.x, mBezierControl1.y, mBezierEnd1.x,
mBezierEnd1.y);
mPath0.lineTo(mTouch.x, mTouch.y);
mPath0.lineTo(mBezierEnd2.x, mBezierEnd2.y);
mPath0.quadTo(mBezierControl2.x, mBezierControl2.y, mBezierStart2.x,
mBezierStart2.y);
mPath0.lineTo(mCornerX, mCornerY);
mPath0.close();
canvas.save();
canvas.clipPath(path, Region.Op.XOR);
canvas.drawBitmap(bitmap, 0, 0, null);
try {
canvas.restore();
} catch (Exception e) {
}
}
开发者ID:guoxiaoxing,项目名称:android-open-source-project-analysis,代码行数:23,代码来源:PageView.java示例2: drawCurrentPageArea
import android.graphics.Region; //导入依赖的package包/类
@Override
protected void drawCurrentPageArea(Canvas canvas) {
mPath0.reset();
mPath0.moveTo(mBezierStart1.x, mBezierStart1.y);
mPath0.quadTo(mBezierControl1.x, mBezierControl1.y, mBezierEnd1.x, mBezierEnd1.y);
mPath0.lineTo(mTouch.x, mTouch.y);
mPath0.lineTo(mBezierEnd2.x, mBezierEnd2.y);
mPath0.quadTo(mBezierControl2.x, mBezierControl2.y, mBezierStart2.x, mBezierStart2.y);
mPath0.lineTo(mCornerX, mCornerY);
mPath0.close();
canvas.save();
canvas.clipPath(mPath0, Region.Op.XOR);
canvas.drawBitmap(mCurPageBitmap, 0, 0, null);
try {
canvas.restore();
} catch (Exception e) {
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:PageWidget.java示例3: draw
import android.graphics.Region; //导入依赖的package包/类
public void draw(Canvas canvas, Paint paint, float opacity) {
opacity *= mOpacity;
if (opacity > MIN_OPACITY_FOR_DRAW) {
saveAndSetupCanvas(canvas);
if (mClipping != null) {
canvas.clipRect(
mClipping.left * mScale,
mClipping.top * mScale,
mClipping.right * mScale,
mClipping.bottom * mScale,
Region.Op.REPLACE);
}
for (int i = 0; i < getChildCount(); i++) {
ARTVirtualNode child = (ARTVirtualNode) getChildAt(i);
child.draw(canvas, paint, opacity);
child.markUpdateSeen();
}
restoreCanvas(canvas);
}
}
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:24,代码来源:ARTGroupShadowNode.java示例4: drawNextPageAreaAndShadow
import android.graphics.Region; //导入依赖的package包/类
@Override
protected void drawNextPageAreaAndShadow(Canvas canvas) {
canvas.save();
if (actiondownX > mScreenWidth >> 1) {
canvas.clipPath(mPath0);
canvas.drawBitmap(mNextPageBitmap, 0, 0, null);
} else {
canvas.clipPath(mPath0, Region.Op.XOR);
canvas.drawBitmap(mNextPageBitmap, 0, 0, null);
}
try {
canvas.restore();
} catch (Exception e) {
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:OverlappedWidget.java示例5: CardItemView
import android.graphics.Region; //导入依赖的package包/类
public CardItemView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStyle(Paint.Style.FILL);
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.Card, defStyleAttr, 0);
mSize = ta.getDimensionPixelSize(R.styleable.Card_size, 10);
mPaint.setColor(ta.getColor(R.styleable.Card_bgColor, 0));
ta.recycle();
mRegion = new Region();
mDrawPath = new Path();
mDrawPath.moveTo(0, mSize / 2);
mDrawPath.lineTo(mSize / 2, 0);
mDrawPath.lineTo(mSize, mSize / 2);
mDrawPath.lineTo(mSize / 2, mSize);
mDrawPath.close();
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:CardItemView.java示例6: dispatchDraw
import android.graphics.Region; //导入依赖的package包/类
@Override
protected void dispatchDraw(Canvas canvas) {
// Draw the background below children.
if (mBackgroundAlpha > 0.0f) {
// Update the scroll position first to ensure scrim cutout is in the right place.
mLauncher.getWorkspace().computeScrollWithoutInvalidation();
int alpha = (int) (mBackgroundAlpha * 255);
CellLayout currCellLayout = mLauncher.getWorkspace().getCurrentDragOverlappingLayout();
canvas.save();
if (currCellLayout != null && currCellLayout != mLauncher.getHotseat().getLayout()) {
// Cut a hole in the darkening scrim on the page that should be highlighted, if any.
getDescendantRectRelativeToSelf(currCellLayout, mHighlightRect);
canvas.clipRect(mHighlightRect, Region.Op.DIFFERENCE);
}
canvas.drawColor((alpha << 24) | SCRIM_COLOR);
canvas.restore();
}
mFocusIndicatorHelper.draw(canvas);
super.dispatchDraw(canvas);
}
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:23,代码来源:DragLayer.java示例7: drawCurrentPageArea
import android.graphics.Region; //导入依赖的package包/类
private void drawCurrentPageArea(Canvas canvas, Bitmap bitmap, Path path) {
mPath0.reset();
mPath0.moveTo(mBezierStart1.x, mBezierStart1.y);
mPath0.quadTo(mBezierControl1.x, mBezierControl1.y, mBezierEnd1.x,
mBezierEnd1.y);
mPath0.lineTo(mTouchX, mTouchY);
mPath0.lineTo(mBezierEnd2.x, mBezierEnd2.y);
mPath0.quadTo(mBezierControl2.x, mBezierControl2.y, mBezierStart2.x,
mBezierStart2.y);
mPath0.lineTo(mCornerX, mCornerY);
mPath0.close();
canvas.save();
canvas.clipPath(path, Region.Op.XOR);
canvas.drawBitmap(bitmap, 0, 0, null);
try {
canvas.restore();
} catch (Exception e) {
}
}
开发者ID:z-chu,项目名称:FriendBook,代码行数:23,代码来源:SimulationPageAnim.java示例8: drawProgressRectWithClip
import android.graphics.Region; //导入依赖的package包/类
private void drawProgressRectWithClip(Canvas canvas) {
mPaint.setColor(mProgressBarColor);
mPaint.setStyle(Paint.Style.FILL);
//根据进度比率计算出当前的进度值对应的宽度
int progress = (int) (mValidWidth * (getProgress() * 1.0f / getMax()));
canvas.save();
canvas.translate(getPaddingLeft(), getPaddingTop());
//裁剪圆角矩形路径
drawRoundRectPath();
canvas.clipPath(mRoundRectPath);//裁剪之后此时画布就变成了裁剪之后的圆角矩形
//裁剪进度路径
drawProgressPath(progress);
canvas.clipPath(mProgressPath, Region.Op.INTERSECT);
canvas.drawColor(mProgressBarColor);
canvas.restore();
}
开发者ID:guzhigang001,项目名称:Bailan,代码行数:17,代码来源:DownloadProgressButton.java示例9: initData
import android.graphics.Region; //导入依赖的package包/类
private void initData() {
//关闭硬件加速,为了可以设置阴影
setLayerType(LAYER_TYPE_SOFTWARE, null);
mOuterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mOuterPaint.setStyle(Paint.Style.STROKE);
mOuterPaint.setStrokeWidth(mOuterWidth);
mOuterPaint.setColor(mOuterColor);
mInnerPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mInnerPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mInnerPaint.setColor(mInnerColor);
mRegion = new Region();
mViewPath = new Path();
}
开发者ID:Vander-liu,项目名称:HexagonRecyclerView,代码行数:19,代码来源:PolygonItemView.java示例10: drawPathAHorizontalShadow
import android.graphics.Region; //导入依赖的package包/类
/**
* 绘制A区域水平翻页阴影
* @param canvas
*/
private void drawPathAHorizontalShadow(Canvas canvas, Path pathA){
canvas.restore();
canvas.save();
canvas.clipPath(pathA, Region.Op.INTERSECT);
int maxShadowWidth = 30;//阴影矩形最大的宽度
int left = (int) (a.x - Math.min(maxShadowWidth,(rPathAShadowDis/2)));
int right = (int) (a.x);
int top = 0;
int bottom = viewHeight;
GradientDrawable gradientDrawable = drawableHorizontalLowerRight;
gradientDrawable.setBounds(left,top,right,bottom);
float mDegrees = (float) Math.toDegrees(Math.atan2(f.x-a.x,f.y-h.y));
canvas.rotate(mDegrees, a.x, a.y);
gradientDrawable.draw(canvas);
}
开发者ID:AnliaLee,项目名称:BookPage,代码行数:22,代码来源:BookPageView.java示例11: drawPathCContent
import android.graphics.Region; //导入依赖的package包/类
/**
* 绘制C区域内容
* @param canvas
* @param pathA
*/
private void drawPathCContent(Canvas canvas, Path pathA){
canvas.save();
canvas.clipPath(pathA);
canvas.clipPath(getPathC(), Region.Op.REVERSE_DIFFERENCE);//裁剪出C区域不同于A区域的部分
// canvas.drawPath(getPathC(),pathCPaint);
float eh = (float) Math.hypot(f.x - e.x,h.y - f.y);
float sin0 = (f.x - e.x) / eh;
float cos0 = (h.y - f.y) / eh;
//设置翻转和旋转矩阵
mMatrixArray[0] = -(1-2 * sin0 * sin0);
mMatrixArray[1] = 2 * sin0 * cos0;
mMatrixArray[3] = 2 * sin0 * cos0;
mMatrixArray[4] = 1 - 2 * sin0 * sin0;
mMatrix.reset();
mMatrix.setValues(mMatrixArray);//翻转和旋转
mMatrix.preTranslate(-e.x, -e.y);//沿当前XY轴负方向位移得到 矩形A₃B₃C₃D₃
mMatrix.postTranslate(e.x, e.y);//沿原XY轴方向位移得到 矩形A4 B4 C4 D4
canvas.drawBitmap(pathCContentBitmap, mMatrix, null);
drawPathCShadow(canvas);
canvas.restore();
}
开发者ID:AnliaLee,项目名称:BookPage,代码行数:30,代码来源:BookPageView.java示例12: dispatchDraw
import android.graphics.Region; //导入依赖的package包/类
@Override
protected void dispatchDraw(Canvas canvas) {
width = getWidth();
height = getHeight();
mClipPath.reset();
if (position == ElasticDrawer.Position.LEFT) {
drawLeftMenu();
} else {
drawRightMenu();
}
canvas.save();
canvas.drawPath(mClipPath, mPaint);
canvas.clipPath(mClipPath, Region.Op.REPLACE);
super.dispatchDraw(canvas);
canvas.restore();
}
开发者ID:Break369,项目名称:MyLife,代码行数:18,代码来源:FlowingMenuLayout.java示例13: draw
import android.graphics.Region; //导入依赖的package包/类
@Override
public void draw(Canvas canvas) {
int w = getWidth();
int h = getHeight();
canvas.clipPath(innerRoundPath(w, h), Region.Op.DIFFERENCE);
super.draw(canvas);
degree += speed;
degree %= 360;
matrix.setRotate(degree, w / 2, h / 2);
shader.setLocalMatrix(matrix);
rectF.left = 0;
rectF.top = 0;
rectF.right = w;
rectF.bottom = h;
canvas.drawRoundRect(rectF, radius, radius, paint);
invalidate();
}
开发者ID:android-notes,项目名称:sao,代码行数:20,代码来源:CoolView.java示例14: drawMinutes
import android.graphics.Region; //导入依赖的package包/类
private void drawMinutes(Canvas canvas, Path selectorPath, float alphaMod) {
final int minutesAlpha = (int) (255f * mHoursToMinutes * alphaMod + 0.5f);
if (minutesAlpha > 0) {
// Exclude the selector region, then draw minutes with no
// activated states.
canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipPath(selectorPath, Region.Op.DIFFERENCE);
drawMinutesClipped(canvas, minutesAlpha, false);
canvas.restore();
// Intersect the selector region, then draw minutes with only
// activated states.
canvas.save(Canvas.CLIP_SAVE_FLAG);
canvas.clipPath(selectorPath, Region.Op.INTERSECT);
drawMinutesClipped(canvas, minutesAlpha, true);
canvas.restore();
}
}
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:19,代码来源:RadialTimePickerView.java示例15: onSizeChanged
import android.graphics.Region; //导入依赖的package包/类
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mLayer = new RectF(0, 0, w, h);
RectF areas = new RectF();
areas.left = getPaddingLeft();
areas.top = getPaddingTop();
areas.right = w - getPaddingRight();
areas.bottom = h - getPaddingBottom();
mClipPath.reset();
if (mRoundAsCircle) {
float d = areas.width() >= areas.height() ? areas.height() : areas.width();
float r = d / 2;
PointF center = new PointF(w / 2, h / 2);
mClipPath.addCircle(center.x, center.y, r, Path.Direction.CW);
mClipPath.moveTo(-mEdgeFix, -mEdgeFix); // 通过空操作让Path区域占满画布
mClipPath.moveTo(w + mEdgeFix, h + mEdgeFix);
} else {
mClipPath.addRoundRect(areas, radii, Path.Direction.CW);
}
Region clip = new Region((int) areas.left, (int) areas.top,
(int) areas.right, (int) areas.bottom);
mAreaRegion.setPath(mClipPath, clip);
}
开发者ID:GcsSloop,项目名称:rclayout,代码行数:24,代码来源:RCRelativeLayout.java本文标签属性:
示例:示例志愿表
代码:代码转换器
java:javascript什么意思
Region:regional