Closed fisker closed 6 years ago
Hi, what style changes do you suggest? Are you sure it would make the code easier to read?
personally i recommend standrand, or just use prettier to format code.
and also i think there is too many private methods on UPNG object. i think just define the function in the closure and use it directly. no need to expose
Do you mean more newlines? The code would be much longer and you will have to scroll more between different parts. It would be harder to get an idea what is going on.
I am used to making every function accessible globally. Actually, I don't use "closures" in my regular code, I just added it here because users asked for it.
if the size of source code is what you worried about, i think we should separate them in to different modules. and use a build tool to compile.
i forked the repo and try to do what i said yesterday. cause there is no test case, i didn't test yet. but you may understand what i want to do.
check this https://github.com/fisker/UPNG.js
tell me what do you think
Hi, I see you have changed the writing style (more newlines, no semicolons etc.) You also added many other files, which I am not familiar with.
I still prefer to maintain this version with my own "writing style". BTW. I have completely remade the quantization process (which makes 30% of the whole library). I will update it here, too, in upcoming weeks.
thank you.
i will keep rewriting the code until i understand how this works.
great job
So what your goal is? What exactly do you want to understand?
no goals, i want understand everything, each function , whole process.
but the variable names seems meanless to me.
so i can't understand what the functions doing
I don't think it is a right way to learn about these things from the source code. I recommend you to read the PNG specification and maybe some articles about vector quantization.
BTW. the new quantization algorithm, that I implemented, is 10x faster than this one :) I also think it produces better results.
for example the methods in UPNG._bin , i do't understand the p
, l
stands for , so i read carefully and change them into meaningful variable names. like this https://github.com/fisker/UPNG.js/commit/f44a0711bfd4d47ac9c98b74b52f05cd86d1a81a
this might take while , but this is what i'm going to do
it's ok, i like reading source code
the source code is really difficult to read, should we change another code style?