Region.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:style-transfer 作者:
public Drawable findMatch(ScriptC_find_region findRegion, RenderScript mRs, Bitmap image) {
    Rect mRoiBounds = mFindRegion.findMatch(findRegion, mRs, image);
    int cutOffsetX = mFindRegion.getCutOffsetX();
    int cutOffsetY = mFindRegion.getCutOffsetY();
    final Path path = new Path();
    for (int i = 0; i < mPointsXY.length; i += 2) {
        if (i == 0) {
            path.moveTo(mPointsXY[i] - mRoiBounds.left + cutOffsetX,
                    mPointsXY[i + 1] - mRoiBounds.top + cutOffsetY);
        } else {
            path.lineTo(mPointsXY[i] - mRoiBounds.left + cutOffsetX,
                    mPointsXY[i + 1] - mRoiBounds.top + cutOffsetY);
        }
    }

    path.close();


    Drawable d = new Drawable() {
        Paint paint = new Paint();

        {
            paint.setStyle(Paint.Style.STROKE);
        }

        @Override
        public void draw(Canvas canvas) {
            canvas.drawPath(path, paint);
        }

        @Override
        public void setAlpha(int alpha) {
        }

        @Override
        public void setColorFilter(ColorFilter cf) {
        }

        @Override
        public int getOpacity() {
            return 0;
        }
    };
    return d;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号