My approach. The core is the engine. - page 177

 
Реter Konow:

I need to develop a solution. My window consists of a set of MT objects - canvases. Their images need to be reduced first individually and then combined into one. We need such an algorithm. That is, let's say, individually, but to combine the reduced images, not yet.

Calculating the change in relative coordinates of the objects. They have a starting point. X and Y. Recalculate them relative to the total size in width and height of the total canvas - window.

 
Artyom Trishkin:

Calculating the change in the relative coordinates of the objects. They have a starting point. X and Y. Recalculate them relative to the total width and height of the overall kanvas - window.

I get the idea. I'll give it a try if Nikolai says no. Thank you.

 
Реter Konow:

I need to develop a solution. My window consists of a set of MT objects - canvases. Their images need to be reduced first individually and then combined into one. We need such an algorithm. That is, let's say, individually, but to combine the reduced images, not yet.

First of all, of course, it has to be made. I mean, it has to have a bit of a coherent look. Even in the old days they said - stop, let out ... But never mind, the train will not stop ;-) let's consider that this is the eternal author's version ...

Since we're dancing with C#, look at OpenGL to be "ahead of the planet". And draw with it on "canvas" (but in decent places it's not called that, it's context). It will be crazy fast and you can overlay, scale, rotate, twist as you like.

 
Sorry, I'll pass.
My comfort point is that I set my own tasks and accomplish them myself, and I don't set anyone else's tasks or accomplish anyone else's tasks.

 
Artyom Trishkin:

Calculating the change in relative object coordinates. They have a starting point. X and Y. Recalculate them relative to the overall width and height of the overall canvas - window.

This method of vector scaling will be very visually inferior to raster scaling. And what about text? The font size will "jump" disproportionately
Vector scaling would be acceptable if the coordinates of the shapes could be set to fractional (double) rather than integer (int) values. But that would require a new advanced Canvas library with anti-aliasing.
 
Maxim Kuznetsov:

First of all, of course, it has to be made. I mean, it has to have a bit of a coherent look to it. The first thing you need to do is to make it look a little more holistic... It's like they used to say back in the day - stop, let it out...but come on, the train will never stop ;-) let's just say it's the eternal author's version...

Since we're dancing with C#, look at OpenGL to be "ahead of the planet". And draw with it on "canvas" (but in decent places it's not called that, it's context). It will be crazy fast and you can overlay, scale, rotate, twist as you like.

If writing for yourself, sure. But the whole parsing thing is in the marketplace.
Have you worked with OpenGL or DirectX? Do they use video card resources?
ZS It's a silly question though. Of course they do.

I can't understand why the developers screwed on OpenCL and not OpenGL? Probably because it was easier to do.

SZY I read about OpenCL. I have read about OpenCL. This technology is more oriented towards computation and that explains why the choice was not in favour of OpenGL.

 
Peter, it would be cool for you to learn OpenCL for your GUI. If I'm not confused, it will work for the Market. You only need to have the OpenCL kernel installed by the users and their video cards to support it, of course.
Because it has been possible for a long time, but we haven't seen any activity in this direction yet.

 
Nikolai Semko:
This method of vector scaling would be visually very much inferior to raster scaling. And what about text? Font size will be disproportionately "jumpy".
Vector scaling would be acceptable if the coordinates of the shapes could be set to fractional (double) rather than integer (int) values. But that would require a new advanced Canvas library with anti-aliasing.

First thing that came to mind. Probably influenced by my long time experience with vector graphics in 3D Studio MAX - I'm used to thinking in such a way. Yes, it's all in dubles of course, and by the way, very much visually wins over raster scaling in photoshop.

 
Nikolai Semko:
This method of vector scaling would be visually very much inferior to raster scaling. And what about text? Font size will be disproportionately "jumpy".
Vector scaling would be acceptable if the coordinates of the shapes could be set to fractional (double) rather than integer (int) values. But that would require a new advanced Canvas library with anti-aliasing.

And here's where it occurred to me: take a raster image of the required window-form, and then scale it as a single raster object.

 
Artyom Trishkin:

And here's where it occurred to me: take a bitmap of the required window-shape and then scale it as a single bitmap object.

What else could it be? I think that's what Peter wanted.

Here is a ready-to-use function for scaling up an image stored in BMP[] array with sizewidth_bmp xheight_bmp

void CImage::ResizeImage(double NewWidth)
  {
   if(NewWidth==0) NewWidth=1;
   double k=NewWidth/width_bmp; // меньше единицы
   double k2=k*k;
   double kk=width_bmp/NewWidth;  // больше единицы
   double w1=(double)width_bmp*k; int W=_ceil(w1);
   double h1=(double)height_bmp*k; int H=_ceil(h1);
   uint M[];
   int ArrSize=W*H;
   ArrayResize(M,ArrSize);
   int pos=0;
   double y0=0,x0,y1=kk,x1;
   for(int y=0; y<H; y++,y0=y1,y1+=kk)
     {
      x0=0; x1=kk;
      for(int x=0; x<W; x++,x0=x1,x1+=kk,pos++)
        {
         int xs=(int)x0;
         int xf=(int)x1;
         int ys=(int)y0;
         int yf=(int)y1;
         double r=0,g=0,b=0,p=0;
         int pos2=ys*(int)width_bmp+xs;
         for(int Y1=ys;Y1<=yf;Y1++,pos2+=(int)width_bmp)
           {
            double dx,dy;
            int pos1=pos2;
            if(Y1==ys) { dy=ys+1-y0; if(ys==yf) dy=dy-1+y1-yf;}
            else if(Y1==yf) dy=y1-yf;
            else dy=1;
            for(int X1=xs;X1<=xf;X1++,pos1++)
              {
               if(pos1<SizeArr)
                 {
                  if(BMP[pos1]!=0)
                    {
                     col.clr=BMP[pos1];
                     if(X1==xs) { dx=xs+1-x0; if(xs==xf) dx=dx-1+x1-xf;}
                     else if(X1==xf) dx=x1-xf;
                     else dx=1;
                     dx=dx*dy;
                     r+=(double)col.argb[2]*dx;
                     g+=(double)col.argb[1]*dx;
                     b+=(double)col.argb[0]*dx;
                     p+=(double)col.argb[3]*dx;
                    }
                 }
               else break;
              }
           }
         col.argb[0]=uchar(b*k2);
         col.argb[1]=uchar(g*k2);
         col.argb[2]=uchar(r*k2);
         col.argb[3]=uchar(p*k2);
         M[pos]=col.clr;
        }
     }
   C.Resize(W,H);
   ArraySwap(C.m_pixels,M);
   C.Update();
  }
Files:
CImage.mqh  12 kb
Reason: