B4A Library [B4X] BitmapCreator Effects

Erel

Administrator
Staff member
Licensed User
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.

BitmapCreatorEffects depends on XUI and BitmapCreator libraries.

Note that all of the example code is implemented in a class that is shared between the three projects. This way we can get 99% code reuse.

Updates

Version 1.31 -New FadeBorders effect. See post #9: https://www.b4x.com/android/forum/threads/b4x-bitmapcreator-effects.93608/#post-672188
Version 1.21 - New ReplaceColor method.
Version 1.20 - Added PieceSize to ImplodeAnimated and added FlipVertical and FlipHorizontal methods.
Version 1.10 - Adds TransitionAnimated method to transition between two bitmaps.

The Example class from the B4J project can also be used in the other projects.
Latest version is distributed as a b4xlib library.
 

Attachments

Last edited:

LucaMs

Expert
Licensed 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 :



 
Last edited:

LucaMs

Expert
Licensed 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

Administrator
Staff member
Licensed 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
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

Well-Known Member
Licensed 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
 
Top