iOS Question [BitmapCreator] Just blurred a bitmap

Alexander Stolte

Expert
Licensed User
Longtime User
Hello,

i have been trying for a while to provide several images with the blur effect, I tried to use the example to write a function that does just that.

this was my try:

B4X:
dim j as bitmap
j.bitmap = LoadBitmap(File.DirDocuments,"theimagefile.png")

 Dim  bc1 As BitmapCreator
            bc1.Initialize(j.Bitmap.Width,j.Bitmap.Height)
            bc1.DrawBitmap(j.Bitmap,bc1.TargetRect,True)
       
            Dim argb As ARGBColor
            Dim sum As ARGBColor
            sum.a = 255
            For x = 1 To bc1.mWidth - 2
                For y = 1 To bc1.mHeight - 2
                    sum.r = 0
                    sum.g = 0
                    sum.b = 0
                    For mx = -1 To 1
                        For my = -1 To 1
                            bc1.GetARGB(x + mx, y + my, argb)
                            sum.r = sum.r + argb.r * 0.11
                            sum.g = sum.g + argb.g * 0.11
                            sum.b = sum.b + argb.b * 0.11
                        Next
                    Next
                    bc1.SetARGB(x, y, sum)
                Next
            Next
               
               
            j.Bitmap = bc1.Bitmap

the code is from the BitmapCreator Example

This is not working, i want a function to give the bitmap file and the output is the blurred image file
 
Last edited:
Top