Increasing Canvas speed

Kamac

Active Member
Licensed User
Longtime User
Hi.

I've got problems, since when i changed my technique to Canvas from ImageView, the FPSes dropped pretty much.


All of that is because i have to redraw the whole screen (so i can remove the character to place it on the background again). Maybe i should do it some else way?
 

kickaha

Well-Known Member
Licensed User
Longtime User
Instead of redrawing the whole screen, use ClipPath to limit the redraw region.

Edit to add:

If you have a static background, why not have that as a separate image, and use another canvas to draw your moveable things on.
 
Last edited:
Upvote 0

Widget

Well-Known Member
Licensed User
Longtime User
How can i clean a part of the screen :confused:

I'll look on Erel's example.

Kamac,
What works for me is to put a transparent panel on top of the bitmap and draw on the transparent panel. To clear the part of the drawing, I draw a transparent rectangle on the transparent panel. Or I can also set the transparent panel's color to transparent to clear the entire transparent panel but this is slower.

This is like drawing on a transparency, and then wiping off the drawings. It works well on zoomed images and panned images too.

Widget
 
Upvote 0

Mikie

Member
Licensed User
Longtime User
Kamac,

Are you trying to use b4a to create games?
I am using Corona. Very fast.

Mikie
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I've actually figured this out.

Incredible how fast is it running now. Waaaay faster than with imageviews :eek:

I made it this way:

draw a transparent rect just where the player was to clear him out

draw the background

draw some object

draw the player


:)
What is the point of drawing a transparent rect initially? (BTW...what IS a transparent rect?)
 
Upvote 0
Top