Canvas is cool! - page 43

 
khorosh:

Why would you do that, you wrote that you didn't need a schedule at all).

For beauty.
 
Реter Konow:

Thank you. It's not a brute force .bmp frame compressed with the #resource command, is it? ))) Definitely not. It's a natural adapter for playing back a gif-file on MQL-canvas, based on a ported .gif-reader, which was written in a couple of hours. I must look like an idiot from the outside)))

Yuri, thanks for the demo, but anyone can do such a thing. Easy.

  1. Take a simple gif. Record it on video.
  2. Get all its frames from video.
  3. Save frames in .bmp format, numbered.

  4. Integrate frames to the script via #resource.

  5. Loop through the frames and display them one by one on canvas in endless loop.

As a result, we get a pseudo-gif that has no relation to standard gif-format representation in MQL-programs.

//-----------------------------

Added:

I will say that I also have a "pseudo-gif", but the technology is much more complex. It has author compression and a playback mechanism. And most importantly, the "pseudo-gifs" are bound to their elements and are reproduced from a common array. The compression works better than via the #resource directive because unchanging colours are not recorded from frame to frame.


What kind of video editor can't open animated gifs? Photoshop opens them and puts frames into layers. But there is an even easier solution - online service - upload animated gifs there, in a minute you get a zipped folder with the individual frames.

 
What's the point of arguing about whether the solution is a ported one or not? The format is standard, so the way of working with it should be standard and, by the way, developed at the same time as the development of the format itself.
 
Files:
puh.ex5  29 kb
 
Yury Kulikov:

 

Greetings.

Does anyone happen to know why you can't draw a line of 2 pixels? What kind of discrimination is this? )

void CCanvas::PolylineThick(const int &x[],const int &y[],const uint clr,const int size,const uint style,ENUM_LINE_END end_style)
  {
   if(size<=2)
     {
      if(size>0)
         PolylineWu(x,y,clr,style);
      return;
     }
...
 
Thick means 'thick' and 2 pixels is not thick at all.
 
Dmitry Fedoseev:
Thick means 'thick' and 2 pixels is not thick at all.
Thicker than 1 pixel )
 
Oleksii Chepurnyi:

Greetings.

Maybe someone knows why you cannot draw a line with 2 pixels? What kind of discrimination is this? )

Yes, and if you replace it with if(size<2), it draws, but inaccurately:


@Nikolai Semko, is there a problem with smoothing?

 
Andrey Khatimlianskii:

@Nikolai Semko, is there a problem with anti-aliasing here?

these functions are terribly badly written. There's a hell of a lot of catching up to do. No normal anti-aliasing, no normal handling of colour mixing and transparency. You should just crumple them up and throw them in the bin, and write new ones.
I've written about it here before.

In any case, you should definitely replace the regular PixelTransform function with this one:

https://www.mql5.com/ru/forum/1111/page2553#comment_13054823

I started to write my double version (where all int input parameters are double), but didn't finish it and put it on the shelf. Not a very simple task despite its apparent simplicity. Well, it's not a problem to write it accurately, the problem is to write a very high quality, so that the algorithm would be fast. My main problem is Perfectionism.