···108108 * @param angle The rotation angle in degrees (must be a multiple of 90) to apply to the focus area rectangle
109109 * @return A new bitmap with areas outside the focus area blacked out, or the original bitmap if focusArea is null
110110 */
111111-fun Bitmap.applyFocusAreaMask(focusArea: Rect?, angle: Int = 0): Bitmap {
111111+fun Bitmap.applyFocusAreaMask(focusArea: Rect?, _angle: Int = 0): Bitmap {
112112 return focusArea?.let { rect ->
113113 val result = this.copy(this.config ?: Bitmap.Config.ARGB_8888, true)
114114 val canvas = android.graphics.Canvas(result)
···116116 color = android.graphics.Color.BLACK
117117 }
118118119119+ val angle = 0
119120 // Transform the rectangle coordinates based on the angle
120121 val transformedRect = when (angle % 360) {
121122 90 -> Rect(
···201202 } ?: emptyList()
202203 var skeleton: Skeleton? = null
203204 val poseDetectionTask = mlKitImage?.let {
205205+ val rotation = it.rotationDegrees
204206 poseDetector?.process(it)?.addOnSuccessListener { pose ->
205205- skeleton = skeleton(pose, timestamp, width, height)
207207+ skeleton = skeleton(pose, timestamp, width, height).let{
208208+ it.rotate(rotation)
209209+ }
206210 }?.addOnFailureListener { e ->
207211 //println(e)
208212 }