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
@Donators
Two libs were corrupted due optimization.
Please download the new version (same link) and install it again.
Sorry for this inconvenience.
 

imbault

Well-Known Member
Licensed User
Longtime User
Hi Mandref,

Is it possible to add in MF_MathParser.Parse a ValType version
ValType(123) return 'N'
ValType("ABC") return 'C'

Something like that, in order to do

if(eq(ValType(x), 'N'), 25*x, 12)

Thanks

Patrick
 

imbault

Well-Known Member
Licensed User
Longtime User
Sorry, i don't understand.
The math parser has only on data type: float
So what's the reason for a ValType function?
Or something like

if(eq(x,"PH"),y*2,y)

it's very limiting working only with numerics...
 

MaFu

Well-Known Member
Licensed User
Longtime User
Limiting? It's a math parser, therefore it can work with numbers only (like any other calculator).
You can extend the parser with user defined functions. But for now the user functions also accepts numeric parameters only.
I think for your need maybe a interpreter is the better choice. Check the Lua example. If you use the Lua interpreter you can do all.
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi Manfred. Perhaps this is not a question for you, but more general. I am trying to use your library for YUV2RGB conversion. Just copying your code in the intellisense tooltip for that function, I see that the camEx.GetPreviewSize doesn't exist. I already seen somebody saying that that function is not available. I am working on Samsung 7'' tablet. How to get the picture dimensions? I did some trials and used the trick of saving a jpeg and seeing its dimensions with a jpeg browser (IrfanView). But, of course this cannot be a way to work. Being unable to use your function, due to the lack of GetPreviewSize, i directly saved the picture as an Yuv file and used again IrfanView to read it. So i got the image, but it has superimposed an unexpected (for me) strange soft grid of blocks of pixels. Also colors are not correct. Clearly the color information is wrong. Have you (or anybody reading) any hint for this problems? Thanks in advance.
 

MaFu

Well-Known Member
Licensed User
Longtime User
The CameraEx class exists in different versions, extended by users. The last version added from me (version 1.26) contains all needed functions (GetPreviewSize, SetPreviewSize, GetSupportedPreviewSize, GetRotation, ...) and can be found in the CameraEx thread. Sadly the most of this addons are not included in the last CameraEx file Erel postet a few days ago.
I attach the 1.26, with this file my camera demo should compile and work without problems.
 

Attachments

  • CameraExClass.bas
    23 KB · Views: 410

LucianDesign

Member
Licensed User
Longtime User
Hello,

There is a bug in the MFImageCropper library.
If the image that is set to be cropped is smaller than the crop view then the crop handles and the dimmed background are not ok.

bug.jpg
 

MaFu

Well-Known Member
Licensed User
Longtime User
Sorry for the delay, i was on vacation for two weeks.
The new version 2.01 is available for download, i've sent a info mail to all donators.

Updates

MFLib/MFLibLua

Added:
  • NMEA parser function (single line only at the moment).

MFImage

Corrected:
  • Convolve2() and QuickConvolve2() may result sometimes in an abnormal program termination.
Added:
  • DitherBW_Burkes()
  • DitherBW_Burkes2()
  • DitherBW_Burkes3()
  • DitherBW_FloydSteinberg()
  • DitherBW_FloydSteinberg2()
  • DitherBW_FloydSteinberg3()
  • DitherBW_Ordered()
  • DitherBW_Ordered2()
  • DitherBW_Ordered3()
  • FillAlphaFromBitmap()
  • Histogram()
  • HistogramRGB()
  • Screenshot()

MFImageCropper

Corrected:
  • wrong display and function if the image size was smaller than the size of the cropper view.
  • using of the Background property results in an "method not found" error.
 

hayderOICO

Member
Licensed User
Longtime User
Hi

Can you tell me a bit more about the function HistogramRGB() ? I'm asking because I want to extract very accurate numerical data (not a chart) for each colour and intensity in an image.

Thanks!
 

MaFu

Well-Known Member
Licensed User
Longtime User
Analogous to the Histogram() function, which returns the luminance histogram, returns HistogramRGB() the histogram for the red/green/blue color channels.

Histogram() returns an array of int with 256 values. The array index corresponds to the luminance value.
Therefore the first array item (with index 0) contains the quantity of all pixels with luminance value 0. The second array item (index 1) contains the quantity of all pixels with luminance value 1, and so on.
HistogramRGB() returns an array of int with 1024 values. The first 256 array entries contains the histogram values for the red channel. The second and third 256 entries for the green and blue channel. The last 256 entries corresponds to the alpha channel.
 

hayderOICO

Member
Licensed User
Longtime User
cheers! just started messing about with it. the filters are super fast and easy! any way to add more filters?
 

hayderOICO

Member
Licensed User
Longtime User
some filters that are in snapseed app... things like "ambience" and maybe being able to combine multiple images into a single "hdr" image... just thinking out loud. is there a way I can add such filters to the existing list?
 
Top