B4A Library MaskedImageView v1.0.3

MIV
Version:
1.03
  • MaskedImageView
    Methods:
    • AddToParent (Parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
      programmatically add view to a panel or activity
    • Initialize (pkg As String, EventName As String, mask As String)
      Initialize the MaskImageView
      A mask you set here cannot be changed at runtime
    • IsInitialized As Boolean
    • getMask (width As Int, height As Int, name As String) As Bitmap
    Properties:
    • Drawable As Drawable [read only]
    • ImageBitmap As Bitmap [write only]
      Set the image to show Masked

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim miv1 As MaskedImageView
End Sub
[..]
    miv4.Initialize(Application.PackageName,"miv","shape_heart")
    miv1.AddToParent(Activity,125dip,125dip,100dip,100dip)
    miv1.ImageBitmap = bmp

charlymask.png
 

Attachments

  • libMaskedImageView_v1.0.3.zip
    22.5 KB · Views: 482
  • MaskedImageView_Example.zip
    405.1 KB · Views: 559

cambopad

Active Member
Licensed User
Longtime User
Hi @DonManfred! Thanks for this library! I just tested it, and it works!

However, I have one more question. Does it support click and touch event?
 

ilan

Expert
Licensed User
Longtime User
is it possible to creat our own shapes?? and i am missing a lib: Dim il As uil

cant find that lib anywhere on anywhere software website :D
 

Kwame Twum

Active Member
Licensed User
Longtime User
Hello @DonManfred and all, Please I'm finding it difficult working with my own .svgs... I created a couple of them but they don't work. I've attached a new one I created with Adobe Illustrator.
Could anyone guide me on how to create one or upload a similar one for me?

I also tried modifying the ones in the res folder, but when I do, they don't show in the app
NB. I'm running the downloaded sample.

My modified code:
B4X:
miv2.Initialize(Application.PackageName,"miv","hex")  'hex is the name of the .svg file I created
miv2.AddToParent(Activity,150dip,0dip,100dip,100dip)
miv2.ImageBitmap = bmp
2nd_image_not showing.jpg
 

Attachments

  • hex.zip
    697 bytes · Views: 262
Last edited:
Top