Search in sources :

Example 1 with ExposureControl

use of javax.microedition.amms.control.camera.ExposureControl in project CodenameOne by codenameone.

the class AdvancedMultimediaManager method setExposure.

public void setExposure(Controllable player) {
    ExposureControl exposureControl = (ExposureControl) getControl(player, "javax.microedition.amms.control.camera.ExposureControl");
    if (exposureControl != null) {
        int[] supportedISOs = exposureControl.getSupportedISOs();
        if (supportedISOs != null && supportedISOs.length > 0) {
            int maxISO = Integer.MIN_VALUE;
            for (int i = 0; i < supportedISOs.length; i++) {
                if (supportedISOs[i] > maxISO) {
                    maxISO = supportedISOs[i];
                }
            }
            try {
                exposureControl.setISO(maxISO);
            } catch (MediaException me) {
            // continue
            }
        }
        String[] supportedMeterings = exposureControl.getSupportedLightMeterings();
        if (supportedMeterings != null) {
            for (int i = 0; i < supportedMeterings.length; i++) {
                if (DESIRED_METERING.equals(supportedMeterings[i])) {
                    exposureControl.setLightMetering(DESIRED_METERING);
                    break;
                }
            }
        }
    }
}
Also used : MediaException(javax.microedition.media.MediaException) ExposureControl(javax.microedition.amms.control.camera.ExposureControl)

Example 2 with ExposureControl

use of javax.microedition.amms.control.camera.ExposureControl in project CodenameOne by codenameone.

the class AdvancedMultimediaManager method setExposure.

public void setExposure(Controllable player) {
    ExposureControl exposureControl = (ExposureControl) getControl(player, "javax.microedition.amms.control.camera.ExposureControl");
    if (exposureControl != null) {
        int[] supportedISOs = exposureControl.getSupportedISOs();
        if (supportedISOs != null && supportedISOs.length > 0) {
            int maxISO = Integer.MIN_VALUE;
            for (int i = 0; i < supportedISOs.length; i++) {
                if (supportedISOs[i] > maxISO) {
                    maxISO = supportedISOs[i];
                }
            }
            try {
                exposureControl.setISO(maxISO);
            } catch (MediaException me) {
            // continue
            }
        }
        String[] supportedMeterings = exposureControl.getSupportedLightMeterings();
        if (supportedMeterings != null) {
            for (int i = 0; i < supportedMeterings.length; i++) {
                if (DESIRED_METERING.equals(supportedMeterings[i])) {
                    exposureControl.setLightMetering(DESIRED_METERING);
                    break;
                }
            }
        }
    }
}
Also used : MediaException(javax.microedition.media.MediaException) ExposureControl(javax.microedition.amms.control.camera.ExposureControl)

Aggregations

ExposureControl (javax.microedition.amms.control.camera.ExposureControl)2 MediaException (javax.microedition.media.MediaException)2