示例#1
0
/***********************************************************
 *  Name        : roadmap_camera_take_picture
 *  Purpose     : Shows the camera preview, passes target image attributes
 *                   and defines the target capture file location
 *
 */
BOOL roadmap_camera_take_picture( CameraImageFile* image_file, CameraImageBuf* image_thumbnail )
{
#if 1
	return FALSE;
#else
    int image_quality_percent;  // Image quality in percents
    int retVal, retValThumb = -1;
    int byte_per_pix = roadmap_camera_image_bytes_pp( image_thumbnail->pixfmt );
    // Transform to percent low - 34, medium - 67, high - 100
    image_quality_percent = 34 + 33 * (int) image_file->quality;

    // Set the target path
    CAMERA_IMG_FILE_SET_PATH( *image_file, roadmap_path_user(), gCaptureFileName );

    // Call the JNI for the file
    retVal = FreeMapNativeManager_TakePicture( image_file->width, image_file->height, image_quality_percent,
            image_file->folder, image_file->file );

    // Call the JNI for the thumbnail if requested and the picture was taken successfully
    if ( ( retVal == 0 ) && image_thumbnail )
    {
        // Assume 4 byte per pixel
        // Only int array can be accepted for the Android
        // Malloc SHOULD preserve 4-byte alignment so further casting is possible !!!!!!!
        image_thumbnail->buf = malloc( image_thumbnail->width * image_thumbnail->height * byte_per_pix );
        retValThumb = FreeMapNativeManager_GetThumbnail( image_thumbnail->width, image_thumbnail->height,
                                                                    byte_per_pix, (int*) image_thumbnail->buf );
        if ( retValThumb != 0 )
        {
            roadmap_log( ROADMAP_WARNING, "Thumbnail request to Android is failed" );
        }
    }
    return ( retVal == 0 );
#endif
}
示例#2
0
void roadmap_camera_take_picture_async_cb( int res )
{
   int retValThumb = -1;

   // Call the JNI for the thumbnail if requested and the picture was taken successfully
   if ( res )
   {
      CameraImageCaptureContext* context = sgCameraContext.context;
      CameraImageBuf* image_thumbnail = &context->image_thumbnail;
      int byte_per_pix = roadmap_camera_image_bytes_pp( image_thumbnail->pixfmt );
     // Assume 4 byte per pixel
     // Only int array can be accepted for the Android
     // Malloc SHOULD preserve 4-byte alignment so further casting is possible !!!!!!!
     image_thumbnail->buf = malloc( image_thumbnail->width * image_thumbnail->height * byte_per_pix );
     retValThumb = FreeMapNativeManager_GetThumbnail( image_thumbnail->width, image_thumbnail->height,
                                                                 byte_per_pix, (int*) image_thumbnail->buf );
     if ( retValThumb != 0 )
     {
         roadmap_log( ROADMAP_WARNING, "Thumbnail request to Android is failed" );
     }
   }
   sgCameraContext.capture_callback( sgCameraContext.context, res );
}