javax.microedition.amms.control.camera
Interface FocusControl

All Superinterfaces:
Control
All Known Subinterfaces:
EnhancedFocusControl

public interface FocusControl
extends Control

FocusControl controls the focus of the camera device.

Please note that (optical) zooming might affect the focus settings. See ZoomControl.setOpticalZoom(int) for details.

Since:
BlackBerry API 5.0.0

Field Summary
static int AUTO
          Autofocus.
static int AUTO_LOCK
          Locks the autofocus.
static int NEXT
          Moves the setting to the next supported level.
static int PREVIOUS
          Moves the setting to the previous supported level.
static int UNKNOWN
          Unknown value.
 
Method Summary
 int getFocus()
          Returns the focus setting of the camera device.
 int getFocusSteps()
          Tells how many steps the focus has.
 boolean getMacro()
          Gets the current macro focus mode.
 int getMinFocus()
          Returns the minimum focus distance supported (either manual or AUTO).
 boolean isAutoFocusSupported()
          Returns true if the automatic focus is supported by being able to set AUTO as a parameter for the setFocus method.
 boolean isMacroSupported()
          Returns true if the macro focus mode is supported.
 boolean isManualFocusSupported()
          Returns true if the manual focus is supported by being able to set the distance (or NEXT or PREVIOUS or Integer.MAX_VALUE) with setFocus method.
 int setFocus(int distance)
          Sets the focus distance.
 void setMacro(boolean enable)
           Toggles the macro focus mode.
 



Field Detail

AUTO

static final int AUTO
Autofocus.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

AUTO_LOCK

static final int AUTO_LOCK
Locks the autofocus.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

NEXT

static final int NEXT
Moves the setting to the next supported level.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

PREVIOUS

static final int PREVIOUS
Moves the setting to the previous supported level.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0

UNKNOWN

static final int UNKNOWN
Unknown value.

See Also:
Constant Field Values
Since:
BlackBerry API 5.0.0


Method Detail

setFocus

int setFocus(int distance)
             throws MediaException
Sets the focus distance.

Parameters:
distance - in millimeters or
AUTO for autofocus or
AUTO_LOCK for locking the autofocus or
Interger.MAX_VALUE for focus to infinity or
NEXT for next supported distance (further from the camera) or
PREVIOUS for previous supported distance (closer to the camera).

Setting a value other than AUTO, AUTO_LOCK or Integer.MAX_VALUE might be rounded to the closest distance supported.

If the current focus setting is other than AUTO then setFocus(AUTO_LOCK) will not affect anything.

If the current focus setting is AUTO and either setFocus(PREVIOUS) or setFocus(NEXT) is called then focus is set to previous or next supported distance, respectively, and automatic focus is turned off.

Returns:
the distance that was set or AUTO for autofocus or AUTO_LOCK for locked autofocus or Integer.MAX_VALUE for infinity
Throws:
MediaException - if the given focus setting is not supported
Since:
BlackBerry API 5.0.0

getFocus

int getFocus()
Returns the focus setting of the camera device.

Returns:
distance in millimeters or AUTO for autofocus or AUTO_LOCK for locked autofocus or Integer.MAX_VALUE for focus to infinity or UNKNOWN if the focus setting is unknown.
Since:
BlackBerry API 5.0.0

getMinFocus

int getMinFocus()
Returns the minimum focus distance supported (either manual or AUTO).

Returns:
the minimum focus distance in millimeters supported or UNKNOWN
Since:
BlackBerry API 5.0.0

getFocusSteps

int getFocusSteps()
Tells how many steps the focus has. That is how many different focusing distances we are able to set. AUTO is not counted as a step and therefore, if manual focus is not supported this method will return 0.

Returns:
the amount of steps
Since:
BlackBerry API 5.0.0

isManualFocusSupported

boolean isManualFocusSupported()
Returns true if the manual focus is supported by being able to set the distance (or NEXT or PREVIOUS or Integer.MAX_VALUE) with setFocus method.

Returns:
true if the manual focus is supported, false otherwise
Since:
BlackBerry API 5.0.0

isAutoFocusSupported

boolean isAutoFocusSupported()
Returns true if the automatic focus is supported by being able to set AUTO as a parameter for the setFocus method.

Returns:
true if the automatic focus is supported, false otherwise
Since:
BlackBerry API 5.0.0

isMacroSupported

boolean isMacroSupported()
Returns true if the macro focus mode is supported.

Returns:
true if the macro focus is supported, false otherwise
Since:
BlackBerry API 5.0.0

setMacro

void setMacro(boolean enable)
              throws MediaException

Toggles the macro focus mode. With this mode on, you can focus closer to the camera compared to a normal focusing mode. On the contrary, the range of available optical zoom settings might be more limited in the macro mode.

Please note that this method might affect all optical zoom settings in the ZoomControl. This method might also change all the settings in this FocusControl.

Parameters:
enable - true to turn the macro mode on, false to turn it off
Throws:
MediaException - if the given mode is not supported
Since:
BlackBerry API 5.0.0

getMacro

boolean getMacro()
Gets the current macro focus mode.

Returns:
true if the macro focus is enabled, false otherwise
Since:
BlackBerry API 5.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal