'How to draw four boundary rounded corner in canvas for qr code scanner

View image

How to draw four boundary rounded corner in canvas for journeyapps zxing qr code scanner Java code? Here is the code that I used. Just a rectangle with no rounding. How to create a rounded rectangle with custom radius.

private float mLineRate = 0.1f;

private float mLineDepth =
        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics());

private int mLineColor = Color.rgb(50, 205, 50);

@Override public void onDraw (Canvas canvas){

        final Rect frame = framingRect;
        final Size previewSize = this.previewSize;

        final int width = getWidth();
        final int height = getHeight();

    paint.setColor(mLineColor);
    canvas.drawRect(frame.left, frame.top,frame.left + frame.width() * mLineRate,frame.top + mLineDepth, paint);
    canvas.drawRect(frame.left, frame.top, frame.left + mLineDepth, frame.top + frame.height() * mLineRate, paint);

    canvas.drawRect(frame.right - frame.width() * mLineRate, frame.top, frame.right, frame.top + mLineDepth, paint);
    canvas.drawRect(frame.right - mLineDepth, frame.top, frame.right, frame.top + frame.height() * mLineRate, paint);

    canvas.drawRect(frame.left,frame.bottom - mLineDepth,frame.left + frame.width() * mLineRate, frame.bottom, paint);
    canvas.drawRect(frame.left, frame.bottom - frame.height() * mLineRate, frame.left + mLineDepth, frame.bottom, paint);

    canvas.drawRect(frame.right - frame.width() * mLineRate, frame.bottom - mLineDepth, frame.right, frame.bottom, paint);
    canvas.drawRect(frame.right - mLineDepth, frame.bottom - frame.height() * mLineRate, frame.right, frame.bottom, paint);

}



Solution 1:[1]

Sidekiq workers can be directly invoked using Worker.new.perform which ensures they run in inline mode - simple Ruby method invocation. Not the prettiest solution but comes in handy for testing.

  expect {
    WorkerOne.new.perform(10, 15)
  }.to change(WorkerTwo.jobs, :size).by(1)

Here's an executable gist - https://gist.github.com/tejasbubane/09c1412b88ce1e9cb3dacff0817119d2

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tejasbubane