Hi and good evening,
at first, I want to thank you all for your inputs and infos!
I confirm, that it is no good idea to use the lib, because the memory will not be deallocated (the amount of used RAM always is increasing...).
I tried Erel's advice to use the BitmapCreator. But I have no idea, how I can use it.
My task is:
I've an ImageView. I'm using Canvas to draw lines and circles and ... into the ImageView. This is working well.
Then I'm calling a method, which should change many pixels in this ImageView. In the following code, I'm setting the red-value of any pixel to 255 (it is only an example).
My not-working-sourcecode is:
Dim bmpCreator As BitmapCreator
bmpCreator.Initialize(ImgMinimap.Width,ImgMinimap.Height)
bmpCreator.CopyPixelsFromBitmap(ImgMinimap.Bitmap) '<- compile-error: incompatible types: Bitmap cannot be converted to B4XBitmapWrapper
Dim bmpArray (ImgMinimap.Width * ImgMinimap.Height * 4) As Byte
bmpArray = bmpCreator.Buffer
Dim x As Int
For x = 0 To ImgMinimap.Width * ImgMinimap.Height * 4 - 1 Step 4
bmpArray(x) = 255
Next
bmpCreator.Buffer = bmpArray '<- of course an error, because .Buffer is Readonly
ImgMinimap.Invalidate
My problem is:
There are two compile-errors. The first error tells me, that I have another object (B4XBitmapWrapper), but what is this and how can I use it?
The second error is, because the BitmapCreator.Buffer() is readonly. Is there a way, to put my modified array back to the creator to change the ImageView.
I don't want to let you work for me. But I was searching many threads, which couldn't help me. The DirectBuffer-lib was the only thing, which does exactly, what I'm looking for. But - like I wrote before - it doesn't clean the memory and it is not safe (like Erel wrote).
Do you have an idea for a solution of my problem?
Thank you again and have a nice evening. Best regards,
Wolfgang