Android Question bcpath how to use Path.DrawConnectionSegments = False

Syd Wright

Well-Known Member
Licensed User
I want to speed-up the use of bcpath. In the tutorial it is stated:

"It is not obvious in the above image but by default the connection segments between each two lines are also drawn. It can be disabled with:"
B4X:
path.DrawConnectionSegments = False
Ref: https://www.b4x.com/android/forum/threads/b4x-drawing-with-bitmapcreator.98887/#contenthttps://www.b4x.com/android/forum/threads/b4x-drawing-with-bitmapcreator.98887/#content

It is not clear to me where and how to use this, e.g. what is "path"?


Update: I have solved it. I seems I have to call this command immediately after initializing the path (in my case Rhombusses).
Are there any other tricks that can be used to speed up the drawing of (open and filled) polygons?
 
Last edited:

Syd Wright

Well-Known Member
Licensed User
Thank you, I am already doing that, as well as storing polygon nodes directly into brushes in stead of doing it via arrays. I create brushes for every type of road (motorway, highway, secondary road etc.) that I need to draw on the map and then re-use these brushes. Drawing 40 maptiles (each 256x256 pixels) takes about 800 msec for city maps with many buildings and all sorts of roads.
By using path.DrawConnectionSegments=false overall drawing is about 20% faster. I was hoping that there might be some more (somewhat hidden) tricks to improve performance.
 

Syd Wright

Well-Known Member
Licensed User
Try to do this for all brushes:
B4X:
Brush.BlendBorders = False
Thank you. It does improve performancy by about 6%. However, thin lines become visible where roads make bends and there are small gaps in the road edges. Also, path.DrawConnectionSegments = False has some detrimental effects on how the roads are drawn on the map (broken edges and missing parts of sharp road corners).
It's a matter of compromise between speed and esthetic looking maps.
 

Erel

Administrator
Staff member
Licensed User
It's a matter of compromise between speed and esthetic looking maps.
That's true.

Another possible compromise is between better performance and lower complexity.

BitmapCreator can draw asynchronously. This way the drawing time will not affect the app responsiveness.
You can see an example in AnotherProgressBar from XUI Views (search for bc.DrawBitmapCreatorsAsync). Note that it must be implemented in a class.
 
Top