clamp Camera Area Coordinate - Android Camera

Android examples for Camera:Camera Feature

Description

clamp Camera Area Coordinate

Demo Code


//package com.java2s;

public class Main {
    private static int clampAreaCoord(int center, int focusAreaSize) {
        int result;
        if (Math.abs(center) + focusAreaSize / 2 > 1000) {
            if (center > 0) {
                result = 1000 - focusAreaSize / 2;
            } else {
                result = -1000 + focusAreaSize / 2;
            }//w  w  w  .j  a v  a 2 s .c o m
        } else {
            result = center - focusAreaSize / 2;
        }
        return result;
    }
}

Related Tutorials