B4A Library [B4X] BitmapCreator Effects

BitmapCreatorEffects class includes all kinds of very simple to use image effects.
The class is cross platform and compatible with B4J (v6.3+), B4A (v8.3+) and B4i (v5.0+).
Example:
B4X:
'Greyscale an image:
Dim GreyImage As B4XBitmap = effects.GreyScale(ExistingBmp)
'Blur an image:
Dim BlurImage As B4XBitmap = effects.Blur(ExistingBmp)


The attached examples demonstrate the various methods.


Updates

v1.40 - Adds support for B4XImageViews (XUI Views).
- New ScaleDownImages flag. True by default. The updated example demonstrates the usage. Note that if not using B4XImageView then you should set the image when ScaleDown = False, with XUIViewsUtils.SetBitmapAndFill.
v1.31 -New FadeBorders effect. See post #9: https://www.b4x.com/android/forum/threads/b4x-bitmapcreator-effects.93608/#post-672188
v1.21 - New ReplaceColor method.
v1.20 - Added PieceSize to ImplodeAnimated and added FlipVertical and FlipHorizontal methods.
v1.10 - Adds TransitionAnimated method to transition between two bitmaps.
 

Attachments

  • EffectsExample.zip
    376.6 KB · Views: 1,275
  • B4XBitmapEffects.b4xlib
    3.3 KB · Views: 1,274
Last edited:

LucaMs

Expert
Licensed User
Longtime User
I like especially ImplodeAnimated (and have to watch the code, I can not imagine how it is done :D).
Very complex.

I would change:

B4X:
Public Sub ImplodeAnimated (Duration As Int, PieceSize As Int, Bmp As B4XBitmap, ImageView As B4XView) As ResumableSub
'...
    Dim GroupSize As Int = PieceSize


PieceSize: 30 - 5 - 1 :

30.gif

5.gif

1.gif
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Two very small things (one of them is my fault... as always :p:()

1) BitmapCreatorEffects was updated to v. 1.20 but there is stil this comment:
'Version 1.10

2) the variable GroupSize never changes its value; so you could refine the routine using the parameter directly.
Public Sub ImplodeAnimated (Duration As Int, PieceSize As Int, Bmp As B4XBitmap, ImageView As B4XView) As ResumableSub
'...
Dim GroupSize As Int = PieceSize
(I LOVE F7 + rename :))



[Just two details because I was looking at the code to answer a question submitted by a member]
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
Both options are good in this case.

Why distribute as a class?

1. It was written before b4xlib feature was available.
2. It is a single class which makes it easy to add to your project.
3. It is quite simple to extend it with new features as it is a collection of very specific subs.
 

LucaMs

Expert
Licensed User
Longtime User
1. It was written before b4xlib feature was available.
I know, of course ;)

2. It is a single class which makes it easy to add to your project.
It is much easier to "import" (select) a library; moreover, it is a common bad abitude for many of us... having to search in which project we have used a certain class (that is, not organizing our "tools" well) :D:(

3. It is quite simple to extend it with new features as it is a collection of very specific subs.
You probably don't know it but a b4xlib library contains the source code :D:D:D


The main reason is the first; that's why I wanted to create the library, so you can simply attach it to the first post.
 

AnandGupta

Expert
Licensed User
Longtime User
I learnt something good today. Thanks to LucaMs.

How to make a class into b4xlib. :)

I will study the codes and try same in future.

Regards,

Anand
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Erel / All in first post the B4XBitmapEffects.b4xlib is 1.00
1582038297543.png


Where's is 1.31 ?
Thank you
Marco
 
Top