Configure the zoom level on the camera for taking a photo.
camera_error_t camera_set_zoom(camera_handle_t handle, unsigned int level, bool smooth)
The handle returned by a call to the camera_open() function.
An unsigned int value which falls within the minimum or maximum range returned by camera_get_zoom_limits() function. A value of 0 indicates not to use zoom. Values larger than zero indicate increasing magnification.
A of true specifies to zoom to specified level value, while a value of false, specifies to jump to the specified zoom level.
This function can be called if the CAMERA_FEATURE_VIDEOZOOM or CAMERA_FEATURE_PHOTOZOOM feature are available. You can determine whether the feature is available by calling the camera_can_feature() function. In addition, the photo or video viewfinder must be started using either the camera_start_photo_viewfinder() or camera_start_video_viewfinder() functions, respectively.
The value that you specify as the level argument sets the viewfinder zoom-level. The zoom level is a value supported by the camera hardware and can represent an optical or digital zoom depending on which the hardware supports.
You can specify whether to use smooth zooming using the smooth argument. You can use the camera_get_zoom_limits() function to determine the supported zoom levels and whether the camera supports smooth zooming.
CAMERA_OK when the function successfully sets the zoom level, otherwise another camera_error_t value that provides the reason that the call failed.