B4A Library [Lib, Chargeable] MFLib 2 - tons of functions for B4A

Today i will present you my new MFLib version 2.

Version 2 contains new and faster functions and new objects.

List of classes and functions (for details see following posts):

Base library (MFLib.jar)
Base functions:
Version(), Copyright(), GetDeviceID()​
ActivityInfo functions:
Orientation(), Rotation()​
Color functions:
List of material color constants.​
Date functions:
Easter(), EncodeDate(), EncodeDateTime(), EncodeTime(), FromJulian(), IsLeapYear(), ToJulian()​
Draw functions:
BitmapDisabledState(), BitmapDisabledState2(), BitmapDrawableFromResource(), BitmapFromResource(), BitmapPressedState(), BitmapPressedState2(), TiledBitmapDrawableFromResource()​
File functions:
ApplicationPath(), BaseName(), ChangeExt(), Copy(), Copy2(), CurrentDir(), Delete(), Delete2(), DirDefaultCard(), DirDefaultExternal(), DirRootCard(), DirRootExternal(), Exists(), Exists2(), ExternalFilesDirs(), ExternalRootDirs(), FileDir(), FileExt(), FileName(), FileSeparator(), Find(), Find2(), ListFiles(), ListFiles2(), MakePath(), Move(), Move2(), PathSeparator(), Rename(), Rename2(), TempDir(), TextFileLoad(), TextFileSave(), UserDir()​
Info functions:
AndroidApiVersion(), AndroidVersion(), CurrencySymbol(), DecimalSeparator(), DeviceId(), GroupingSeparator(), IsConnected(), IsRoaming(), JavaVersion(), Language(), MemHeapFree(), MemHeapMax(), MemHeapTotal(), MemDeviceFree(), MemDeviceTotal(), NetworkInfo(), NumProcessors(), DisplayInfo(), NativeOrientationLandscape(), Orientation(), Region(), Rotation(), Serial(), SystemArchitecture(), SystemName(), SystemVersion(), Timezone(), UserName()​
Math functions:
CompareFloat(), CompareInt(), ConstrainFloat(), ConstrainInt(), EqualsFloat(), EqualsInt(), GetAngleFromXY(), GetRadiusFromXY(), GetXFromRadiusAngle(), GetYFromRadiusAngle(), MapFloat(), MapInt(), RoundTo()​
String functions:
Append(), Base64Decode(), Base64Encode(), BestLevenshtein(), CompareLogical(), Compare(), ContainsNumber(), CRC32(), CRC32Hex(), Key(), Key2(), Key3(), Left(), LevenshteinDistance(), Mid(), Reverse(), Right(), SetLength(), SizeToStr(), StringOfChar(), TokenList(), TokenList2(), TokenListList(), TokenListList2(), Translate(), Trim(), TrimLeft(), TrimRight(), Value(), Value2(), Value3()​
BitFiend class:
Initialize(), Clear(), Count(), Fill(), Get(), Put(), Toggle(), HasSet(), FromString(), FromStringBase64(), ToString(), ToStringBase64()​
TiledBitmapDrawable object:
Initialize(), Initialize2()​

Image library (MFImage.jar)
Base functions:
Version(), Copyright(), Alpha(), ApplyMatrix(), ARGB2HSV(), ARGB2HSV2(), ARGBdecode(), ARGBencode(), ARGBencode2(), ARGBtoHSV(), ARGBtoHSV2(), BitmapCreate(), BitmapCreate2(), BitmapCreate565(), BitmapToHSV(), BitmapToString(), BitmapToString2(), BitmapToString3(), BlackAndWhite(), BlackAndWhite2(), BlackAndWhite3(), Blue(), Blur(), Blur2(), Blur3(), ColorAnalogous(), ColorComplementary(), ColorComplementaryTriad(), ColorModifiedTriad(), ColorNearComplementary(), ColorSplitComplementary(), ColorSwap(), ColorSwap2(), ColorSwap3(), ColorTriad(), Convolve(), Convolve2(), Convolve3(), CreateMaskedBitmap(), Crop(), Crop2(), Edge(), Edge2(), Edge3(), EffectBrightness(), EffectContrast(), EffectHue(), EffectPolaroid(), EffectSaturation(), Emboss(), Emboss2(), Emboss3(), Engrave(), Engrave2(), Engrave3(), Fill(), FillAlpha(), FillColor(), GetDensity(), Grayscale(), Grayscale2(), Grayscale3(), Green(), HSV(), HSV2(), HSVtoARGB(), HSVtoARGB2(), Invert(), Invert2(), Invert3(), LoadBitmap(), LoadBitmap2(), LoadBitmapWithOverlay(), LoadMaskedBitmap(), LoadMaskedBitmap2(), Mirror(), Mirror2(), Posterize(), Posterize2(), Posterize3(), QuickBlur(), QuickEdge(), QuickEdge2(), QuickSoft(), Red(), Resize(), RGB2HSV(), RGB2HSV2(), RGBencode(), RGBencode2(), RGBtoHSV(), RGBtoHSV2(), Rotate(), Rotate2(), RotateFixed(), RotateFixed2(), RotateFixed3(), SaveBitmap(), Scale(), Scale2(), Sepia(), Sepia2(), Sepia3(), Sepia4(), SetDensity(), SetDisabled(), SetDisabled2(), SetDisabled3(), SetPressed(), SetPressed2(), SetPressed3(), Sharpen(), Sharpen2(), Sharpen3(), Skew(), Skew2(), Smooth(), Smooth2(), Smooth3(), Sobel(), Sobel2(), Sobel3(), Solarize(), Solarize2(), StringToBitmap(), StringToBitmap2(), StringToBitmap3(), Threshold(), Threshold2(), Translate(), YUV2Bitmap(), YUV2Bitmap565()​
Matrix class:
Initialize(), Initialize2(), Assign(), Assign2(), Background(), Filter(), NeededSize(), NeededSize2(), PostRotate(), PostScale(), PostSkew(), PostTranslate(), PreRotate(), PreScale(), PreSkew(), PreTranslate(), Reset(), SetRotate(), SetScale(), SetSkew(), SetTranslate(), SetValues()​
ColorMatrix class:
Initialize(), Initialize2(), Initialize3(), Append(), Append2(), Assign(), Count(), ID(), Name(), Names(),
MATRIX_BLACKANDWHITE, MATRIX_BLUE_BLINDNESS, MATRIX_BLUE_DEBILITY, MATRIX_BLUE, MATRIX_BLUETOGRAY, MATRIX_BRIGHTNESS, MATRIX_COLOR_BLINDNESS, MATRIX_COLOR_DEBILITY, MATRIX_COLORSWAP_RGB_BGR, MATRIX_COLORSWAP_RGB_BRG, MATRIX_COLORSWAP_RGB_GBR, MATRIX_COLORSWAP_RGB_GRB, MATRIX_COLORSWAP_RGB_RBG, MATRIX_CONTRAST, MATRIX_CYAN, MATRIX_GRAYSCALE, MATRIX_GREEN_BLINDNESS, MATRIX_GREEN_DEBILITY, MATRIX_GREEN, MATRIX_GREENTOGRAY, MATRIX_HUE, MATRIX_INVERTED, MATRIX_MAGENTA, MATRIX_OLDPHOTO, MATRIX_POLAROID, MATRIX_RED_BLINDNESS, MATRIX_RED_DEBILITY, MATRIX_RED, MATRIX_REDTOGRAY, MATRIX_SATURATION, MATRIX_SEPIA, MATRIX_YELLOW​
Face detect class:
Initialize(), Detect(), NumberOfFaces(), Confidencs(), EyesDistance(), MidPoint(), Pose(), FaceRect()​

Math parser library (MFParser.jar)
Functions:
Parse(), CreateUserFunction(), VariableClear(), VariableExist(), VariableGet(), VariableRemove(), VariableSet()​

ImageCropper view (MFImageCropper.jar)
Like CropImageView​

Joystick and Slider view (MFJoy.jar)

Lua script interpreter (MFLibLua.jar)
Lua 5.2 interpreter to script your app. It contains the complete MFLib base library because many of these functions are implemented as Lua functions.
You can implement your own functions in the interpreter.​


Example apps for base, image, parser and Lua functions included.


Additionally the package contains the MFLib native Library selector (Windows program).
With this selector you can select which native library platforms (arm, arm v7, arm 64, x86, ...) should be included in the libs, individually for each project.


Drawback: this new version is donationware and not free.

For a donation of at least 10 Euro i will send you the download info for the base library setup (all functions/objects and the examples, but without the Lua library).
On library updates i inform you with download info for the new version.

For a donation of 15 Euro i will send you the download info for the extended library setup (all functions/objects and the examples, including the Lua library).

For a donation of 20 Euro i will send you the download info for the extended library setup and for the max library setup when available (end of year/beginning next year).
The max library is same as the extended library and additionally with motion detection class.

The old version 1.07 will be free forever but it's not longer maintained.
 

MaFu

Well-Known Member
Licensed User
Longtime User
Base library (MFLib.jar)
  • MFBitField
    Methods:
    • Clear
    • Count As Int
    • Fill
    • FromString (s As String) As Boolean
      Load a bit field from a string.
      The length of the bit field in the string must match the current bit field.
      The string must coded as bit field data with 0 (for False) and 1 (for True).
      Returns True on success and False on error.
    • FromStringBase64 (s As String) As Boolean
      Load a bit field from a string.
      The length of the bit field in the string must match the current bit field.
      The string must coded as bit field data in Base64 format.
      Returns True on success and False on error.
    • Get (index As Int) As Boolean
      Get a bit value at index.
    • HasSet As Boolean
      Check if at least one bit is set.
    • Initialize (numberOfBits As Int)
      Initialize class. Can be repeatedly used to reset the matrix.
      Allowed number of items: 999 (max. memory consumption: 143 bytes)
    • IsInitialized As Boolean
    • Put (index As Int, value As Boolean)
      Set a bit value at index.
    • ToString As String
    • ToStringBase64 As String
    • Toggle (index As Int)
      Toggle a bit value at index.
  • MFTiledBitmapDrawable
    Methods:
    • Initialize (bmp As Bitmap, cornerRadius As Float)
      Initialize class.
    • Initialize2 (name As String, cornerRadius As Float)
      Initialize class.
  • MF_ActivityInfo
    Methods:
    • Orientation As Int
      Returns the display orientation of the android device.
    • Rotation As Int
      Returns the display rotation (based on its natural orientation) of the android device.
  • MF_Base
    Methods:
    • Copyright As String
      Returns the MFLib copyright string.
    • GetDeviceID As String
      Returns a device id as string, based on a random UUID.
      On first run, the id will be created and stored as file __id in DirInternal.
      Caution: The id changes on uninstalling/reinstalling app.
    • Version As String
      Returns the MFLib version.
  • MF_Date
    Methods:
    • Easter (year As Int) As Long
      Calculates the date of easter sunday for the given year.
    • EncodeDate (year As Int, month As Int, day As Int) As Long
      Encodes year, month and day to standard date format.
    • EncodeDateTime (year As Int, month As Int, day As Int, hour As Int, minute As Int, second As Int, milliSecond As Int) As Long
      Encodes year, month, day, hour, minute, second and millisecond to standard date format.
    • EncodeTime (hour As Int, minute As Int, second As Int, milliSecond As Int) As Long
      Encodes hour, minute, second and millisecond to standard date format.
    • FromJulian (j As Double, base As Int) As Long
      Convert the given julian date to standard date format.
      Parameter 'base' defines the calculation base:
      JULIAN_ORIGIN = days elapsed since -4713-11-24 12:00 (the original julian format)
      JULIAN_CHRONOLOGICAL = days elapsed since -4713-11-24 00:00 (same as original but starts at midnight)
      JULIAN_REDUCED = days elapsed since 1858-11-16 12:00 (rarely used)
      JULIAN_MODIFIED = days elapsed since 1858-11-17 00:00 (introduced by the Smithsonian Astrophysical Observatory in 1957, recommended for general use by the International Astronomical Union and other authorities)
      JULIAN_DUBLIN = days elapsed since 1899-12-31 12:00 (invented by the International Astronomical Union, used in Microsoft Excel)
    • IsLeapYear (year As Int) As Boolean
      Check if the given year is a leap year.
    • ToJulian (dt As Long, base As Int) As Double
      Convert the given standard date format to julian date.
      Parameter 'base' defines the calculation base:
      JULIAN_ORIGIN = days elapsed since -4713-11-24 12:00 (the original julian format)
      JULIAN_CHRONOLOGICAL = days elapsed since -4713-11-24 00:00 (same as original but starts at midnight)
      JULIAN_REDUCED = days elapsed since 1858-11-16 12:00 (rarely used)
      JULIAN_MODIFIED = days elapsed since 1858-11-17 00:00 (introduced by the Smithsonian Astrophysical Observatory in 1957, recommended for general use by the International Astronomical Union and other authorities)
      JULIAN_DUBLIN = days elapsed since 1899-12-31 12:00 (invented by the International Astronomical Union, used in Microsoft Excel)
  • MF_Draw
    Methods:
    • BitmapDisabledState (bmp As Bitmap) As Bitmap
      Returns the disabled state (gray and transparent) from given bitmap.
    • BitmapDisabledState2 (name As String) As Bitmap
      Returns the disabled state (gray and transparent) from bitmap resource with given name.
    • BitmapDrawableFromResource (name As String) As BitmapDrawable
      Returns image with given name from resource as BitmapDrawable.
    • BitmapFromResource (name As String) As Bitmap
      Returns image with given name from resource as Bitmap.
    • BitmapPressedState (bmp As Bitmap, backCol As Int, radius As Int) As Bitmap
      Returns the pressed state from given bitmap.
    • BitmapPressedState2 (name As String, backCol As Int, radius As Int) As Bitmap
      Returns the pressed state from bitmap resource with given name.
    • TiledBitmapDrawableFromResource (name As String, cornerRadius As Float) As MFTiledBitmapDrawable
      Returns image with given name from resource as MFTiledBitmapDrawable.
  • MF_File
    Methods:
    • BaseName (path As String) As String
      Returns the file name (with extension) from a given path.
    • ChangeExt (path As String, newExt As String) As String
      Change the file extension from a given path.
      A empty string parameter removes the extension.
    • Copy (dirSource As String, fileSource As String, dirTarget As String, fileTarget As String, replaceExisting As Boolean, keepDate As Boolean) As Boolean
      Copy a file.
      To overwrite a existing target, replaceExisting must be True.
    • Copy2 (sourcePath As String, targetPath As String, replaceExisting As Boolean, keepDate As Boolean) As Boolean
      Copy a file.
      To overwrite a existing target, replaceExisting must be True.
    • CurrentDir As String
      Returns the current directory.
    • Delete (dirName As String, fileName As String) As Boolean
      Delete a file or directory.
    • Delete2 (path As String) As Boolean
      Delete a file or directory.
    • DirDefaultCard As String
      Returns absolute path to application-specific directory on first external storage device.
    • DirDefaultExternal As String
      Returns absolute path to application-specific directory on internal storage.
    • DirRootCard As String
      Returns root path to first external storage device.
    • DirRootExternal As String
      Returns root path to internal storage.
    • Exists (dirName As String, fileName As String, ignoreCase As Boolean, extendedCompare As Boolean) As Boolean
      Check if file exists in directory, the filename can use wildcard characters (*, ?).
      Set ignoreCase to True to ignore case sensitivity on compare.
      If extendedCompare is True the filename can also contains the wildcard + and character ranges ([a,b,c] or [a-z]).
      Wildcard + is same as * but at least one character must exist (* accepts empty strings).
    • Exists2 (path As String, ignoreCase As Boolean, extendedCompare As Boolean) As Boolean
      Check if file exists in directory, the filename can use wildcard characters (*, ?).
      Set ignoreCase to True to ignore case sensitivity on compare.
      If extendedCompare is True the filename can also contains the wildcard + and character ranges ([a,b,c] or [a-z]).
      Wildcard + is same as * but at least one character must exist (* accepts empty strings).
    • ExternalFilesDirs As List
      Returns absolute paths to application-specific directories on all external storage devices.
    • ExternalRootDirs As List
      Returns root paths to all external storage devices.
    • FileDir (path As String) As String
      Returns the full directory name from a given path.
    • FileExt (path As String) As String
      Returns the file extension from a given path.
    • FileName (path As String) As String
      Returns the file name (without extension) from a given path.
    • FileSeparator As String
      Returns the file separator ("/" on Unix, "\" on Windows).
    • Find (dirName As String, fileName As String, ignoreCase As Boolean, extendedCompare As Boolean) As String
      Returns the real file name if the file exists in directory or an empty string if not.
      The filename can use wildcard characters (*, ?).
      Set ignoreCase to True to ignore case sensitivity on compare.
      If extendedCompare is True the filename can also contains the wildcard + and character ranges ([a,b,c] or [a-z]).
      Wildcard + is same as * but at least one character must exist (* accepts empty strings).
    • Find2 (path As String, ignoreCase As Boolean, extendedCompare As Boolean) As String
      Returns the real file name if the file exists in directory or an empty string if not.
      The filename can use wildcard characters (*, ?).
      Set ignoreCase to True to ignore case sensitivity on compare.
      If extendedCompare is True the filename can also contains the wildcard + and character ranges ([a,b,c] or [a-z]).
      Wildcard + is same as * but at least one character must exist (* accepts empty strings).
    • ListFiles (dirName As String, fileName As String, ignoreCase As Boolean, extendedCompare As Boolean) As List
      Returns a list of matching files from directory, the filename can use wildcard characters (*, ?).
      Set ignoreCase to True to ignore case sensitivity on compare.
      If extendedCompare is True the filename can also contains the wildcard + and character ranges ([a,b,c] or [a-z]).
      Wildcard + is same as * but at least one character must exist (* accepts empty strings).
    • ListFiles2 (dirName As String, fileName As String, ignoreCase As Boolean, extendedCompare As Boolean, recursive As Boolean, includeFiles As Boolean, includeDirs As Boolean) As List
      Returns a list of matching files from directory, the filename can use wildcard characters (*, ?).
      Set ignoreCase to True to ignore case sensitivity on compare.
      If extendedCompare is True the filename can also contains the wildcard + and character ranges ([a,b,c] or [a-z]).
      Wildcard + is same as * but at least one character must exist (* accepts empty strings).
      If resursive is True then subfolders will also scanned.
      If listFiles is True then files will included in the result list.
      If listDirs is True then directories will included in the result list.
    • MakePath (dirName As String, fileName As String) As String
      Combines directory name and file name with correct separator.
    • Move (dirSource As String, fileSource As String, dirTarget As String, fileTarget As String, replaceExisting As Boolean, keepDate As Boolean) As Boolean
      Move a file.
      Source path and target path can belong to different drive.
      To overwrite a existing target, replaceExisting must be True.
    • Move2 (sourcePath As String, targetPath As String, replaceExisting As Boolean, keepDate As Boolean) As Boolean
      Move a file.
      Source path and target path can belong to different drive.
      To overwrite a existing target, replaceExisting must be True.
    • PathSeparator As String
      Returns the path separator (":" on Unix, ";" on Windows).
    • Rename (dirSource As String, fileSource As String, dirTarget As String, fileTarget As String, replaceExisting As Boolean) As Boolean
      Rename a file or directory.
      Source path and target path must belong to the same drive.
      To overwrite a existing target, replaceExisting must be True.
    • Rename2 (sourcePath As String, targetPath As String, replaceExisting As Boolean) As Boolean
      Rename a file or directory.
      Source path and target path must belong to the same drive.
      To overwrite a existing target, replaceExisting must be True.
    • TempDir As String
      Returns the temp directory.
    • TextFileLoad (var0 As String, var1_1 As String) As List
    • TextFileSave (string22 As String, string22 As String, string22 As List) As Boolean
    • UserDir As String
      Returns the user home directory.
  • MF_Info
    Methods:
    • AndroidApiVersion As Int
      Returns the android API version.
    • AndroidVersion As String
      Returns the android version.
    • CurrencySymbol As String
      Returns the currency symbol.
    • DecimalSeparator As String
      Returns the decimal separator symbol.
    • DeviceId As String
      Returns the unique device ID, for example, the IMEI for GSM and the MEID or ESN for CDMA phones.
      Return empty string if device ID is not available.
      Requires Permission: READ_PHONE_STATE
    • DisplayInfo As MyMap
      Returns display infos as Map.
    • GroupingSeparator As String
      Returns the thousands separator symbol.
    • IsConnected As String
      Check for network connection.
      The function returns the active connection type ("MOBILE", "WIFI", "BLUETOOTH" or "" if not connected).
    • IsRoaming As Boolean
      Check if current connection has roaming state.
    • JavaVersion As String
      Returns the java version.
    • Language As String
      Returns the two-letter language code of the default locale.
    • MemDeviceFree As Long
      Returns the amount of free device memory (RAM) in kilobytes.
    • MemDeviceTotal As Long
      Returns the total amount of device memory (RAM) in kilobytes.
    • MemHeapFree As Long
      Returns the free heap memory in bytes.
    • MemHeapMax As Long
      Returns the max heap memory in bytes.
    • MemHeapTotal As Long
      Returns the current heap memory in bytes.
    • NativeOrientationLandscape As Boolean
      Detects device default (native) display orientation.
      Returns True if the default orientation is landscape and False if it is portrait.
    • NetworkInfo As List
    • NumProcessors As Int
      Returns the number of processor cores.
    • Orientation As Int
      Returns current display orientation.
      (can be MF_Info_ORIENTATION_LANDSCAPE, MF_Info_ORIENTATION_PORTRAIT or MF_Info_ORIENTATION_SQUARE)
    • Region As String
      Returns the two-letter country code of the default locale.
    • Rotation As Int
      Returns current display rotation.
      (can be MF_Info.ROTATION_0, MF_Info.ROTATION_90, MF_Info.ROTATION_180 or MF_Info.ROTATION_270)
    • Serial As String
      Returns the device serial number.
    • SystemArchitecture As String
      Returns the system architecture.
    • SystemName As String
      Returns the name of the operating system.
    • SystemVersion As String
      Returns the operating system version.
    • Timezone As String
      Returns the default time zone.
    • UserName As String
      Returns the user name.
  • MF_Math
    Methods:
    • CompareFloat (value1 As Double, value2 As Double, tolerance As Double, percent As Boolean) As Int
      Compare two float numbers with tolerance.
      Set percent to true and tolerance is used as pecentage value from value1/value2 average.
    • CompareInt (value1 As Int, value2 As Int, tolerance As Int, percent As Boolean) As Int
      Compare two int numbers with tolerance.
      Set percent to true and tolerance is used as pecentage value from value1/value2 average.
    • ConstrainFloat (value As Double, valueMin As Double, valueMax As Double) As Double
      Check the min and max value of a float number and correct if needed.
    • ConstrainInt (value As Int, valueMin As Int, valueMax As Int) As Int
      Check the min and max value of a int number and correct if needed.
    • EqualsFloat (value1 As Double, value2 As Double, tolerance As Double, percent As Boolean) As Boolean
      Check if two float numbers are equal with tolerance.
      Set percent to true and tolerance is used as pecentage value from value1/value2 average.
    • EqualsInt (value1 As Int, value2 As Int, tolerance As Int, percent As Boolean) As Boolean
      Check if two int numbers are equal with tolerance.
      Set percent to true and tolerance is used as pecentage value from value1/value2 average.
    • GetAngleFromXY (x As Double, y As Double, deg As Boolean) As Double
      Get the angle from X,Y coordinates.
      Set deg to true to return the angle in degree.
    • GetRadiusFromXY (x As Double, y As Double) As Double
      Get the radius from X,Y coordinates.
    • GetXfromRadiusAngle (radius As Double, angle As Double, deg As Boolean) As Double
      Get X from radius and angle.
      Set deg to true to interpret the angle in degree.
    • GetYfromRadiusAngle (radius As Double, angle As Double, deg As Boolean) As Double
      Get Y from radius and angle.
      Set deg to true to interpret the angle in degree.
    • MapFloat (value As Double, inMin As Double, inMax As Double, outMin As Double, outMax As Double) As Double
      Map a float number from first min/max range to second min/max range.
    • MapInt (value As Int, inMin As Int, inMax As Int, outMin As Int, outMax As Int) As Int
      Map a int number from first min/max range to second min/max range.
    • RoundTo (value As Double, digits As Int) As Double
      Rounds a number.
  • MF_String
    Methods:
    • Append (str As String, appendStr As String, delimiter As String) As String
      Append string on another string with delimiter. If the first string is empty, no delimiter is used.
    • Base64Decode (str As String) As String
      Create base 64 string from string.
    • Base64Encode (str As String) As String
      Create base 64 string from string.
    • BestLevenshtein (word As String, wordList As List, threshold As Double, ignoreCase As Boolean) As List
      Compare the levenshtein distance between a word and all entries in a wordlist.
      All entries with a score >= threshold (between 0.0 and 1.0) are part of the result list.
      Set ignoreCase to true to ignore case sensitivity on compare.
    • CRC32 (str As String) As Long
      Create CRC32 checksum from string.
    • CRC32Hex (str As String) As String
      Create CRC32 checksum from string.
    • Compare (str As String, pattern As String, ignoreCase As Boolean, extendedCompare As Boolean) As Boolean
      Compares string with pattern, the pattern can use wildcard characters (*, ?).
      Set ignoreCase to true to ignore case sensitivity on compare.
      If extendedCompare ist true the pattern can also contains the wildcard + and character ranges ([a,b,c] or [a-z]).
      Wildcard + is same as * but at least one character must exist (* accepts empty strings).
    • CompareLogical (str1 As String, str2 As String, ignoreCase As Boolean) As Int
      Compares two strings in logical order.
    • ContainsNumber (str As String) As Boolean
      Check if a string contains numeric digit.
    • Key (str As String) As String
      Get the key from a string with format key=value.
    • Key2 (str As String, delimiter As String) As String
      Get the key from a string with format key delimiter value.
    • Key3 (str As String, delimiter As String, quotas As String) As String
      Get the key from a string with format key delimiter value and respect of quotas.
    • Left (str As String, num As Int) As String
      Get the left num chars of the given string.
    • LevenshteinDistance (src As String, dest As String, ignoreCase As Boolean) As Int
      Calculate the levenshtein distance between two strings.
      Set ignoreCase to true to ignore case sensitivity on calc.
    • Mid (str As String, pos As Int, num As Int) As String
      Get num chars from the given string starting at pos.
    • Reverse (str As String) As String
      Reverse the given string.
    • Right (str As String, num As Int) As String
      Get the right num chars of the given string.
    • SetLength (str As String, len As Int, rightAdjust As Boolean, fill As Char) As String
      Set the length of the given string. The empty space is filled with the fill char.
      If rightAdjust is True, the source string is right adjusted in the target string.
    • SizeToStr (size As Long, round As Boolean) As String
      Converts the given number to string and formats it as size value (KB, MB, GB, ...).
    • StringOfChar (ch As Char, len As Int) As String
      Returns a string of length len, filled with given char.
    • TokenList (str As String, delim As String, repeater As Boolean, ignoreFirst As Boolean, ignoreLast As Boolean) As List
      Split a string at given delimiters.
      If repeater is true then following delimiters will inspected as one delimiter.
      If ignoreFirst is True then a empty string before the first delimiter will be ignored.
      If ignoreLast is True then a empty string after the last delimiter will be ignored.
    • TokenList2 (str As String, delim As String, startQuotas As String, endQuotas As String, repeater As Boolean, ignoreFirst As Boolean, ignoreLast As Boolean, includeQuotas As Boolean) As List
      Split a string at given delimiters.
      If startQuotas and endQuotas are not empty, delimiters between quotas will be ignored.
      If repeater is true then following delimiters will inspected as one delimiter.
      If ignoreFirst is True then a empty string before the first delimiter will be ignored.
      If ignoreLast is True then a empty string after the last delimiter will be ignored.
      If includeQuotas is true then available quotas will included in the result.
    • TokenListList (lst As List, delim As String, repeater As Boolean, ignoreFirst As Boolean, ignoreLast As Boolean) As List
      Split a list of strings at given delimiters.
      If repeater is true then following delimiters will inspected as one delimiter.
      If ignoreFirst is True then a empty string before the first delimiter will be ignored.
      If ignoreLast is True then a empty string after the last delimiter will be ignored.
    • TokenListList2 (lst As List, delim As String, startQuotas As String, endQuotas As String, repeater As Boolean, ignoreFirst As Boolean, ignoreLast As Boolean, includeQuotas As Boolean) As List
      Split a list of strings at given delimiters.
      If startQuotas and endQuotas are not empty, delimiters between quotas will be ignored.
      If repeater is true then following delimiters will inspected as one delimiter.
      If ignoreFirst is True then a empty string before the first delimiter will be ignored.
      If ignoreLast is True then a empty string after the last delimiter will be ignored.
      If includeQuotas is true then available quotas will included in the result.
    • Translate (string As String, string2 As String, string3 As String, c As Char, bl As Boolean) As String
    • Trim (string As String) As String
    • TrimLeft (string As String) As String
    • TrimRight (string As String) As String
    • Value (string As String) As String
    • Value2 (string As String, string2 As String) As String
    • Value3 (string As String, string2 As String, string3 As String) As String
 
Last edited:

MaFu

Well-Known Member
Licensed User
Longtime User
image library (MFImage.jar)
  • MFColorMatrix
    Methods:
    • Append (matrixType As Int)
      Appends another color matrix to current matrix list.
    • Append2 (matrixType As Int, value As Float)
      Appends another color matrix with parameter to current matrix list.
    • Assign (bmp As Bitmap) As Bitmap
      Assigns color matrix list to bitmap.
    • Count As Int
    • ID (idx As Int) As Int
      Get id of color matrix with index "idx".
    • Initialize
    • Initialize2 (matrixType As Int)
      Initialize class and select color matrix. Can be repeatedly used to reset the matrix.
    • Initialize3 (matrixType As Int, value As Float)
      Initialize class and select color matrix with parameter. Can be repeatedly used to reset the matrix.
    • IsInitialized As Boolean
    • Name (idx As Int) As String
      Get name of color matrix with index "idx".
    • Names As List
  • MFFaceDetect
    Methods:
    • Confidence (idx As Int) As Float
      Returns the confidence factor between 0 and 1 from the face with index "idx".
    • Detect (bmp As Bitmap) As Int
      Detect faces in given bitmap. Bitmap type must be RGB_565.
      Returns number of faces found.
    • EyesDistance (idx As Int) As Float
      Returns the distance between the eyes from the face with index "idx".
    • FaceRect (idx As Int) As Rect
      Returns a rectangle with the face's position from the face with index "idx".
    • Initialize (width As Int, height As Int, numFaces As Int)
      Initialize class. Can be repeatedly used to reset the matrix.
    • IsInitialized As Boolean
    • MidPoint (idx As Int) As PointF
      Sets the position of the mid-point between the eyes for the face with index "idx".
    • NumberOfFaces As Int
      Returns number of faces found.
    • Pose (idx As Int, euler As Int) As Float
      Returns the face's pose from the face with index "idx".
      That is, the rotations around either the X, Y or Z axis (the positions in 3-dimensional Euclidean space).
  • MFMatrix
    Methods:
    • Assign (bmp As Bitmap) As Bitmap
      Assigns matrix to given bitmap and returns the modified bitmap. The original bitmap will not be altered.
    • Assign2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Assigns matrix to given bitmap and puts the result in the output bitmap. The original bitmap will not be altered.
      CAUTION: the size of "bmpOut" must have the correct width and height for the matrix modifications.
      To set "bmpOut" to the correct size, determine the needed width and height with NeededSize().
    • Initialize
      Initialize class. Can be repeatedly used to reset the matrix.
    • Initialize2 (width As Int, height As Int)
      Initialize class. Can be repeatedly used to reset the matrix.
      "width" and "height" should reflect the size of the modifying bitmap. The matrix calculations will be automatically centered.
    • IsInitialized As Boolean
      Check if class is initialized.
    • NeededSize (width As Int, height As Int) As Int[]
      Determines the needed size for the output bitmap of Assign2().
      Use this function if the matrix is initialized with Initialize().
    • NeededSize2 As Int[]
      Determines the needed size for the output bitmap of Assign2().
      Use this function if the matrix is initialized with Initialize2().
    • PostRotate (deg As Float)
      Postconcats the matrix with the specified rotation.
    • PostScale (sx As Float, sy As Float)
      Postconcats the matrix with the specified scale.
    • PostSkew (kx As Float, ky As Float)
      Postconcats the matrix with the specified skew.
    • PostTranslate (dx As Float, dy As Float)
      Postconcats the matrix with the specified translation.
    • PreRotate (deg As Float)
      Preconcats the matrix with the specified rotation.
    • PreScale (sx As Float, sy As Float)
      Preconcats the matrix with the specified scale.
    • PreSkew (kx As Float, ky As Float)
      Preconcats the matrix with the specified skew.
    • PreTranslate (dx As Float, dy As Float)
      Preconcats the matrix with the specified translation.
    • Reset
    • SetRotate (deg As Float)
      Set the matrix to rotate by the specified number of degrees.
    • SetScale (sx As Float, sy As Float)
      Set the matrix to scale by sx and sy.
    • SetSkew (kx As Float, ky As Float)
      Set the matrix to skew by sx and sy.
    • SetTranslate (dx As Float, dy As Float)
      Set the matrix to translate by (dx, dy).
    • SetValues (values() As Float)
      Copy 9 values from the array into the matrix.
    Properties:
    • Background As Int
    • Filter As Boolean
  • MF_Image
    Methods:
    • ARGB2HSV (argb As Int) As Float[]
      Converts a ARGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
    • ARGB2HSV2 (argb() As Int) As Float[]
      Converts a ARGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
      The int array must have 4 elements.
    • ARGBdecode (argb As Int) As Int[]
      Get the single A, R, G, B values from the given ARGB value as int array with 4 elements.
    • ARGBencode (argb() As Int) As Int
      Create a ARGB value from the given int array.
      The int array must have 4 elements.
    • ARGBencode2 (a As Int, r As Int, g As Int, b As Int) As Int
      Create a ARGB value from the given a, r, g, b values.
    • ARGBtoHSV (argb As Int) As Float[]
      Converts a ARGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
    • ARGBtoHSV2 (argb() As Int) As Float[]
      Converts a ARGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
      The int array must have 4 elements.
    • Alpha (argb As Int) As Int
      Extract the alpha value from the given ARGB value.
    • ApplyMatrix (bmp As Bitmap, mx() As Float, filter As Boolean) As Bitmap
      Applies a matrix to the given bitmap.
      "scalex" and "scaley" defines the x and y scale factor.
      "filter" defines if the bitmap should be filtered.
    • BitmapCreate (width As Int, height As Int) As Bitmap
      Creates new mutable ARGB_8888 bitmap with given dimensions.
    • BitmapCreate2 (width As Int, height As Int, alpha As Int) As Bitmap
      Creates new mutable ARGB_8888 bitmap with given dimensions and fills alpha channel with "alpha".
    • BitmapCreate565 (width As Int, height As Int) As Bitmap
      Creates new mutable RGB_565 bitmap with given dimensions.
    • BitmapToHSV (bmp As Bitmap) As List
      Converts the given bitmap to HSV arrays.
    • BitmapToString (bmp As Bitmap, quality As Int) As String
      Converts a bitmap to base64 encoded string.
      If "quality" (possible value: 1 - 100) is 100, the bitmap will be compressed to png otherwise to jpg.
    • BitmapToString2 (dir As String, fileName As String) As String
      Converts a image file (jpg or png) to base64 encoded string.
      The file will be converted in its own format without recompression.
    • BitmapToString3 (dir As String, fileName As String, quality As Int) As String
      Converts a image file (jpg or png) to base64 encoded string.
      If "quality" (possible value: 1 - 100) is 100, the bitmap will be compressed to png otherwise to jpg.
    • BlackAndWhite (bmp As Bitmap) As Boolean
      Converts the given bitmap to black and white.
    • BlackAndWhite2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Converts the given bitmap to black and white.
    • BlackAndWhite3 (bmp As Bitmap) As Bitmap
      Converts the given bitmap to black and white.
    • Blue (argb As Int) As Int
      Extract the blue value from the given ARGB value.
    • Blur (bmp As Bitmap) As Boolean
      Applies blur filter on the given bitmap.
    • Blur2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Applies blur filter on the given bitmap.
    • Blur3 (bmp As Bitmap) As Bitmap
      Applies blur filter on the given bitmap.
    • ColorAnalogous (argb As Int, angle As Float) As Int[]
      Takes the given color and creates a list of three analogous colors.
      Analogous color schemes use colors that are next to each other on the color wheel. They usually match well and create serene and comfortable designs.
      Analogous color schemes are often found in nature and are harmonious and pleasing to the eye.
      Make sure you have enough contrast when choosing an analogous color scheme.
      Choose one color to dominate, a second to support. The third color is used (along with black, white or gray) as an accent.
      Element 0 of the returned list is the given color, element 1 the color left from the given color and element 2 the color to the right.
      "angle" can be a value between >0 and 45.
    • ColorComplementary (argb As Int) As Int
      Takes the given color and creates the complementary color.
      The high contrast of complementary colors creates a vibrant look especially when used at full saturation. This color scheme must be managed well so it is not jarring.
      Complementary colors are tricky to use in large doses, but work well when you want something to stand out.
      Complementary colors are really bad for text.
    • ColorComplementaryTriad (argb As Int, right As Boolean) As Int[]
      Takes the given color and creates a list of three complementary triad colors.
      A triadic color scheme uses colors that are evenly spaced around the color wheel.
      A complementary triad color scheme is a variation of a simple triad color scheme.
      Element 0 of the returned list is the given color, element 1 the complementary color from the given color and element 2 the color 90 degree right or left from the complementary color.
    • ColorModifiedTriad (argb As Int, angle As Float) As Int[]
      Takes the given color and creates a list of three modified triad colors.
      A triadic color scheme uses colors that are evenly spaced around the color wheel.
      A modified triad color scheme is a variation of a simple triad color scheme.
      Element 0 of the returned list is the given color, element 1 and 2 the colors right (+angle) or left (-angle) from the given color.
      "angle" can be a value between -45 and +45.
    • ColorNearComplementary (argb As Int, angle As Float) As Int
      Takes the given color and creates the complementary color with a twist.
      The high contrast of complementary colors creates a vibrant look especially when used at full saturation. This color scheme must be managed well so it is not jarring.
      Complementary colors are tricky to use in large doses, but work well when you want something to stand out.
      Complementary colors are really bad for text.
      The returning color is the color right (+angle) or left (-angle) from the complementary color.
      "angle" can be a value between -45 and +45.
    • ColorSplitComplementary (argb As Int, angle As Float) As Int[]
      Takes the given color and creates a list of three split complementary colors.
      The split-complementary color scheme is a variation of the complementary color scheme. In addition to the base color, it uses the two colors adjacent to its complement.
      This color scheme has the same strong visual contrast as the complementary color scheme, but has less tension.
      The split-complimentary color scheme is often a good choice for beginners, because it is difficult to mess up.
      Element 0 of the returned list is the given color, element 1 the color left (-angle) from the complementary color and element 2 the color right (+angle) from the complementary color.
      "angle" can be a value between >0 and 45.
    • ColorSwap (bmp As Bitmap, swapMode As Int) As Boolean
      Swaps color channels of the given bitmap.
    • ColorSwap2 (bmpIn As Bitmap, bmpOut As Bitmap, swapMode As Int) As Boolean
      Swaps color channels of the given bitmap.
    • ColorSwap3 (bmp As Bitmap, swapMode As Int) As Bitmap
      Swaps color channels of the given bitmap.
    • ColorTriad (argb As Int) As Int[]
      Takes the given color and creates a list of three triad colors.
      A triadic color scheme uses colors that are evenly spaced around the color wheel.
      Triadic color harmonies tend to be quite vibrant, even if you use pale or unsaturated versions of your hues.
      To use a triadic harmony successfully, the colors should be carefully balanced - let one color dominate and use the two others for accent.
      Element 0 of the returned list is the given color, element 1 the color +120 degree from the given color and element 2 the color +240 degree.
    • Convolve (bmp As Bitmap, matrix() As Int, factor As Int, offset As Int) As Boolean
      Applies an 3x3 convolution filter on the given bitmap.
      "matrix" is the 3x3 convolution matrix as integer array.
      [1][2][3]
      [4][5][6] = (1, 2, 3, 4, 5, 6, 7, 8, 9)
      [7][8][9]
      The sum of all values in the matrix should be 1, otherwise the brightness will change.
      Set "factor" to sum for correction or use 1 if correction factor is not needed.
      "offset" will be added to the calculated result, typically it should be 0.
    • Convolve2 (bmpIn As Bitmap, bmpOut As Bitmap, matrix() As Int, factor As Int, offset As Int) As Boolean
      Applies an 3x3 convolution filter on the given bitmap.
      "matrix" is the 3x3 convolution matrix as integer array.
      [1][2][3]
      [4][5][6] = (1, 2, 3, 4, 5, 6, 7, 8, 9)
      [7][8][9]
      The sum of all values in the matrix should be 1, otherwise the brightness will change.
      Set "factor" to sum for correction or use 1 if correction factor is not needed.
      "offset" will be added to the calculated result, typically it should be 0.
    • Convolve3 (bmp As Bitmap, matrix() As Int, factor As Int, offset As Int) As Bitmap
      Applies an 3x3 convolution filter on the given bitmap.
      "matrix" is the 3x3 convolution matrix as integer array.
      [1][2][3]
      [4][5][6] = (1, 2, 3, 4, 5, 6, 7, 8, 9)
      [7][8][9]
      The sum of all values in the matrix should be 1, otherwise the brightness will change.
      Set "factor" to sum for correction or use 1 if correction factor is not needed.
      "offset" will be added to the calculated result, typically it should be 0.
    • Copyright As String
      Returns the MFImage copyright string.
    • CreateMaskedBitmap (bmp As Bitmap, mask As Bitmap) As Bitmap
      Creates a bitmap with alpha channel. The bitmap data comes from "bmp", the alpha data from "mask" (red channel).
      Both images must be 24 bit bitmaps with identical width and height.
    • Crop (bmp As Bitmap, x As Int, y As Int, width As Int, height As Int, isMutable As Boolean) As Bitmap
      Crop the given bitmap.
      "x" and "y" defines the top left startpoint of the crop area.
      "width" and "height" defines the size of the crop area.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Crop2 (bmp As Bitmap, x1 As Int, y1 As Int, x2 As Int, y2 As Int, isMutable As Boolean) As Bitmap
      Crop the given bitmap.
      "x1" and "y1" defines the top left startpoint of the crop area.
      "x2" and "y2" defines the bottom right endpoint of the crop area.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Edge (bmp As Bitmap, soft As Boolean) As Boolean
      Applies edge filter on the given bitmap. The resulting image is almost black and white.
      If parameter "soft" is True then only distinctive edges are found.
    • Edge2 (bmpIn As Bitmap, bmpOut As Bitmap, soft As Boolean) As Boolean
      Applies edge filter on the given bitmap. The resulting image is almost black and white.
      If parameter "soft" is True then only distinctive edges are found.
    • Edge3 (bmp As Bitmap, soft As Boolean) As Bitmap
      Applies edge filter on the given bitmap. The resulting image is almost black and white.
      If parameter "soft" is True then only distinctive edges are found.
    • EffectBrightness (bmp As Bitmap, value As Float) As Bitmap
      Change brightness from given bitmap.
      meaningful values for "value": -1.0..1.0 (on 0.0 brightness will not changed)
    • EffectContrast (bmp As Bitmap, value As Float) As Bitmap
      Change contrast from given bitmap.
      meaningful values for "value": -1.0..1.0 (on 0.0 contrast will not changed)
    • EffectHue (bmp As Bitmap, value As Float) As Bitmap
      Change hue from given bitmap.
      meaningful values for "value": >0.0..<360.0 (on 0.0 hue will not changed)
    • EffectPolaroid (bmp As Bitmap) As Bitmap
      Assign polaroid effect to given bitmap.
    • EffectSaturation (bmp As Bitmap, value As Float) As Bitmap
      Change hue, saturation and value from given bitmap.
      meaningful values for "value": -1.0..1.0 (on 0.0 saturation will not changed)
    • Emboss (bmp As Bitmap) As Boolean
      Applies emboss filter on the given bitmap. The resulting image is almost grayscale.
    • Emboss2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Applies emboss filter on the given bitmap. The resulting image is almost grayscale.
    • Emboss3 (bmp As Bitmap) As Bitmap
      Applies emboss filter on the given bitmap. The resulting image is almost grayscale.
    • Engrave (bmp As Bitmap, color As Boolean) As Boolean
      Applies engrave filter on the given bitmap.
      If parameter "color" is True then the resulting image is colorful, otherwise it is almost grayscale.
    • Engrave2 (bmpIn As Bitmap, bmpOut As Bitmap, color As Boolean) As Boolean
      Applies engrave filter on the given bitmap.
      If parameter "color" is True then the resulting image is colorful, otherwise it is almost grayscale.
    • Engrave3 (bmp As Bitmap, color As Boolean) As Bitmap
      Applies engrave filter on the given bitmap.
      If parameter "color" is True then the resulting image is colorful, otherwise it is almost grayscale.
    • Fill (bmp As Bitmap, col As Int) As Boolean
      Fills bitmap with given color.
    • FillAlpha (bmp As Bitmap, alpha As Int) As Boolean
      Fills bitmap alpha channel with given value.
    • FillColor (bmp As Bitmap, col As Int) As Boolean
      Fills bitmap with given color but retain alpha channel.
    • GetDensity (bmp As Bitmap) As Int
      Returns the density of the given bitmap.
    • Grayscale (bmp As Bitmap) As Boolean
      Converts the given bitmap to grayscale.
    • Grayscale2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Converts the given bitmap to grayscale.
    • Grayscale3 (bmp As Bitmap) As Bitmap
      Converts the given bitmap to grayscale.
    • Green (argb As Int) As Int
      Extract the green value from the given ARGB value.
    • HSV (bmp As Bitmap, hue As Float, sat As Float, val As Float) As Bitmap
      Change hue, saturation and value of the given bitmap.
    • HSV2 (bmpIn As Bitmap, bmpOut As Bitmap, hue As Float, sat As Float, val As Float) As Boolean
      Change hue, saturation and value of the given bitmap.
    • HSVtoARGB (hsv() As Float) As Int
      Converts a HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1) value to ARGB at which alpha assumed as 255.
    • HSVtoARGB2 (a As Int, hsv() As Float) As Int
      Converts a HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1) value to ARGB with givel alpha.
      ...

Part 2 (too long for one post)
 
Last edited:

MaFu

Well-Known Member
Licensed User
Longtime User
MathParser library (MFParser.jar)
  • MF_MathParser
    Events:
    • Calc (name As String, values() As Double))
    Methods:
    • Copyright As String
      Returns the MFParser copyright string.
    • CreateUserFunction (funcName As String, paramCount As Int, eventName As String) As Boolean
      Create user defined function. The function raises an event on call.
      The function name will be forwarded to the event. Therefore you can create a sub for each function or one sub and then select by function name in event.

    • Parse (formula As String) As Double
      Parses the given formula and returns the result.
      Multiple formulas can be used, separated with ";".
      If a formula begins with "variable=", this variable will be set with the result.
      Additionally a variable "result" with the result value of the last formula will be set.

    • VariableClear
      Remove all variables.
    • VariableExist (name As String) As Boolean
      Check if variable exist.
    • VariableGet (name As String) As Double
      Get value from variable.
    • VariableRemove (name As String)
      Remove variable.
    • VariableSet (name As String, value As Double)
      Set variable with value.
    • Version As String
      Returns the MFParser version.
 
Last edited:

MaFu

Well-Known Member
Licensed User
Longtime User
ImageCropper library (MFImageCropper.jar)

MFImageCropper.gif

  • MFImageCropper
    Events:
    • change (userAction As Boolean, left As Int, top As Int, right As Int, bottom As Int)
    Fields:
    • CROPSHAPE_OVAL As Int
      CropShape constant for setting crop shape as oval.
    • CROPSHAPE_RECTANGLE As Int
      CropShape constant for setting crop shape as rectangle.
    • GUIDELINES_OFF As Int
      Guidelines constant for setting guidelines never visible.
    • GUIDELINES_ON As Int
      Guidelines constant for setting guidelines always visible.
    • GUIDELINES_ON_TOUCH As Int
      Guidelines constant for setting guidelines only visible on touch.
    • ROTATE_180 As Int
      Rotate constant for rotate image 180 degree left.
    • ROTATE_90L As Int
      Rotate constant for rotate image 90 degree left.
    • ROTATE_90R As Int
      Rotate constant for rotate image 90 degree right.
    Methods:
    • AddToParent (parent As ViewGroup, left As Int, top As Int, width As Int, height As Int)
      Add the view to parent view.
    • AsView As View
      Returns the view object.
    • BringToFront
      Bring view to front.
    • Copyright As String
      Returns the MFImageCropper copyright string.
    • CroppedImage As Bitmap
      Get the cropped image.
    • CroppedImage2 (reqWidth As Int, reqHeight As Int) As Bitmap
      Get the cropped image.
    • CroppedOvalImage As Bitmap
      Get the cropped oval image.
    • DesignerCreateView (base As PanelWrapper, lbl As LabelWrapper, props As Map)
      Used from designer.
    • IsInitialized As Boolean
      Returns True if view is initialized, otherwise False.
    • RemoveView
      Remove view from parent view.
    • RotateImage (degrees As Int)
      Rotate the image by fixed degrees (ROTATE_90L, ROTATE_90R, ROTATE_180).
      The crop window will be maintain.
    • RotateImageFree (degrees As Int)
      Rotate the image by the given amount of degrees (clockwise, 0-360).
      The crop window will be reset.
    • SendToBack
      Send view to back.
    • SetAspectRatio (aspectRatioX As Int, aspectRatioY As Int)
      Set crop aspect ratio X and Y value.
    • SetBackgroundImage (bmp As Bitmap)
      Set the view background image.
    • SetColorAnimated (duration As Int, fromColor As Int, toColor As Int)
      Change the view color animated.
    • SetLayout (left As Int, top As Int, width As Int, height As Int)
      Set the view layout.
    • SetLayoutAnimated (duration As Int, left As Int, top As Int, width As Int, height As Int)
      Change the view layout animated.
    • SetVisibleAnimated (duration As Int, visible As Boolean)
      Change the view visibility animated.
    • Version As String
      Returns the MFImageCropper version.
    Properties:
    • ActualCropRect As Rect
      Get or set the current image crop values.
    • ActualCropRectNoRotation As Rect [read only]
      Get the current image unrotated crop values.
    • ActualRotationAngle As Int [read only]
      Get the current rotation angle of the image.
    • Background As Drawable
      Get or set the view background.
    • Color As Int [write only]
      Set the view color.
    • CornerColor As Int [write only]
      Define the color of the crop rectangle corners.
    • CropShape As Int [write only]
      Set the crop shape appearance (CROPSHAPE_RECTANGLE, CROPSHAPE_OVAL).
      Default is CROPSHAPE_RECTANGLE.
    • Enabled As Boolean
      Get or set view enabled.
    • FixedAspectRatio As Boolean [write only]
      Set if the crop has a fixed aspect ratio (True) or not (False).
    • Guidelines As Int [write only]
      Set the guidelines visibility (GUIDELINES_OFF, GUIDELINES_ON, GUIDELINES_ON_TOUCH).
      Default is GUIDELINES_ON_TOUCH.
    • Height As Int
      Get or set view height.
    • ImageBitmap As Bitmap
      Get or set the image.
    • ImageResource As Int [write only]
      Set the image from image resource.
    • Left As Int
      Get or set view left position.
    • ShowActive As Boolean [write only]
      Define if the corner markers (the small triangles) should be drawn red on touch (True) or not (False).
      Default is False.
    • Tag As Object
      Get or set the view tag value.
    • Top As Int
      Get or set view top position.
    • Visible As Boolean
      Get or set the view visibility.
    • Width As Int
      Get or set view width.
 
Last edited:

MaFu

Well-Known Member
Licensed User
Longtime User
Joystick/Slider library (MFJoy.jar)

Show example video on Vimeo:
  • MFJoystick
    Events:
    • Joy (value as JoystickPos As , tag as object As )
    • Slide (value as int As , tag as object As )
    • SliderDown (value as int As , tag as object As )
    • SliderMove (value as int As , tag as object As )
    • SliderUp (value as int As , tag as object As )
    Fields:
    • lockXaxis As Boolean
    • lockYaxis As Boolean
    Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • Initialize (Callback As Object, EventName As String) As String
      Initializes the joystick object.
    • SetBackgroundColor (col As Int) As String
      Set joystick background color.
    • SetBorderColor (col As Int) As String
      Set joystick border color.
    • SetBorderWidth (width As Int) As String
      Set joystick border width.
    • SetDeadZone (x As Int, y As Int) As String
      Set joystick dead zone area in percent.
      This is the area in the middle the knob must pass for action.
      Possible values: 0 (no dead zone) - 25
    • SetSliderColor (col As Int) As String
      Set joystick slider color.
    • SetJoystickColor (col As Int) As String
      Set joystick color.
    • SetKnobColor (col As Int) As String
      Set joystick knob color.
    • SetKnobSize (width As Int, height As Int) As String
      Set joystick knob size. Use -1 for autosize.
    • SetMaxValue (x As Int, y As Int) As String
      Set joystick max values for x and y axis.
    • SetRepeat (value As Int) As String
      Set joystick repeat time in milliseconds (0 = repeat off)
    • SetSliderActive (active As Boolean) As String
      Set joystick slider
    • SetSliderSize (width As Int, height As Int) As String
      Set joystick slider size
    Properties:
    • Height As Int
      Get/set joystick height.
    • Left As Int
      Get/set joystick left position.
    • Tag As Object
      Get/set joystick tag value.
    • Top As Int
      Get/set joystick top position.
    • Width As Int
      Get/set joystick width.
  • MFSlider
    Events:
    • Slide (value as int As , tag as object As )
    • SliderDown (value as int As , tag as object As )
    • SliderMove (value as int As , tag as object As )
    • SliderUp (value as int As , tag as object As )
    Fields:
    • STARTPOS_BOTTOMLEFT As Int
    • STARTPOS_CENTER As Int
    • STARTPOS_TOPRIGHT As Int
    Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • Initialize (Callback As Object, EventName As String) As String
      Initializes the slider object.
    • SetBorderColor (col As Int) As String
      Set slider border color.
    • SetBorderWidth (width As Int) As String
      Set slider border width.
    • SetDeadZone (size As Int) As String
      Set slider dead zone area in percent.
      This is the area in the middle the knob must pass for action.
      Possible values: 0 (no dead zone) - 25
    • SetKnobColor (col As Int) As String
      Set slider knob color.
    • SetMaxValue (value As Int) As String
      Set slider max value.
    • SetRepeat (value As Int) As String
      Set slider repeat time in milliseconds (0 = repeat off)
    • SetColor (col As Int) As String
      Set slider color.
    • SetHoldPosition (value As Boolean) As String
      Set slider hold mode.
    • SetKnobVisible (value As Boolean) As String
      Set slider knob visibility (if slider not touched).
    • SetRoundKnob (value As Boolean) As String
      Set slider knob shape (True for round knob, False for rectangular knob).
    • SetStartPos (value As Int) As String
      Set slider start position.
    Properties:
    • Height As Int
      Get/set slider height.
    • Left As Int
      Get/set slider left position.
    • Tag As Object
      Get/set slider tag value.
    • Top As Int
      Get/set slider top position.
    • Width As Int
      Get/set slider width.
 
Last edited:

MaFu

Well-Known Member
Licensed User
Longtime User
Lua library (MFLibLua.jar)
Includes all functions of the base library.
  • MF_Lua
    Events:
    • Invoke (name As String))
    • Print (text As String)
    Fields:
    • Error As String
    • LUA_GCCOLLECT As Int
      Lua garbage collector constant
    • LUA_GCCOUNT As Int
      Lua garbage collector constant
    • LUA_GCCOUNTB As Int
      Lua garbage collector constant
    • LUA_GCGEN As Int
      Lua garbage collector constant
    • LUA_GCINC As Int
      Lua garbage collector constant
    • LUA_GCISRUNNING As Int
      Lua garbage collector constant
    • LUA_GCRESTART As Int
      Lua garbage collector constant
    • LUA_GCSETPAUSE As Int
      Lua garbage collector constant
    • LUA_GCSETSTEPMUL As Int
    • LUA_GCSTEP As Int
      Lua garbage collector constant
    • LUA_GCSTOP As Int
      Lua garbage collector constant
    • LUA_MULTRET As Int
    • LUA_NOREF As Int
    • LUA_OK As Int
    • LUA_OPADD As Int
      Lua arithmetic constant
    • LUA_OPDIV As Int
      Lua arithmetic constant
    • LUA_OPEQ As Int
      Lua compare constant
    • LUA_OPLE As Int
      Lua compare constant
    • LUA_OPLT As Int
      Lua compare constant
    • LUA_OPMOD As Int
      Lua arithmetic constant
    • LUA_OPMUL As Int
      Lua arithmetic constant
    • LUA_OPPOW As Int
      Lua arithmetic constant
    • LUA_OPSUB As Int
      Lua arithmetic constant
    • LUA_OPUNM As Int
      Lua arithmetic constant
    • LUA_REFNIL As Int
      Lua reference constant
    • LUA_REGISTRYINDEX As Int
      Lua registry index constant
    • LUA_RIDX_GLOBALS As Int
    • LUA_RIDX_MAINTHREAD As Int
    • LUA_TBOOLEAN As Int
      Lua type constant
    • LUA_TFUNCTION As Int
      Lua type constant
    • LUA_TLIGHTUSERDATA As Int
      Lua type constant
    • LUA_TNIL As Int
      Lua type constant
    • LUA_TNONE As Int
      Lua type constant
    • LUA_TNUMBER As Int
      Lua type constant
    • LUA_TSTRING As Int
      Lua type constant
    • LUA_TTABLE As Int
      Lua type constant
    • LUA_TTHREAD As Int
      Lua type constant
    • LUA_TUSERDATA As Int
      Lua type constant
    • LUA_VERSION As String
      Lua version constant
    • LUA_YIELD As Int
    Methods:
    • AbsIndex (index As Int) As Int
      Converts the acceptable index 'index' into an absolute index (that is, one that does not depend on the stack top).
    • AddSearchPath (path As String)
      Add a path to the Lua search paths environment.
      If 'path' is '/data/data/progdir/files' then the following two entries will be added:
      '/data/data/progdir/files/?.lua'
      '/data/data/progdir/files/?/init.lua'
    • Arith (op As Int)
      Performs an arithmetic operation over the two values (or one, in the case of negation) at the top of the stack,
      with the value at the top being the second operand, pops these values, and pushes the result of the operation.
      The function follows the semantics of the corresponding Lua operator (that is, it may call metamethods).

      The value of op must be one of the following constants:

      LUA_OPADD: performs addition ( + )
      LUA_OPSUB: performs subtraction ( - )
      LUA_OPMUL: performs multiplication ( * )
      LUA_OPDIV: performs division ( / )
      LUA_OPMOD: performs modulo ( % )
      LUA_OPPOW: performs exponentiation ( ^ )
      LUA_OPUNM: performs mathematical negation ( unary - )
    • Call (argCount As Int, returnCount As Int) As Boolean
      Calls a function.
      To call a function you must use the following protocol: first, the function to be called is pushed onto the stack;
      then, the arguments to the function are pushed in direct order; that is, the first argument is pushed first.
      Finally you call Call; 'argCount' is the number of arguments that you pushed onto the stack.
      All arguments and the function value are popped from the stack when the function is called.
      The function results are pushed onto the stack when the function returns. The number of results is adjusted to 'returnCount',
      unless 'returnCount' is LUA_MULTRET. In this case, all results from the function are pushed.
      Lua takes care that the returned values fit into the stack space. The function results are pushed onto the stack
      in direct order (the first result is pushed first), so that after the call the last result is on the top of the stack.
    • Call2 (args() As Object, returnCount As Int) As Boolean
      Calls a function.
      To call a function you must first push the function to be called onto the stack.
      Finally you call Call2; 'args' is an array with arguments (allowed types: 'Boolean', 'Int', 'Double' or 'String').
      The function value are popped from the stack when the function is called.
      The function results are pushed onto the stack when the function returns. The number of results is adjusted to 'returnCount',
      unless 'returnCount' is LUA_MULTRET. In this case, all results from the function are pushed.
      Lua takes care that the returned values fit into the stack space. The function results are pushed onto the stack
      in direct order (the first result is pushed first), so that after the call the last result is on the top of the stack.
    • CallFunc (func As String, args() As Object, returnCount As Int) As Boolean
      Calls the global function with the name 'func'.
      If 'func' is a script defined function then the script must first called with 'Call()' or 'Call2()', otherwise the function is not defined.
      'args' is an array with arguments (allowed types: 'Boolean', 'Int', 'Double' or 'String').
      The function results are pushed onto the stack when the function returns. The number of results is adjusted to 'returnCount',
      unless 'returnCount' is LUA_MULTRET. In this case, all results from the function are pushed.
      Lua takes care that the returned values fit into the stack space. The function results are pushed onto the stack
      in direct order (the first result is pushed first), so that after the call the last result is on the top of the stack.
    • CheckArg (index As Int, cond As Boolean, msg As String)
      Checks if a condition is true for the specified function argument. If not, the method throws a Lua runtime exception with the specified error message.
    • CheckBoolean2 (index As Int, def As Boolean) As Boolean
      Returns the function argument 'index' as boolean.
      The function uses 'def' as a default value when there is no argument 'index'.
    • CheckByteArray (index As Int) As ByteBuffer
      Checks if the value of the specified function argument is a string or a number. If so, the argument value is returned as a byte array.
      Otherwise, the method throws a Lua runtime exception with a descriptive error message.
    • CheckByteArray2 (index As Int, def As ByteBuffer) As ByteBuffer
      Checks if the value of the specified function argument is a string or a number. If so, the argument value is returned as a byte array.
      Otherwise, the method throws a Lua runtime exception with a descriptive error message.
      The function uses 'def' as a default value when there is no argument 'index'.
    • CheckInteger (index As Int) As Int
      Checks whether the function argument 'index' is a number and returns this number cast to a integer.
    • CheckInteger2 (index As Int, def As Int) As Int
      Checks whether the function argument 'index' is a number and returns this number cast to a integer.
      The function uses 'def' as a default value when there is no argument 'index' or when this argument is nil.
    • CheckNumber (index As Int) As Double
      Checks whether the function argument 'index' is a number and returns this number.
    • CheckNumber2 (index As Int, def As Double) As Double
      Checks whether the function argument 'index' is a number and returns this number.
      The function uses 'def' as a default value when there is no argument 'index' or when this argument is nil.
    • CheckOption (index As Int, options() As String) As Int
      Checks whether the function argument arg is a string and searches for this string in the array lst (which must be NULL-terminated).
      Returns the index in the array where the string was found. Raises an error if the argument is not a string or if the string cannot be found.

      This is a useful function for mapping strings to C enums. (The usual convention in Lua libraries is to use strings instead of numbers to select options.)
    • CheckOption2 (index As Int, options() As String, def As String) As Int
      Checks whether the function argument arg is a string and searches for this string in the array lst (which must be NULL-terminated).
      Returns the index in the array where the string was found. Raises an error if the argument is not a string or if the string cannot be found.
      The function uses 'def' as a default value when there is no argument 'index' or when this argument is nil.

      This is a useful function for mapping strings to C enums. (The usual convention in Lua libraries is to use strings instead of numbers to select options.)
    • CheckString (index As Int) As String
      Checks whether the function argument 'index' is a string and returns this string.
    • CheckString2 (index As Int, def As String) As String
      Checks whether the function argument 'index' is a string and returns this string.
      The function uses 'def' as a default value when there is no argument 'index' or when this argument is nil.
    • CheckType (index As Int, t As Int)
      Checks whether the function argument 'index' has type 't'. See type for the encoding of types for 't'.
    • Close
      Close the Lua interpreter instance.
    • Compare (index1 As Int, index2 As Int, op As Int) As Boolean
      Compares two Lua values. Returns true if the value at index 'index1' satisfies 'op' when compared with the value at index 'index2',
      following the semantics of the corresponding Lua operator (that is, it may call metamethods). Otherwise returns false.
      Also returns false if any of the indices is non valid.

      The value of op must be one of the following constants:

      LUA_OPEQ: compares for equality ( == )
      LUA_OPLT: compares for less than ( < )
      LUA_OPLE: compares for less or equal ( <= )
    • Concat (n As Int)
      Concatenates the 'n' values at the top of the stack, pops them, and leaves the result at the top. If 'n' is 1,
      the result is the single value on the stack (that is, the function does nothing); if 'n' is 0, the result is the empty string.
      Concatenation is performed following the usual semantics of Lua.
    • Copy (fromIndex As Int, toIndex As Int)
      Moves the element at index 'fromIndex' into the valid index 'toIndex' without shifting any element (therefore replacing the value at that position).
    • Copyright As String
      Returns the MFLib copyright string.
    • Dump (index As Int, indent As String) As String
      Dumps the element at index 'index' to string. if 'index' is 0 then the complete stack is dumped.
      'indent' contains the characters for indenting the recursion levels.
    • Equal (index1 As Int, index2 As Int) As Boolean
      Returns true if the two values in indices 'index1' and 'index2' are primitively equal (that is, without calling metamethods). Otherwise returns false.
      Also returns false if any of the indices are non valid.
    • Gc (what As Int, data As Int) As Int
      Controls the garbage collector.

      This function performs several tasks, according to the value of the parameter what:

      LUA_GCSTOP: stops the garbage collector.
      LUA_GCRESTART: restarts the garbage collector.
      LUA_GCCOLLECT: performs a full garbage-collection cycle.
      LUA_GCCOUNT: returns the current amount of memory (in Kbytes) in use by Lua.
      LUA_GCCOUNTB: returns the remainder of dividing the current amount of bytes of memory in use by Lua by 1024.
      LUA_GCSTEP: performs an incremental step of garbage collection. The step "size" is controlled by data (larger values mean more steps) in a non-specified way. If you want to control the step size you must experimentally tune the value of data. The function returns 1 if the step finished a garbage-collection cycle.
      LUA_GCSETPAUSE: sets data as the new value for the pause of the collector. The function returns the previous value of the pause.
      LUA_GCSETSTEPMUL: sets data as the new value for the step multiplier of the collector. The function returns the previous value of the step multiplier.
      LUA_GCISRUNNING: returns a boolean that tells whether the collector is running (i.e., not stopped).
      LUA_GCGEN: changes the collector to generational mode.
      LUA_GCINC: changes the collector to incremental mode. This is the default mode.
    • GetField (index As Int, key As String)
      Pushes onto the stack the value t['key'], where t is the value at the given index. As in Lua, this function may trigger a metamethod for the "index" event.
    • GetGlobal (name As String)
      Pushes onto the stack the value of the global 'name'.
    • GetMetafield (index As Int, key As String) As Boolean
      Pushes onto the stack the field 'key' from the metatable of the object at index 'index'. If the object does not have a metatable, or if the metatable does not have this field, returns false and pushes nothing.
    • GetMetatable (index As Int) As Boolean
      Pushes on the stack the metatable of the value at the specified index. If the value does not have a metatable, the method returns false and nothing is pushed.
    • GetTable (index As Int)
      Pushes onto the stack the value t[k], where t is the value at the given index and k is the value at the top of the stack.

      This function pops the key from the stack (putting the resulting value in its place). As in Lua, this function may trigger
      a metamethod for the 'index' event.
    • GetTop As Int
      Returns the index of the top element in the stack. Because indices start at 1, this result is equal
      to the number of elements in the stack (and so 0 means an empty stack).
    • HasFunction (func As String) As Boolean
      Check if a global function with the name 'func' exists.
      If 'func' is a script defined function then the script must first called with 'Call()' or 'Call2()', otherwise the function is not defined.
    • Initialize
      Initialize the Lua interpreter instance.
    • Insert (index As Int)
      Moves the top element into the given valid index, shifting up the elements above this index to open space.
      This function cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.
    • IsBoolean (index As Int) As Boolean
      Returns true if the value at the given index is a boolean, and false otherwise.
    • IsCFunction (index As Int) As Boolean
      Returns true if the value at the given index is a C function, and false otherwise.
    • IsFunction (index As Int) As Boolean
      Returns true if the value at the given index is a function (either C or Lua), and false otherwise.
    • IsInitialized As Boolean
    • IsNil (index As Int) As Boolean
      Returns true if the value at the given index is nil, and false otherwise.
    • IsNone (index As Int) As Boolean
      Returns true if the given index is not valid, and false otherwise.
    • IsNoneOrNil (index As Int) As Boolean
      Returns true if the given index is not valid or if the value at this index is nil, and false otherwise.
    • IsNumber (index As Int) As Boolean
      Returns true if the value at the given index is a number or a string convertible to a number, and false otherwise.
    • IsString (index As Int) As Boolean
      Returns true if the value at the given index is a string or a number (which is always convertible to a string), and false otherwise.
    • IsTable (index As Int) As Boolean
      Returns true if the value at the given index is a table, and false otherwise.
    • IsThread (index As Int) As Boolean
      Returns true if the value at the given index is a thread, and false otherwise.
    • Len (index As Int)
      Returns the "length" of the value at the given index; it is equivalent to the '#' operator in Lua. The result is pushed on the stack.
    • Length (index As Int) As Int
      Returns the raw "length" of the value at the given index: for strings, this is the string length; for tables, this is the result
      of the length operator ('#') with no metamethods; for userdata, this is the size of the block of memory allocated for the userdata;
      for other values, it is 0.
    • LessThan (index1 As Int, index2 As Int) As Boolean
      Compares two Lua values. Returns true if the value at index 'index1' is less than the value at index 'index2',
      following the semantics of the Lua operator (that is, it may call metamethods). Otherwise returns false.
      Also returns false if any of the indices is non valid.
    • LoadFile (dirName As String, fileName As String, chunkName As String) As Boolean
      Loads a Lua script from file. If there are no errors, load pushes the compiled chunk as a Lua function on top of the stack. Otherwise, it pushes an error message.
      The chunkname argument gives a name to the chunk, which is used for error messages and in debug information.
    • LoadString (script As String, chunkName As String) As Boolean
      Loads a Lua script from string. If there are no errors, load pushes the compiled chunk as a Lua function on top of the stack. Otherwise, it pushes an error message.
      The chunkname argument gives a name to the chunk, which is used for error messages and in debug information.
    • NewTable
      Creates a new empty table and pushes it onto the stack.
    • NewTable2 (arrayCount As Int, recordCount As Int)
      Creates a new empty table and pushes it onto the stack. Parameter 'arrayCount' is a hint for how many elements the table will have as a sequence;
      parameter 'recordCount' is a hint for how many other elements the table will have. Lua may use these hints to preallocate memory for the new table.
      This pre-allocation is useful for performance when you know in advance how many elements the table will have.
    • Next (index As Int) As Boolean
      Pops a key from the stack, and pushes a key-value pair from the table at the given index (the "next" pair after the given key).
      If there are no more elements in the table, then Next returns false (and pushes nothing).

      While traversing a table, do not call ToString directly on a key, unless you know that the key is actually a string.
      Recall that ToString may change the value at the given index; this confuses the next call to Next.
    • Pop (count As Int)
      Pops 'count' elements from the stack.
    • PushBoolean (value As Boolean)
      Pushes a boolean value onto the stack.
    • PushByteArray (value As ByteBuffer)
      Pushes a byte array value as a string value on the stack.
    • PushInteger (value As Int)
      Pushes a integer value onto the stack.
    • PushNil
      Pushes a nil value onto the stack.
    • PushNumber (value As Double)
      Pushes a number value onto the stack.
    • PushString (value As String)
      Pushes a string value onto the stack.
    • PushValue (index As Int)
      Pushes a copy of the element at the given index onto the stack.
    • RawEqual (index1 As Int, index2 As Int) As Boolean
      Returns true if the two values in indices 'index1' and 'index2' are primitively equal (that is, without calling metamethods). Otherwise returns false.
      Also returns false if any of the indices are non valid.
    • RawGet (index As Int)
      Similar to GetTable, but does a raw access (i.e., without metamethods).
    • RawGet2 (index As Int, key As Int)
      Pushes onto the stack the value t['key'], where t is the table at the given index. The access is raw; that is, it does not invoke metamethods.
    • RawLen (index As Int) As Int
      Returns the raw "length" of the value at the given index: for strings, this is the string length; for tables, this is the result
      of the length operator ('#') with no metamethods; for userdata, this is the size of the block of memory allocated for the userdata;
      for other values, it is 0.
    • RawSet (index As Int)
      Similar to SetTable, but does a raw assignment (i.e., without metamethods).
    • RawSet2 (index As Int, key As Int)
      Does the equivalent of t['key'] = v, where t is the table at the given index and v is the value at the top of the stack.
      This function pops the value from the stack. The assignment is raw; that is, it does not invoke metamethods.
    • Ref (index As Int) As Int
      Creates and returns a reference, in the table at index 'index', for the object at the top of the stack (and pops the object).

      A reference is a unique integer key. As long as you do not manually add integer keys into table t, Ref ensures the uniqueness
      of the key it returns. You can retrieve an object referred by reference r by calling RawGet2(t, r).
      Function Unref frees a reference and its associated object.

      If the object at the top of the stack is nil, Ref returns the constant LUA_REFNIL. The constant LUA_NOREF is guaranteed to be
      different from any reference returned by Ref.
    • Register (funcName As String, eventName As String)
      Creates a new global function 'funcName' and assigns the event 'eventName' to it.
    • Register2 (moduleName As String, funcName As String, eventName As String)
      Creates a new module (table) function 'funcName' and assigns the event 'eventName' to it.
      The (global) module 'moduleName' will be created if not exists.
    • RegisterPrint (eventName As String)
      Defines a event for the output of the Lua function print().
    • Remove (n As Int)
    • Replace (index As Int)
      Moves the top element into the given valid index without shifting any element (therefore replacing the value at the given index),
      and then pops the top element.
    • Resume (index As Int, argCount As Int) As Int
      Starts and resumes a coroutine.
      To start a coroutine, you push onto the thread stack the main function plus any arguments; then you call Resume, with 'argCount' being the number of arguments.
      This call returns when the coroutine suspends or finishes its execution. When it returns, the stack contains all values passed to Yield,
      or all values returned by the body function. Resume returns LUA_YIELD if the coroutine yields, LUA_OK if the coroutine finishes its execution without errors,
      or an error code in case of errors.

      In case of errors, the stack is not unwound, so you can use the debug API over it. The error message is on the top of the stack.

      To resume a coroutine, you remove any results from the last Yield, put on its stack only the values to be passed as results from yield, and then call Resume.

      The parameter from represents the coroutine that is resuming. If there is no such coroutine, this parameter can be nil.
    • SetField (index As Int, key As String)
      Does the equivalent to t[k] = v, where t is the value at the given index and v is the value at the top of the stack.

      This function pops the value from the stack. As in Lua, this function may trigger a metamethod for the "newindex" event.
    • SetGlobal (name As String)
      Pops a value from the stack and sets it as the new value of global 'name'.
    • SetMetatable (index As Int)
      Pops a table from the stack and sets it as the new metatable for the value at the given index.
    • SetTable (index As Int)
      Does the equivalent to t[k] = v, where t is the value at the given index, v is the value at the top of the stack, and k is the value just below the top.

      This function pops both the key and the value from the stack. As in Lua, this function may trigger a metamethod for the "newindex" event.
    • SetTop (index As Int)
      Accepts any index, or 0, and sets the stack top to this index. If the new top is larger than the old one,
      then the new elements are filled with nil. If index is 0, then all stack elements are removed.
    • Status (index As Int) As Int
      Returns the status of the thread.
      The status can be 0 (LUA_OK) for a normal thread, an error code if the thread finished the execution of a Resume with an error, or LUA_YIELD if the thread is suspended.

      You can only call functions in threads with status LUA_OK. You can resume threads with status LUA_OK (to start a new coroutine) or LUA_YIELD (to resume a coroutine).
    • TableMove (index As Int, fromIndex As Int, toIndex As Int, count As Int)
      Moves the specified number of sequential elements in a table used as an array from one index to another.
    • TableSize (index As Int) As Int
      Counts the number of entries in a table.
    • ToBoolean (index As Int) As Boolean
      Converts the Lua value at the given index to a boolean value (false or true). Like all tests in Lua, ToBoolean returns true
      for any Lua value different from false and nil; otherwise it returns false.
      (If you want to accept only actual boolean values, use IsBoolean to test the value's type.)
    • ToByteArray (index As Int) As ByteBuffer
      Returns the byte array representation of the value at the specified stack index. The value must be a string or a number.
      If the value is a number, it is in place converted to a string. Otherwise, the method returns nil.
    • ToInteger (index As Int) As Int
      Converts the Lua value at the given index to the signed integral type integer. The Lua value must be a number or a string
      convertible to a number; otherwise, tointeger returns 0.
    • ToNumber (index As Int) As Double
      Converts the Lua value at the given index to the type number. The Lua value must be a number or a string convertible to a number;
      otherwise, tonumber returns 0.
    • ToString (index As Int) As String
      Converts the Lua value at the given index to a string. The Lua value must be a string or a number; otherwise, the function returns nil.
      If the value is a number, then ToString also changes the actual value in the stack to a string.
      (This change confuses Next when ToString is applied to keys during a table traversal.)
    • Type (n As Int) As Int
    • TypeName (index As Int) As String
      Returns the name of the type encoded by the value 'tp', which must be one the values returned by Type.
    • Unref (index As Int, reference As Int)
      Releases reference 'reference' from the table at index 'index' (see Ref). The entry is removed from the table, so that the referred object can be collected.
      The reference 'reference' is also freed to be used again.

      If 'ref' is LUA_NOREF or LUA_REFNIL, Unref does nothing.
    • Version As String
      Returns the MFLib version.
    • Yield (n As Int) As Int
 
Last edited:

MaFu

Well-Known Member
Licensed User
Longtime User
image library (MFImage.jar) part 2

Part 1

  • MF_Image
    Methods:

    • ...
    • Invert (bmp As Bitmap) As Boolean
      Inverts the given bitmap.
    • Invert2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Inverts the given bitmap.
    • Invert3 (bmp As Bitmap) As Bitmap
      Inverts the given bitmap.
    • LoadBitmap (dir As String, fileName As String) As Bitmap
      Loads a image (jpg or png) from file.
    • LoadBitmap2 (dir As String, fileName As String, mutable As Boolean) As Bitmap
      Loads a image (jpg or png) from file.
      If "mutable" is True a mutable bitmap will be returned.
    • LoadBitmapWithOverlay (dir As String, fileName As String, dirOvl As String, fileNameOvl As String, mutable As Boolean) As Bitmap
      Loads a image (jpg or png) from file and combines the image with a overlay file (normally png with transparency).
      The overlay image will be resized if needed.
      If "mutable" is True a mutable bitmap will be returned.
    • LoadMaskedBitmap (dir As String, fileName As String) As Bitmap
      Loads a masked image (jpg) from file.
      The mask file must have the same filename as the bitmap file with additional "_mask".
      If the bitmap filename is "image.jpg" then the mask file must be "image_mask.jpg".
      If no file extension is given then ".jpg" will be automatically added.
    • LoadMaskedBitmap2 (dir As String, fileName As String, maskFileName As String) As Bitmap
      Loads a masked image (jpg) from file.
      If no file extension is given then ".jpg" will be automatically added.
    • Mirror (bmp As Bitmap, mode As Int) As Boolean
      Mirrors the given bitmap.
      "mode" defines the mirroring mode (horizontal or vertical).
    • Mirror2 (bmpIn As Bitmap, bmpOut As Bitmap, mode As Int) As Boolean
      Mirrors the given bitmap.
      "mode" defines the mirroring mode (horizontal or vertical).
    • Posterize (bmp As Bitmap, offset As Int) As Boolean
      Assign posterize effect to given bitmap.
      "offset" (1 - 255) defines the color spreading.
    • Posterize2 (bmpIn As Bitmap, bmpOut As Bitmap, offset As Int) As Boolean
      Assign posterize effect to given bitmap.
      "offset" (1 - 255) defines the color spreading.
    • Posterize3 (bmp As Bitmap, offset As Int) As Bitmap
      Assign posterize effect to given bitmap.
      "offset" (1 - 255) defines the color spreading.
    • QuickBlur (bmp As Bitmap, split As Int) As Boolean
      Applies quick blur filter on the given bitmap.
    • QuickEdge (bmp As Bitmap) As Boolean
      Applies quick edge filter on the given bitmap. The resulting image is almost black and white.
    • QuickEdge2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Applies quick edge filter on the given bitmap. The resulting image is almost black and white.
    • QuickSoft (bmp As Bitmap) As Boolean
      Applies quick soft filter on the given bitmap.
    • RGB2HSV (rgb() As Int) As Float[]
      Converts a RGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
      The int array must have 3 elements.
    • RGB2HSV2 (r As Int, g As Int, b As Int) As Float[]
      Converts a RGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
    • RGBencode (rgb() As Int) As Int
      Create a RGB value from the given int array, the alpha part is set to 255.
      The int array must have 3 elements.
    • RGBencode2 (r As Int, g As Int, b As Int) As Int
      Create a RGB value from the given r, g, b values, the alpha part is set to 255.
    • RGBtoHSV (rgb() As Int) As Float[]
      Converts a RGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
      The int array must have 3 elements.
    • RGBtoHSV2 (r As Int, g As Int, b As Int) As Float[]
      Converts a RGB value to HSV (Hue = 0..360, Saturation = 0..1, Value = 0..1).
    • Red (argb As Int) As Int
      Extract the red value from the given ARGB value.
    • Resize (bmp As Bitmap, width As Int, height As Int, filter As Boolean, isMutable As Boolean) As Bitmap
      Resize the given bitmap.
      "width" and "height" defines the new width and height.
      "filter" defines if the bitmap should be filtered.
      If -1 is given for "width", then the new width is calculated to maintain the bitmap aspect ratio.
      If -1 is given for "height", then the new height is calculated to maintain the bitmap aspect ratio.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Rotate (bmp As Bitmap, angle As Float, filter As Boolean, isMutable As Boolean) As Bitmap
      Rotate the given bitmap.
      "angle" defines the CCW rotation angle (0.0 - 360.0 degree).
      "filter" defines if the bitmap should be filtered.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Rotate2 (bmp As Bitmap, angle As Float, posx As Float, posy As Float, filter As Boolean, isMutable As Boolean) As Bitmap
      Rotate the given bitmap.
      "angle" defines the CCW rotation angle (0.0 - 360.0 degree).
      "posx" and "posy" defines the rotation point.
      "filter" defines if the bitmap should be filtered.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • RotateFixed (bmp As Bitmap, angle As Int) As Bitmap
      Rotate the given bitmap.
      "angle" defines the CCW rotation angle (0, 90, 180 or 270 degree).
    • RotateFixed2 (bmpIn As Bitmap, bmpOut As Bitmap, angle As Int) As Boolean
      Rotate the given bitmap.
      "angle" defines the CCW rotation angle (0, 90, 180 or 270 degree).
    • RotateFixed3 (bmpIn As Bitmap, bmpOut As Bitmap, angle As Int) As Boolean
      Rotate the given bitmap.
      "angle" defines the CCW rotation angle (0, 90, 180 or 270 degree).
    • SaveBitmap (bmp As Bitmap, dir As String, fileName As String, quality As Int) As Boolean
      Saves the given bitmap to image file.
      The compression type will be determined from the file extension, only ".jpg" and ".png" are allowed.
    • Scale (bmp As Bitmap, scalex As Float, scaley As Float, filter As Boolean, isMutable As Boolean) As Bitmap
      Scale the given bitmap.
      "scalex" and "scaley" defines the x and y scale factor.
      "filter" defines if the bitmap should be filtered.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Scale2 (bmp As Bitmap, scalex As Float, scaley As Float, posx As Float, posy As Float, filter As Boolean, isMutable As Boolean) As Bitmap
      Scale the given bitmap.
      "scalex" and "scaley" defines the x and y scale factor.
      "posx" and "posy" defines the scale point.
      "filter" defines if the bitmap should be filtered.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Sepia (bmp As Bitmap, depth As Int) As Boolean
      Converts the given bitmap to sepia toning.
      "depth" (1 - 255) defines the toning depth.
    • Sepia2 (bmpIn As Bitmap, bmpOut As Bitmap, depth As Int) As Boolean
      Converts the given bitmap to sepia toning.
      "depth" (1 - 255) defines the toning depth.
    • Sepia3 (bmp As Bitmap, depth As Int) As Bitmap
      Converts the given bitmap to sepia toning.
      "depth" (1 - 255) defines the toning depth.
    • Sepia4 (bmp As Bitmap) As Bitmap
      Converts the given bitmap to sepia toning.
    • SetDensity (bmp As Bitmap, density As Int)
      Set the density of the given bitmap.
    • SetDisabled (bmp As Bitmap) As Boolean
      Converts the given bitmap to disabled state for buttons (grayscale and doubled alpha).
    • SetDisabled2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Converts the given bitmap to disabled state for buttons (grayscale and doubled alpha).
    • SetDisabled3 (bmp As Bitmap) As Bitmap
      Converts the given bitmap to disabled state for buttons (grayscale and doubled alpha).
    • SetPressed (bmp As Bitmap, backCol As Int, radius As Int) As Boolean
      Converts the given bitmap to pressed state for buttons (adding alpha).
    • SetPressed2 (bmpIn As Bitmap, bmpOut As Bitmap, backCol As Int, radius As Int) As Boolean
      Converts the given bitmap to pressed state for buttons (adding alpha).
    • SetPressed3 (bmp As Bitmap, backCol As Int, radius As Int) As Bitmap
      Converts the given bitmap to pressed state for buttons (adding alpha).
    • Sharpen (bmp As Bitmap) As Boolean
      Applies sharpen filter on the given bitmap.
    • Sharpen2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Applies sharpen filter on the given bitmap.
    • Sharpen3 (bmp As Bitmap) As Bitmap
      Applies sharpen filter on the given bitmap.
    • Skew (bmp As Bitmap, skewx As Float, skewy As Float, filter As Boolean, isMutable As Boolean) As Bitmap
      Skew the given bitmap.
      "skewx" and "skewy" defines the x and y skew factor (-1.0 - +1.0).
      "filter" defines if the bitmap should be filtered.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Skew2 (bmp As Bitmap, skewx As Float, skewy As Float, posx As Float, posy As Float, filter As Boolean, isMutable As Boolean) As Bitmap
      Skew the given bitmap.
      "skewx" and "skewy" defines the x and y skew factor (-1.0 - +1.0).
      "posx" and "posy" defines the skew point.
      "filter" defines if the bitmap should be filtered.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Smooth (bmp As Bitmap) As Boolean
      Applies smooth filter on the given bitmap.
    • Smooth2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Applies smooth filter on the given bitmap.
    • Smooth3 (bmp As Bitmap) As Bitmap
      Applies smooth filter on the given bitmap.
    • Sobel (bmp As Bitmap) As Boolean
      Applies sobel filter on the given bitmap.
    • Sobel2 (bmpIn As Bitmap, bmpOut As Bitmap) As Boolean
      Applies sobel filter on the given bitmap.
    • Sobel3 (bmp As Bitmap) As Bitmap
      Applies sobel filter on the given bitmap.
    • Solarize (bmp As Bitmap, amount As Int) As Boolean
      Assign solarize effect to given bitmap.
    • Solarize2 (bmpIn As Bitmap, bmpOut As Bitmap, amount As Int) As Boolean
      Assign solarize effect to given bitmap.
    • StringToBitmap (str As String) As Bitmap
      Converts a base64 encoded string (jpg or png) to bitmap.
    • StringToBitmap2 (str As String, dir As String, fileName As String) As Boolean
      Converts a base64 encoded string (jpg or png) to image file.
      The file will be created in the corresponding image format, without recompression. The correct file extension (.jpg, .png) is automatically set.
    • StringToBitmap3 (str As String, dir As String, fileName As String, quality As Int) As Boolean
      Converts a base64 encoded string (jpg or png) to image file.
      The compression type will be determined from the file extension, only ".jpg" and ".png" are allowed.
    • Threshold (bmp As Bitmap, offset As Int) As Boolean
      Assign threshold effect to given bitmap.
    • Threshold2 (bmpIn As Bitmap, bmpOut As Bitmap, offset As Int) As Boolean
      Assign threshold effect to given bitmap.
    • Translate (bmp As Bitmap, transx As Float, transy As Float, filter As Boolean, isMutable As Boolean) As Bitmap
      Translate the given bitmap.
      "transx" and "transy" defines the x and y translate factor.
      "filter" defines if the bitmap should be filtered.
      Set "isMutable" to True if the resulting bitmap must be mutable.
    • Version As String
      Returns the MFImage version.
    • YUV2Bitmap (yuv() As Byte, width As Int, height As Int, bmp As Bitmap) As Boolean
      Converts a yuv camera preview image to ARGB_8888 bitmap.
    • YUV2Bitmap565 (yuv() As Byte, width As Int, height As Int, bmp As Bitmap) As Boolean
      Converts a yuv camera preview image to RGB_565 bitmap.
 
Last edited:

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. It seems a very big work. For now I need to capture and access the camera images, as I wrote in my initial messages. Also some filtering could be interesting, but the most of the functions you implemented is not of my interest, for now. For the moment I want to do some experiments mainly on Samsung tablets. In the future, perhaps, I can try to distribute apps based on your lib, but first I must to do some research.
What should I do to get the appropriate version of your lib? Thanks and my compliments.
 

MaFu

Well-Known Member
Licensed User
Longtime User

MaFu

Well-Known Member
Licensed User
Longtime User
Just donated 20,-

Got the following error when Paypal wants to forward me...

View attachment 47024
Dankeschön. Auch zu Dir ist die Mail mit dem Downloadlink unterwegs. Keine Ahnung bez. der 404 Fehlerseite, ich vermute den Fehler bei Paypal.
 

DonManfred

Expert
Licensed User
Longtime User
Dankeschön.
Bitte!

Auch zu Dir ist die Mail mit dem Downloadlink unterwegs.
Danke.
Am meisten interessiert mich die LUA-Lib; ist eigentlich der Hauptgrund meiner Spende :)
Download mache ich später...

Keine Ahnung bez. der 404 Fehlerseite, ich vermute den Fehler bei Paypal.
Ich vermute den in deinen Einstellungen bei Paypal.
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. I have downloaded the library, from your link. I already answered to the mail with which you sent the link, that the Installation doesn't work. It fails saying that folder "Additional libraries" doesn't exist, but even creating it, no result is reached. In the cited mail, I have sent more info. What I suspect is that the installation uses folders with hard coded names, that differ from the names that I have. (The message says B4A/Additional libraries, but "B4A" in my computer is "Basic4Android", and, actually, it is the default name, not my choice). Please check. Thanks.
 

MaFu

Well-Known Member
Licensed User
Longtime User
Hi. I have downloaded the library, from your link. I already answered to the mail with which you sent the link, that the Installation doesn't work. It fails saying that folder "Additional libraries" doesn't exist, but even creating it, no result is reached. In the cited mail, I have sent more info. What I suspect is that the installation uses folders with hard coded names, that differ from the names that I have. (The message says B4A/Additional libraries, but "B4A" in my computer is "Basic4Android", and, actually, it is the default name, not my choice). Please check. Thanks.
Hi Giovanny
I answered today to your mail. Please check, if the path for "Additional libraries" is set in your B4A configuration.
 

johndb

Active Member
Licensed User
Longtime User
Dankeschön. Auch zu Dir ist die Mail mit dem Downloadlink unterwegs. Keine Ahnung bez. der 404 Fehlerseite, ich vermute den Fehler bei Paypal.

I received that same error after donating :(
 
Top