M
M
michadimin2021-12-29 21:20:34
Python
michadimin, 2021-12-29 21:20:34

Can you please explain how this algorithm works?

I needed an algorithm capable of filling with a gradient of any color and any scale.
I found it, but when I try to understand the principle of its operation, I get a mess in my head, even if the algorithm looks very simple.

Here is the code - https://pastebin.com/pdQfV1zZ

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid, 2021-12-29
@bravebug

I would start by listing the help() documentation for each of the functions used:

Surface((width, height), flags=0, depth=0, masks=None) -> Surface
Surface((width, height), flags=0, Surface) -> Surface
pygame object for representing images

line(surface, color, start_pos, end_pos) -> Rect
line(surface, color, start_pos, end_pos, width=1) -> Rect
draw a straight line

smoothscale(surface, size, dest_surface=None) -> Surface
scale a surface to an arbitrary size smoothly

Without understanding what arguments it takes and what each function returns, it is not possible to understand the algorithm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question