Create a function that can make a color gradient for CCanvas

MQL5 ライブラリ 統合

仕事が完了した

実行時間17 分

指定

I am doing some work with CCanvas, and I would like to make a "strength bar" UI display.

For example I would like the strength bar to start off grey, and progress to a more blue color as the value gets higher.

I need someone good with graphics code to help create a function for me that creates the gradient color pallet.


My function signature looks something like this:

void createColorGradient(
   const int width,
   const int height,
   const uint startColorARGB,
   const uint endColorARGB,
   const double gradientAngle,     
   uint &x[],
   uint &y[]
) {
   // Universal Consts
   const double radianPerDegree = 0.0174532925;
        
   // Reszie arrays
   ArrayResize(x, width);
   ArrayResize(y, height);
   
   // Convert angle to gradient
   const double gradientRadian = radianPerDegree * gradientAngle;


I am trying to understand some gradient code I found, but they don't use color so the solution is more complex than I can figure out in a reasonable amount of time.

The functions outputs x, y ARBG values ready for use in CCanvas.

There may be another value needed like gradient step or so, or this may need to be turned into a Class.

Anyone good with graphics let me know your proposals.

 


応答済み

1
開発者 1
評価
(187)
プロジェクト
262
69%
仲裁
12
33% / 67%
期限切れ
16
6%
パブリッシュした人: 993 codes

プロジェクト情報

予算
59+ USD
開発者用
53.1 USD