Hi all. Been wrestling with an issue. Trying to create a function that takes a black & white .png file, changes the colors, saves that bitmap to a global bitmap, and then exports that saved bitmap into an SQL database. Mixed results on this one. Either the BitmapCreator's bitmap saves only the original black & white image to the database, or the procedure corrupts the image of the database and destroys it. What I'm working with:
In the example here, I'm converting the white areas of the black & white original to transparent, and converting the black areas to "DarkColor". bmpTEMP holds the original black & white image. I'm using a globally-declared bitmap (AddBMP03) to transfer the altered bitmap to the subroutine that saves it to the database. It is first initialized using an empty bitmap ("Blank.png"). For some reason, I can see that the bc does its job and changes the color. When running the program, imgDark (the ImageView that displays the results) does indeed show the altered color version. I'm having a rough time transferring the newly-colored bitmap into AddBMP03. So far, all that ends up being transferred into that is the black & white original. How can I export the bitmap locked within bc.bitmap to the global bitmap AddMBP03?
B4X:
Dim bmpTEMP As Bitmap=LoadBitmap(File.DirRootExternal & BoxFrontPath, BoxFrontFile)
Dim bc As BitmapCreator
bc.Initialize(bmpTEMP.Width, bmpTEMP.Height)
'Redraw Image
For i=0 To (bmpTEMP.height-1)
For j=0 To (bmpTEMP.Width-1)
If bmpTEMP.GetPixel(j, i)=Colors.RGB(255,255,255) Then bc.SetColor(j, i, Colors.Transparent)
If bmpTEMP.GetPixel(j, i)=Colors.RGB(0,0,0) Then bc.SetColor(j, i, DarkColor)
Next
Next
bc.SetBitmapToImageView(bc.Bitmap, imgDark)
AddBMP03.Initialize(File.DirAssets, "Blank.png")
AddBMP03=imgDark.Bitmap
In the example here, I'm converting the white areas of the black & white original to transparent, and converting the black areas to "DarkColor". bmpTEMP holds the original black & white image. I'm using a globally-declared bitmap (AddBMP03) to transfer the altered bitmap to the subroutine that saves it to the database. It is first initialized using an empty bitmap ("Blank.png"). For some reason, I can see that the bc does its job and changes the color. When running the program, imgDark (the ImageView that displays the results) does indeed show the altered color version. I'm having a rough time transferring the newly-colored bitmap into AddBMP03. So far, all that ends up being transferred into that is the black & white original. How can I export the bitmap locked within bc.bitmap to the global bitmap AddMBP03?