'Drawing Backup Cam HUD Dynamically in Android

So I'm implementing an RTSP backup cam in an Android application. The catch is this: various vehicles have cams w/ different FOV - so I can't just throw a PNG up. It needs to be easily adjustable.

Currently my setup is to use paths:

redPath.moveTo(xLeft, yLeft);   //set starting point
redPath.lineTo(xLeft = (float)(xLeft + length * Math.sin(angleRads)),yLeft = (float)(yLeft - length * Math.cos(angleRads))); //move up (based on angle)
        canvas.drawLine(xLeft + 5, yLeft + 3, xLeft - length + 5, yLeft + 3, paint);
redPath.moveTo(xLeft = (float)(xLeft + gap * Math.sin(angleRads)),yLeft = (float)(yLeft - gap * Math.cos(angleRads))); //add 10px gap
redPath.lineTo(xLeft = (float)(xLeft + length * Math.sin(angleRads)),yLeft = (float)(yLeft - length * Math.cos(angleRads))); //draw next segment

which looks something like this - (small tweaking issues like the pixels overhanging notwithstanding):

enter image description here

But,I'd like to achieve more of a perspective drawing look - something like this (note that the lines are parallelograms):

enter image description here

in an ideal world, it could be modified by changing startXLeft, startXRight, startY and angle, and maintain look.



Sources

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

Source: Stack Overflow

Solution Source