#1 gradient merge of code
Robin wrote:While looking at the gradient code, I saw that the horizontal and vertical gradient functions are nearly identical. Wouldn't it be better (i.e.: easier to debug and upgrade) to put it in one function. I uploaded a file to demonstrate it.
good idea but the code got a little complex for my little brain ... and broke some gradients hehehe, so we will keep the linewith=2 and keep separate for now
#2 gradient fill for the stars
also fixed the way the gradient were working for the stars, internally a matrix o points is created, so the gradient knows where each line starts and ends, but in the case of the stars ... we have some little problems like the following example
100000001000001000001
that could be understood as 2 blocks on the left and right ... or a tiny point on the left a block in the middle anda point at the right, as we had only zeros and 1 there were no identification of the outside of the polygon, so I add the "2" to the matrix that is the outside of the polygon by making fill with 2 until find "1" from the 4 directions of the bounding box of the polygon. doing like this the sample become this
122222221000001222221
and indicates the external and internal points.
#solid color fill of stars
oh well the stars were just with some sort of headache, so I just split in smaller chunks to make the filled polygon drawer life easier hehehe, cut the triangles, and the inner polygon, worked very fine !!
here is the current version and a screenshot

- lovelyeyes stars gradient.png (51.4 KiB) Viewed 3839 times
Nothing is simple but everything is possible.