Create a function that can make a color gradient for CCanvas

MQL5 Libraries Integration

Job finished

Execution time 17 minutes

Specification

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.

 


Responded

1
Developer 1
Rating
(186)
Projects
261
69%
Arbitration
12
33% / 67%
Overdue
16
6%
Free

Project information

Budget
59+ USD
For the developer
53.1 USD