B4A Library ParaCamera

this is a wrap for this github project.

ParaCamera
Author:
DonManfred (wrapper)
Version: 1

  • Fields:
    • IMAGE_JPEG As String
    • IMAGE_JPG As String
    • IMAGE_PNG As String
    • REQUEST_TAKE_PHOTO As Int
      public variables to be used in the builder
    Methods:
    • builder As CameraBuilder

      Return type: @return:create camera builder
    • deleteImage
      Deletes the saved camera image
    • resizeAndGetCameraBitmap (imageHeight As Int) As Bitmap

      imageHeight:
      Return type: @return:Bitmap with approx desired height
    • resizeAndGetCameraBitmapPath (imageHeight As Int) As String

      imageHeight:
      Return type: @return:Bitmap path with approx desired height
    • takePicture
      Initiate the existing camera apps
    Properties:
    • CameraBitmap As Bitmap [read only]
    • CameraBitmapPath As String [read only]

  • Methods:
    • createDir (context As Context, dirName As String) As File

      context:
      dirName:
      Return type: @return:
    • createImageFile (context As Context, dirName As String, fileName As String, fileType As String) As File

      context:
      dirName:
      fileName:
      fileType:
      Return type: @return:
    • decodeFile (file As File, requiredHeight As Int) As Bitmap

      file:
      requiredHeight:
      Return type: @return:
    • saveBitmap (bitmap As Bitmap, filePath As String, imageType As String, compression As Int)

      bitmap:
      filePath:
      imageType:
      compression:

  • Methods:
    • setCompression (compression As Int) As CameraBuilder
    • setDirectory (dirName As String) As CameraBuilder
    • setImageFormat (imageFormat As String) As CameraBuilder
    • setImageHeight (imageHeight As Int) As CameraBuilder
    • setName (imageName As String) As CameraBuilder
  • CameraBuilder
    Fields:
    • IMAGE_JPEG As String
    • IMAGE_JPG As String
    • IMAGE_PNG As String
    • REQUEST_TAKE_PHOTO As Int
      public variables to be used in the builder
    Methods:
    • Initialize (EventName As String, builder As CameraBuilder)
    • IsInitialized As Boolean
    • setCompression (compression As Int) As CameraBuilderWrapper
    • setDirectory (dirName As String) As CameraBuilderWrapper
    • setImageFormat (imageFormat As String) As CameraBuilderWrapper
    • setImageHeight (imageHeight As Int) As CameraBuilderWrapper
    • setName (imageName As String) As CameraBuilderWrapper
  • ParaCamera
    Fields:
    • IMAGE_JPEG As String
    • IMAGE_JPG As String
    • IMAGE_PNG As String
    • REQUEST_TAKE_PHOTO As Int
      public variables to be used in the builder
    Methods:
    • Initialize (EventName As String)
    • IsInitialized As Boolean
    • builder As CameraBuilder

      Return type: @return:create camera builder
    • deleteImage
      Deletes the saved camera image
    • resizeAndGetCameraBitmap (imageHeight As Int) As Bitmap

      imageHeight:
      Return type: @return:Bitmap with approx desired height
    • resizeAndGetCameraBitmapPath (imageHeight As Int) As String

      imageHeight:
      Return type: @return:Bitmap path with approx desired height
    • takePicture
      Initiate the existing camera apps
    Properties:
    • CameraBitmap As Bitmap [read only]
    • CameraBitmapPath As String [read only]

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim cam As ParaCamera
    Dim builder As CameraBuilder
    Private Button1 As Button
    Private ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    cam.Initialize("")
    builder = cam.builder
    builder.setCompression(100).setDirectory("TestImages").setImageFormat("png").setName("huhu")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
    If cam.CameraBitmapPath <> "" Then
        Log(cam.CameraBitmapPath)
        Log(cam.resizeAndGetCameraBitmapPath(1024))
        ImageView1.Bitmap = cam.CameraBitmap
    End If
End Sub
Sub Button1_Click
    cam.takePicture
End Sub
 

Attachments

  • ParaCamera.zip
    7.9 KB · Views: 473
  • ParaCameraV1.0.zip
    8.3 KB · Views: 494

Alberto Iglesias

Well-Known Member
Licensed User
Longtime User
Hi Manfred, I got an error, look the attachment.

I tried in a NEXUS 4 (Android 5.1.1)
 

Attachments

  • error.png
    error.png
    124 KB · Views: 377

scsjc

Well-Known Member
Licensed User
Longtime User
Hello Manfred,
i think is not possible select the camera (front/rear) ?

thank !!!
 
Top