Canvas is cool! - page 62

 
Nikolai Semko:

Something like this?



Nikolai, will the example code be available? :)

 
Алексей Барбашин:

Nikolai, will the example code be available? :)

The code is still raw. I made it a year and a half ago for an experiment, how it could look like.
When I implement it properly, then I'll add this feature to iCanvas, if I'll still be on the forum by then. I don't have time to do it right now.

You can try to implement it yourself.
To help, here are a couple of functions from my implementation, which are responsible for drawing the colour selection window:

void    iCanvas::DrawSetColor(int X,int Y,uint curColor=0xFFFFFFFF)
  {
   if(!SetClr) return;
   uchar R=GETRGBR(curColor);
   uchar G=GETRGBG(curColor);
   uchar B=GETRGBB(curColor);
   FillRectangle(X-3,Y-3,X+330,Y+273,ColorToARGB(0xFFC0C0C0));
   FontSet("Century Gothic",20);
   TextOut(X+23,Y-4,"R "+string(R)+"(#"+ByteToHex(R)+")",0xFF000000);
   TextOut(X+135,Y-4,"G "+string(G)+"(#"+ByteToHex(G)+")",0xFF000000);
   TextOut(X+251,Y-4,"B "+string(B)+"(#"+ByteToHex(B)+")",0xFF000000);
   FillCircle(X+10,Y+6,6,ARGB(255,255,255-R,255-R));
   FillCircle(X+122,Y+6,6,ARGB(255,255-G,255,255-G));
   FillCircle(X+238,Y+6,6,ARGB(255,255-B,255-B,255));
   for(int x=0; x<256; x++)
      for(int y=0; y<256; y++)
        {
         PixelSet(x+X,y+Y+15,ARGB(255,R,x,y));
        }
   uchar rq=(R>127)?0:255;
   Rectangle(G+X-4,B+Y+11,G+X+4,B+Y+19,ARGB(255,0,0,0));
   Rectangle(G+X-3,B+Y+12,G+X+3,B+Y+18,ARGB(255,255,255,255));
   Rectangle(G+X-5,B+Y+10,G+X+5,B+Y+20,ARGB(255,255,255,255));
   for(int y=0; y<256; y++)
     {
      for(int x=0; x<16; x++)
        {
         PixelSet(x+X+263,y+Y+15,ARGB(255,y,x*16,0));
         PixelSet(x+X+263+16,y+Y+15,ARGB(255,y,255,x*16));
         PixelSet(x+X+263+32,y+Y+15,ARGB(255,y,255-x*16,255));
         PixelSet(x+X+263+48,y+Y+15,ARGB(255,y,0,255-x*16));
        }
     }
   Rectangle(X+260,Y+R+12,X+263+67,Y+R+18,0xFFFFFFFF);
   Rectangle(X+261,Y+R+13,X+263+66,Y+R+17,0xFFFFFFFF);
   Update();
  }
string ByteToHex(int n)
  {
   string s="",c;
   if(n==0) return "00";
   int N=n;
   while(n!=0)
     {
      if(n%16<10)
         c=CharToString(uchar(n%16+48));
      else
         c=CharToString(uchar(n%16+55));
      s = c + s;
      n = n / 16;
     }
   if(N<16) s="0"+s;
   return(s);
  }
 

It feels like the only people left on the forum are whiners and nerds. And where are those who were ready for mql exploits...?

Nikolay is good! He nicely demonstrates the capabilities of mql. I would add in a branch title - Canvas is easy!

And in fact :) Nikolay, have you tried to replace ByteToHex() by embedded StringFormat("%.2X",R) function?


p.s. The language and the execution environment have reached their perfection, and sometimes I want to say: - Stop! :)

Документация по MQL5: Преобразование данных / StringFormat
Документация по MQL5: Преобразование данных / StringFormat
  • www.mql5.com
"SYMBOL_SWAP_MODE_INTEREST_CURRENT (в годовых процентах от цены инструмента на момент расчета свопа)" "SYMBOL_SWAP_MODE_REOPEN_CURRENT (переоткрытием позиции по цене закрытия +/- указанное количество пунктов)" "SYMBOL_SWAP_MODE_REOPEN_BID (переоткрытием позиции по текущей цене Bid +/- указанное количество пунктов)"
 
Yury Kulikov:

Nikolai, have you tried replacing ByteToHex() with the built-in StringFormat("%.2X",R) function?


Oh, thank you, Yuri. I didn't know that. Invented a bicycle as always )).

 
Nikolai Semko:

The code is still raw. I made it a year and a half ago for an experiment, how it could look like.
When it is properly implemented, then I will add this feature to iCanvas, if I will still be on the forum by then. I don't have time to do it right now.

You can try to implement it yourself.
To help, here are a couple of functions from my implementation, which are responsible for drawing the colour selection window:

Thank you! I'm trying to implement it right now.

 
TheXpert:
Tell me how come that there are no professional programmers among moderators of a resource that is named after a programming language?

Oops

I've been programming in C++ for 25 years without a break.

MQL II - from beginning to end

MQL4 - up to build 600 - from beginning to end

MQL5 - from the beginning

I get money for my programming in C++, so I can be considered a professional programmer.

 
Slava:
you're a staff member of metaquotes and have little or no involvement in moderating the forum. And honestly, I thought you had an admin nameplate.
 
TheXpert:
you're a staff member of metaquotes and you're practically not moderating the forum. And honestly, I thought you had an admin nameplate.

Imagine you have written a programme

Who better to answer questions than you

 

3D Moving Avarage
I'll throw the code in the QB tomorrow


 
Nikolai Semko:

3D Moving Avarage
I'll throw the code in the QB tomorrow

Beautiful !!!

Nikolai, please throw the code listing of the rainbow colour palette formation here

If it is in the form of a function, it will be even more practical