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 코드

프로젝트 정보

예산
59+ USD
개발자에게
53.1 USD