B4A Library RoundImage V1.0

RoundImage V1.0

This Library can create a round image from an bitmap or an round drawable from an drawable

B4X:
Sub Globals
    Dim ri As RoundImage
    Private Panel1 As Panel
    Private ImageView1 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout1")
    Dim bd As BitmapDrawable
    bd.Initialize(LoadBitmap(File.DirAssets,"simonscat.jpg"))
    Panel1.Background = ri.CreateDrawable(bd)
    ImageView1.Bitmap = ri.CreateBitmap(LoadBitmap(File.DirAssets,"simonscat.jpg"))
End Sub


RoundImage001.png
 

Attachments

  • RoundImageEx.zip
    61.6 KB · Views: 725
  • RoundImageLibfiles_V1.0.zip
    2.1 KB · Views: 866

anOparator

Active Member
Licensed User
Longtime User
You might be aware about this, LoadBitmapSample also working perfectly...

B4X:
img.Bitmap = ri.CreateBitmap(LoadBitmapSample(File.Dirinternal, Application.LabelName & "/" & uf,100%x,100%y))

Thanks for this brilliance!
Will try LoadBitmapSample also , see my edit 4 posts up.
 

FrankBerra

Active Member
Licensed User
Longtime User
Hi @DonManfred, i used your library and it works almost perfectly but in some strange and unclear situations it crashes my app.

The code I use is:
B4X:
FotoUtente.Bitmap=ImmagineCircolare.CreateBitmap(LoadBitmapSample(File.DirAssets, "nofotoprofilo.png", 90dip, 90dip))

The debugger says:
An error occurred:
java.lang.RuntimeException: Array not expected...

It crashes also if i use LoadBitmap instead of LoadBitmapSample.

(Sorry, I can't upload my project to test)

By the way if i use the following code everyting is going well:
B4X:
FotoUtente.Bitmap=LoadBitmapSample(File.DirAssets, "nofotoprofilo.png", 90dip, 90dip)

So it seems the crash is caused by your Lib...

Any workaround or fix?

Thanks in advance!
 
Top