B4A Library Image Magnifier

A tiny project that wraps this Github Project. Posting:

1. B4A project
2. B4A library files
3. The Java source code

Touch the view and see it being magnified - you can adjust the magnification...

(I have added no code in Designer or in the Main Activity to position the views properly - leaving it up to you)

1.png


Sample Code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: ImageMagnifier
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private im1, im2, im3 As ImageMagnifier
    Dim bm As Bitmap
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
   
    bm.Initialize(File.DirAssets,"batman.jpg")
    im1.ImageBitmap = bm
    im1.MagnifierSize = 100
   
    im2.ImageBitmap = bm
    im2.MagnifierSize = 100   

    im3.ImageBitmap = bm
    im3.MagnifierSize = 100
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Library:

ImageMagnifier
Author:
Github: Noman Rafique, Wrapped by: Johan Schoeman
Version: 1
  • ImageMagnifier
    Fields:
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • ImageBitmap As Bitmap [write only]
    • Left As Int
    • MagnifierSize As Int [write only]
    • Tag As Object
    • Top As Int
    • Visible As Boolean
    • Width As Int
 

Attachments

  • TheJavaCode.zip
    95.4 KB · Views: 278
  • b4aImageMagnifier.zip
    73.6 KB · Views: 291
  • ImageMagnifierLibFiles.zip
    4.4 KB · Views: 267

Blue.Sky

Active Member
Licensed User
Longtime User
oh gread!!!!
I need this library in my app
Maybe create canvas from edittext and use bitmap to magnifier it ?
 
Top