Canvas is cool! - page 66

 
For some tasks, such as scaling the interface, the image resize function can be greatly simplified.
An example of a function to load a resource to a given size.

bool  ImageFromResource(const string _resource,const int _w,const int _h,uint &_pic[])
{
   uint lp[];
   int wr, hr;
   if(_w<2 || _h<2) return(false);
   if(!ResourceReadImage(_resource,lp,wr,hr))
   {
      Print("Еrror loading resource: ",_resource);
      return(false);
   }
   if(_w!=wr || _h!=hr)
   {
      //resize image
      ArrayResize(_pic,_w*_h);
      double sw=(double)_w/wr;
      double sh=(double)_h/hr;
      //
      for(int _y=0; _y<_h; _y++)
         for(int _x=0; _x<_w; _x++)
            _pic[_y*_w+_x]=lp[int(_y/sh)*wr+int(_x/sw)];
   }else ArrayCopy(_pic,lp);
   return(true);
}

Visual comparison of resizing algorithms, with simplified version on the right.


 
fxsaber:

trivial minimisation of such terminals reduces the large CPU load almost to zero. It is unclear why such an irrationally CPU-consuming GUI is needed.

the programmers are to be thanked for this,

for example, the most popular video codec madvr is paused and it eats as if it were mining)

 
fxsaber:

Yes. I don't think developers ever run five Terminals in parallel, where high frequency Market Watch has hundreds of characters each.

It comes out very silly when trivial minimisation of such Terminals reduces a large CPU load to almost nothing. Why such an irrationally CPU-consuming GUI is necessary is unclear.

And you think that the rendering of GUI for 300 times per second is free?

You'll be the first to claim that we draw incorrectly, do not finish drawing or skip drawing.

If we're talking about a desktop, you need a normal fast video card - it will chew up the high rendering rate. Minimizing windows can reduce the load on most applications that draw frequently.


For information, MetaTrader can do 100-300 FPS due to the large flow of quotes per second. Not 1-2 frames per second like regular programs, but actually hundreds of frames per second depending on the quote stream.

 
Renat Fatkhullin:

Do you think that drawing gui 300 times per second is free?

You'll be the first to claim that we're drawing incorrectly, not finishing drawing, or skipping drawing.

If we're talking about a desktop, you need a normal fast video card - it will chew up the high rendering rate. Minimizing windows can reduce the load on most applications that draw frequently.


For information, MetaTrader can do 100-300 FPS due to the large flow of quotes per second. Not 1-2 frames per second like regular programs, but actually hundreds of frames per second depending on the quote stream.

Renat you have tested all the new processors which are now at the level of 10 Intel proces and zen2 faster per core we have running here, right?

As far as I know Intel is no good at multithreading, Amd parallels multithreading well, it's a good idea
 

Canvas - Cool!

How does it help in trading?

 
Renat, while you are here, please write back
 
prostotrader:

Canvas - Cool!

Does it help in the trade?

Yes

 
Yury Kulikov:
For some tasks, such as scaling the interface, the image resize function can be greatly simplified.
An example of a function to load a resource to a given size.

Visual comparison of resizing algorithms, with simplified version on the right.

Well yes, Yuri, I agree. Such super-fast algorithm has a right to life.
But, of course, it has a serious loss of quality. Especially in images, where there are sharp colour transitions.
Here's a script, for example, which demonstrates this clearly. On the right side this fast algorithm, and on the left side mine (about 4-10 times slower).
An example of a normal screenshot reduction:


By the way, I understood why there were such blinks. I was resampling the bitmap on every frame, which was stupid and that was the reason. Now I've removed it and everything runs smoothly.

Files:
Scaling.gif  12254 kb
scaling2.zip  290 kb
 
Fast235:

Renat you have tested all the new processors, which are now at the level of 10 Intel proces and zen2 faster per core we have running here, haven't you?

As far as I know Intel is no good at multithreading, AMD parallels multithreading well, it is a good solution

All modern processors run fast enough.

Especially if you have plenty of memory and NVMe drives for terminal tasks. A mid-range graphics card is highly recommended.

In our company we refuse from intels and have been buying only AMD Epyc for servers and workstations for more than a year now.

 
Renat Fatkhullin:

All modern processors are quite fast. Especially if there is plenty of memory and NVMe disks.

For the terminal, a mid-range graphics card is highly recommended.

In our company we refuse from Intel and for more than a year we buy only AMD Epyc for servers and workstations.

great)