Android Question To erase drown lines on the preview image

Urishev

Member
Licensed User
Longtime User
Hello! How to erase drawn lines on the preview image of the camera?
Here is the code:
Sub Camera1_Preview (PreviewPic() AsByte)
'get the preview image
IfDateTime.Now > lastPreviewSaved + IntervalMs Then
Dim jpeg() AsByte = camEx.PreviewImageToJpeg(PreviewPic, 70)
lastPreviewSaved = DateTime.Now
DiminAsInputStream
in.InitializeFromBytesArray(jpeg, 0, jpeg.Length)
bmp1.Initialize2(in)
in.Close
EndIf

'draw the line
Dim cvs1 AsCanvas
Dim img1 AsImageView
img1.Initialize (bmp1)
Activity.AddView (img1,0%x,0%y,100%x,100%y)
cvs1.Initialize(img1)
cvs1.DrawLine((X1,Y1,X2,Y2, Colors.Blue,2dip)
EndSub

'to erase drawn line?
 

Urishev

Member
Licensed User
Longtime User
I want to draw and erase lines on the camera image preview.
To draw it turns out, to erase - no.
When there is a ordinary image to erase lines by using the reboot the image (img.Bitmap = LoadBitmap(...)
In this case, the image is a camera preview.
How to erase drawn lines on the preview image of the camera?
 
Upvote 0

wonder

Expert
Licensed User
Longtime User
To my knowledge, you can't erase anything that has been drawn in the Canvas...
By the way, the canvas is sloooooow, better to use a LibGDX (or any other OpenGL) transparent surface over the camera preview.

If you need me to elaborate further on how to construct such an algorithm, just let me know. :)
 
Upvote 0

Urishev

Member
Licensed User
Longtime User
Why not change the picture size? Use CameraExClass
Sub Camera1_Ready (Success As Boolean)
If Success Then
camEx.StartPreview
camEx.SetPictureSize(800, 600)
camEx.CommitParameters
Else
ToastMessageSho
w("Cannot open camera.", True)
End If
End Sub
What's wrong?
 
Upvote 0
Top