I've already demonstrated the flaw in your approach above, and if it matches the palette you're comparing it to, then so does it, using the white line example. Again in other words.
If you change colour smoothly from black (0,0,0) to white (255,255,255) going through a particular colour (r1,g1,b1) then the sum of the three colours R, G and B is the important indicator. It is better to move away from the terminology here, as it can get confusing (brightness, luminosity, tone ....)
It is absolutely obvious that ideally it should change linearly from 0 to 3*255=765. You tweak your colour strictly in the middle, I first calculate the sum of the original colour and paste it into the gradient array according to that RGB sum. That's why my white line has no break point, unlike yours.
Nikolai, while you haven't explained how your algorithm works and you're talking about some white lines that should be like that, but not different...
It's obvious that you yourself don't understand how your algorithm breaks down into shades. You have no coherent concept. Just a confusion of terms and code borrowed from somewhere else...
It's not all ready yet. I admit I underestimated the degree of platform difference. The algorithm on MT5 is flawed in some places. But the problem is only in the code, not the concept.
Nikolai, while you haven't explained how your algorithm works and you're talking about some white lines that should be like that, but not like that...
It's obvious that you yourself don't understand how your algorithm breaks down into shades. You have no coherent concept. Only a confusion of terms and code borrowed from somewhere else...
Peter, what are you talking about? If I didn't understand it, how could I do it. Writing an algorithm in code is much easier than describing it in words. Tell me, do you understand the meaning of this code? After all, everything is so elementary and obvious that I don't even understand what comments can be inserted here.
Peter, what are you talking about. If I didn't understand it, how could I do it. Writing an algorithm in code is much easier than describing it in words. Tell me, do you understand the meaning of this code? After all, everything is so elementary and obvious that I don't even understand what comments can be inserted here.
Here's how your algorithm works, using this function as an example:
#include <Canvas\iCanvas.mqh> //https://www.mql5.com/ru/code/22164union rgb {uint clr; uchar c[4];};
voidOnStart()
{
rgb c,C;
uint CLR[];
color clr=clrViolet;
Gradient(clrWhite, clr, CLR,W.Height/2); // получаем массив градиента от белого цвета до цвета clr for(int y=0; y<W.Height/2; y++) Canvas.LineHorizontal(0,W.Width-1,y,ColorToARGB(CLR[y],240)); // выводим на экран
Gradient(clr, clrBlack, CLR,W.Height-W.Height/2); // получаем массив градиента от цвета clr до черног цвета for(int y=W.Height/2; y<W.Height; y++) Canvas.LineHorizontal(0,W.Width-1,y,ColorToARGB(CLR[y-W.Height/2],240)); // выводим на экран в продолжение предыдущего
Canvas.Update();
Sleep(30000);
}
//+------------------------------------------------------------------+void Gradient(uint clr1,uint clr2,uint &arr[],uint size)
{
if(size==0) return;
ArrayResize(arr,size);
rgb c1,c2;
c1.clr=clr1;
c2.clr=clr2;
double R1=c1.c[2],G1=c1.c[1],B1=c1.c[0];
double R2=c2.c[2],G2=c2.c[1],B2=c2.c[0];
double deltaR=(R2-R1)/(size-1);
double deltaG=(G2-G1)/(size-1);
double deltaB=(B2-B1)/(size-1);
for(uint i=0;i<size;i++)
{
R1+=deltaR; c1.c[2]=uchar (R1+0.4999);
G1+=deltaG; c1.c[1]=uchar (G1+0.4999);
B1+=deltaB; c1.c[0]=uchar (B1+0.4999);
arr[i]=c1.clr;
}
}
Peter, what are you talking about. If I didn't understand it, how could I do it. Writing an algorithm in code is much easier than describing it in words. Tell me, do you understand the meaning of this code? After all, everything is so elementary and obvious that I don't even understand what comments can be inserted here.
State your concept of colour decomposition. If the algorithm is yours, you know it well.
You seem to be convincing yourself of something. Again, there hasn't been time to do a visualisation. Have you checked the algorithm against the palette?
Thanks for the observation. I too have identified a few errors. I will make a mt4 gif now. It works fine, but there are problems on a couple of colours.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Here is the result of my algorithm on MT5. Without any unnecessary and superfluous gimmicks.
And the code?
I've already demonstrated the flaw in your approach above, and if it matches the palette you're comparing it to, then so does it, using the white line example.
Again in other words.
If you change colour smoothly from black (0,0,0) to white (255,255,255) going through a particular colour (r1,g1,b1) then the sum of the three colours R, G and B is the important indicator. It is better to move away from the terminology here, as it can get confusing (brightness, luminosity, tone ....)
It is absolutely obvious that ideally it should change linearly from 0 to 3*255=765. You tweak your colour strictly in the middle, I first calculate the sum of the original colour and paste it into the gradient array according to that RGB sum. That's why my white line has no break point, unlike yours.
Nikolai, while you haven't explained how your algorithm works and you're talking about some white lines that should be like that, but not different...
It's obvious that you yourself don't understand how your algorithm breaks down into shades. You have no coherent concept. Just a confusion of terms and code borrowed from somewhere else...
and the code?
It's not all ready yet. I admit I underestimated the degree of platform difference. The algorithm on MT5 is flawed in some places. But the problem is only in the code, not the concept.
Nikolai, while you haven't explained how your algorithm works and you're talking about some white lines that should be like that, but not like that...
It's obvious that you yourself don't understand how your algorithm breaks down into shades. You have no coherent concept. Only a confusion of terms and code borrowed from somewhere else...
Peter, what are you talking about? If I didn't understand it, how could I do it. Writing an algorithm in code is much easier than describing it in words.
Tell me, do you understand the meaning of this code? After all, everything is so elementary and obvious that I don't even understand what comments can be inserted here.
Peter, what are you talking about. If I didn't understand it, how could I do it. Writing an algorithm in code is much easier than describing it in words.
Tell me, do you understand the meaning of this code? After all, everything is so elementary and obvious that I don't even understand what comments can be inserted here.
Here's how your algorithm works, using this function as an example:
Peter, what are you talking about. If I didn't understand it, how could I do it. Writing an algorithm in code is much easier than describing it in words.
Tell me, do you understand the meaning of this code? After all, everything is so elementary and obvious that I don't even understand what comments can be inserted here.
State your concept of colour decomposition. If the algorithm is yours, you know it well.
You seem to be convincing yourself of something. Again, there hasn't been time to do a visualisation. Have you checked the algorithm against the palette?
The result of your script for colour 207,255,65.
The result of your script for colour 207,255,65.
Thanks for the observation. I too have identified a few errors. I will make a mt4 gif now. It works fine, but there are problems on a couple of colours.
I can't get high quality gifs. Here is the script. Put on MT4 and see everything as it is.
Found the first error. Corrected it.
I should have added :
in each loop.