B4A Library [Lib] Accelerated surface

This library provides a dedicated drawing surface embedded inside a view, which benefits from the hardware acceleration. With it, you get the speed of OpenGL for 2D without the complexity.
It includes many Canvas methods (with anti-aliasing, matrix and camera) and a few useful methods for Bitmaps and Drawables (AlterColors, Crop, LoadNinePatch, ReduceColors, SetDensity, etc.). You can import the Matrix, Camera, Paint and Path objects from another library (if they are not wrapped).

surface.png

imageviews.jpg


You can use it to make games:

princess_tiles.png

space_enemies.png


It includes a tool (TextFactory) to do nice titles (that you can export to a bitmap):

textfactory.jpg


It supports Porter-Duff modes, color filters and texture blending (the processing time is very fast):

pdmodes.jpg


The archive includes four benchmarks:

Perf.png


Because of my lack of (free) time, don't expect answers from me about this library if you're not one of my donors.

Download the latest version (1.12)
To convert a project from v0.9x to v1.x, read this.

Hints & Tips

This library does not work with Android versions < 2 (Eclair and Froyo may exhibit performance problems, so I recommend only Gingerbread or a newer version for animations with a high FPS).
The hardware acceleration is not enabled with Android versions < 3.
 

Attachments

  • Java source - AcceleratedSurface.zip
    21.3 KB · Views: 780
Last edited:

Informatix

Expert
Licensed User
Longtime User
I don't see a way in the library to draw a bitmap rotated(or with matrix) with a srcRect, to choose which tile from a sprite sheet to draw. Is there a way to do this with this library?
A documentation is provided. Please read it.

  • DrawBitmap (Bmp As Bitmap, SrcRect As Rect, DestRect As Rect)
    Draws the given bitmap.
    SrcRect: The subset of the bitmap that will be drawn. If Null then the complete bitmap will be drawn.
    DestRect: The rectangle that the bitmap will be drawn into.

    AC.SaveState
    AC.RotateCanvasAround(45, PivotX, PivotY)
    AC.DrawBitmap(bmpSmiley, SrcSmiley, DestSmiley)
    AC.RestoreState

 

ricgom

New Member
Licensed User
Longtime User
Hi.
The download link for this library seems to be not working. Has this library been discontinued ?
Thanks.
 
Top