B4A Library B4AClayView - Crop and image trimming

Discussion in 'Additional libraries, classes and official updates' started by moster67, Apr 7, 2018.

  1. moster67

    moster67 Expert Licensed User

    B4AClayView - Crop and image trimming

    And here is another Image Cropping and Trimming-library :).

    You can use this to trim the outline of an image and create your own custom shape. You can also undo your previous trimming actions.

    Source/Creator: https://github.com/line/clay


    I wrapped this one because it looks cool and has some nice features/effects but mostly because the original library is written in Kotlin. This wrapper is a result of my ongoing learning process with Kotlin.

    I have attached a B4A example and also the library-files. Copy the lib-files to your Additional Lib folder.
    As to the required Kotlin Standard Library (version 1.2.31), you need to download it from this link.

    You may also be required to insert in your B4A-project:
    #AdditionalJar: com.android.support:support-v4
    Here is the lib-info (thanks to @Informatix for his LibDoc app):


    Author: Github: line, Wrapped by: moster67/Mikael Osterhed
    Version: 0.3
    • B4AClayFreeCropTrimmer
      • Fields:
        • ba As BA
      • Functions:
        • BringToFront
        • clearSelection
          Clear path selection
        • DesignerCreateView (base As Panel, lw As Label, props As Map)
        • GetCroppedImage (setAntiAlias As Boolean) As android.graphics.Bitmap
          Returns cropped image (option antiAlias)
        • Initialize (arg1 As String)
        • Invalidate
        • Invalidate2 (arg0 As android.graphics.Rect)
        • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
        • IsDrawPathSetOnCroppedImage As Boolean
          Is drawpath set on cropped image?
        • IsInitialized As Boolean
        • RemoveView
        • RequestFocus As Boolean
        • SendToBack
        • SetBackgroundImage (arg0 As android.graphics.Bitmap) As BitmapDrawable
        • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
        • SetDrawPathOnCroppedImage (setdrawpath As Boolean)
          Set drawpath on cropped image
        • 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)
        • Undo
      • Properties:
        • Background As android.graphics.drawable.Drawable
        • Bitmap As android.graphics.Bitmap
          Set/Get Bitmap
        • Color As Int [write only]
        • ControlPointColor As Int
          The control point color
        • Enabled As Boolean
        • EndPointRadius As Float
          The radius of end point
        • Height As Int
        • Left As Int
        • Padding As Int()
        • Parent As Object [read only]
        • PathStrokeColor As Int
          The path stroke color
        • PathStrokeWidth As Float
          The path stroke width
        • Tag As Object
        • Top As Int
        • Visible As Boolean
        • Width As Int


    Please remember that creating libraries and maintaining them takes time and so does supporting them. Please consider a donation if you use my free libraries as this will surely help keeping me motivated. Thank you!

    Attached Files:

  2. NJDude

    NJDude Expert Licensed User

    moster67 likes this.

    FERNANDO SILVEIRA Active Member Licensed User

    Excellent work!

    Is there a way to have regular types of cropping instead of free style? Like rectangles, squares, circles?
  4. moster67

    moster67 Expert Licensed User

    Not in this library.
    There are many other libs available in the forum which probably do what you want.
    FERNANDO SILVEIRA likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice