Discussion of article "Visualize this! MQL5 graphics library similar to 'plot' of R language" - page 6

 
Nikolai Semko #:
I actually use multiple canvases ( usually no more than 4 )
There is always a golden mean. One extreme is to paint all statics and all dynamics on one canvas, the other extreme is to paint all objects as separate canvases.
It's important not to forget that if you have two canvases with transparency overlapping each other, the CPU, ( maybe in Win10-11 GPU, but I think still CPU), will mix every pixel of even homogeneous (non-zero transparency) background.
Here we can borrow from JS the practice of caching the canvas or a part of it to improve performance.
As for antialiased circles, I've already published a variant of such a circle, which is ideal (in terms of performance) for circles with radius less than ~5 pixels. I think the function was called iDot(), and was in the 3DStars code. It is very primitive and short (about 10 lines of code). For larger radius circles, it is far from optimal in terms of performance. For larger radii, the high-performance function is already more than 100 lines of code.
Yes, after years of establishing new neural connections in the brain on canvas, I can now make a library on canvas at any level. There would be time and motivation.
The Wu algorithm is considered obsolete.

Couldn't find a search for iDot() or 3DStars to see the code.

I meant to take into account everything under the canvas, including the chart itself (background colour) and the colour of its elements (bars, ask/bid lines, etc).

While moving this canvas with a transparent background with semi-transparent elements drawn on it, all pixels should be drawn correctly.

This is not the case now:


 
Nikolai Semko #:

Artem, these are really not trivial tasks that require new neural connections. For example, in SVG there is such a concept as viewBox. I have already watched a lot of videos about how it works, read a lot of documentation, written a lot of code, and still sometimes I get stumped. I still don't have the necessary neural connections, even though it seemed several times that I had figured it all out.

Well, we still believe in you ;)
 

Forum on trading, automated trading systems and testing trading strategies

Discussion of the article "Visualise it! Graphical library in MQL5 as an analogue of R"

Anatoli Kazharski, 2023.07.31 17:39

...

I meant to take into account everything that is under the canvas, including the chart itself (background colour) and the colour of its elements (bars, ask/bid lines, etc.).

While moving this canvas with a transparent background with semi-transparent elements drawn on it, all pixels should be drawn correctly.

This is not the case now:


Here's an example where one canvas (with a blue circle) is above another canvas (a blue rectangle with a picture) and here too it doesn't take into account what is drawn on the canvas below:


 
Anatoli Kazharski #:

Could not find a search for iDot() or 3DStars to view the code.

I meant to take into account everything under the canvas, including the chart itself (background colour) and the colour of its elements (bars, ask/bid lines, etc.).

While moving this canvas with a transparent background with semi-transparent elements drawn on it, all pixels should be drawn correctly.

This is not the case now:


https://www.mql5.com/ru/forum/227736/page72#comment_25130501

Here too the colours are blended with the background
https://www.mql5.com/ru/forum/451355/page5#comment_48450810
 
Nikolai Semko #:
h ttps://www.mql5.com/ru/forum/227736/page72#comment_25130501

Here too the colours are blended with the background
https://www.mql5.com/ru/forum/451355/page5#comment_48450810

Thank you! Those are very cool examples! So I was wrong.

I haven't looked at the code in detail yet, but why is the transparency not drawn as expected in the default CCanvas?

 
Anatoli Kazharski #:

Thank you! Those are very cool examples! So I was wrong.

I haven't looked at the code in detail yet, but why is the transparency not drawn as expected in the default CCanvas?

There are a lot of things wrong with it.
It seems that they just didn't finish it because the programmer who was working on it was fired. I may be wrong.
 
Nikolai Semko #:
There's a lot that's wrong with it.
The feeling is that they just didn't finish it because the programmer who was in charge of it was fired. I could be wrong.

Nikolay, can you make a list of what and how it is desirable to change in the standard CCanvas? In your opinion. As it is now, and as it should be. And why.

 
Artyom Trishkin #:

Nicholas, can you make a list of what and how it is desirable to change in the standard CCanvas? In your opinion. As it is now, and as it should be. And why.

We need a new class with fewer functions than in CCanvas. It's better to make this class as close as possible to JS canvas, which doesn't have a lot of functions in essence, for ease of learning and adoption, as the whole IT is moving towards web.
but this is ideal.
I could probably write something like this myself, but it would take at least half a year full-time
although personally I don't like everything in JS Canvas, but for standardisation it would be right to implement something like this with small changes to do without string parsing.

ZY but for normal work I need to redo MT5 event model, as it is just awful

Canvas in MT5 is supposed to work twice as fast as JS canvas. But for this (for a non-lagging interface) you need to change a lot of things inside MT5, which Renat will never do.

HTML Canvas Reference
HTML Canvas Reference
  • www.w3schools.com
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
 
Nikolai Semko #:

We need a new class with fewer functions than CCanvas. It's better to make this class as close as possible to JS canvas, which doesn't have many functions in essence, for ease of learning and adoption, as the whole IT is moving towards web.
but this is ideal.
I could probably write something like this myself, but it would take at least half a year full-time
although personally I don't like everything in JS Canvas, but for standardisation it would be right to implement something similar with small changes to do without string parsing.

But for normal work we need to redo MT5 event model, as it is just awful

It is clear that everything is "under the knife", but still the question was a bit different. What it is desirable to change/refine in the existing class...

 
Artyom Trishkin #:

It is clear that everything is "under the knife", but still the question was a bit different. What is it desirable to change/improve in the existing class...

smooth methods to bring them to life. Now I think there are even functions in CCanvas that are undocumented.