Drawing 1x1 filled squares

ukimiku

Active Member
Licensed User
Longtime User
I use the following commands to draw a filled square into a bitmap (blockrect is of type rect):
B4X:
blockrect.Initialize(x, y, x+b, y+b)
triange_canvas.DrawRect(blockrect, Colors.Black, True, 1)

This code works as long as b is at least 1. However, if I want to draw squares of size 1x1 (simple dots), b equals 0, and the code produces no visible drawing whatsoever. It seems I cannot draw a filled rectangle of size 1x1 with this code.

How can I draw 1x1 "squares" (plot singular dots)? I would prefer a consistent approach that works for any value of b.

Thank you.

Regards,
 

ukimiku

Active Member
Licensed User
Longtime User
Thank you.

In addition, I found out that I can set the "filled" attribute to false and achieve the same result:
B4X:
triange_canvas.DrawRect(blockrect, Colors.Black, False, 1)

Regards,
 
Upvote 0
Top