Changing color of Bitmap label inside the code. - page 3

 
Fatemeh Ameri #:

What is the second piece of code? what is supposed to do?

its a structure that is used in the first piece of code . without it you will get errors

 
Fatemeh Ameri #:

I tried Nikolai's code in MT5. It is constantly resizing the bitmap, I tried to turn that code to a function in which we give new size and it just shows the bitmap with new size, but does not work, when I call CImage Image(bmp,100,100,1); It does not show any thing in the chart, This is my code.
Maybe I should try to work with your own code.

I tried your code, again it seems to be working very well, well done  Lorentzos.

in this case, the code for MT4 and MT5 is the same.

try this mql4 version

Files:
ScalingBMP.zip  3400 kb
 
Nikolai Semko #:

in this case, the code for MT4 and MT5 is the same.

try this mql4 version

@Fatemeh Ameri Use these , they are faster and they don't just shrink the image.

 
Lorentzos Roussos #:

@Fatemeh Ameri Use these , they are faster and they don't just shrink the image.

Thank you very much for all your help.

 
Nikolai Semko #:

in this case, the code for MT4 and MT5 is the same.

try this mql4 version

Thanks very much Nikolai Semko, The file works very well, I was wondering what is the issue with MQL5 code, It shows the bitmap on the chart while it is constantly resizing, but when I want to only put it on the chart with a new size and be stable, It does not show any thing. The single line of "CImage Image(bmp,0,0,Transp);" must show the bitmap on the chart, but it does not. what is the error you think?

 
Fatemeh Ameri #:

Thanks very much Nikolai Semko, The file works very well, I was wondering what is the issue with MQL5 code, It shows the bitmap on the chart while it is constantly resizing, but when I want to only put it on the chart with a new size and be stable, It does not show any thing. The single line of "CImage Image(bmp,0,0,Transp);" must show the bitmap on the chart, but it does not. what is the error you think?

Permanent resizing was implemented to demonstrate performance.

It's impossible to understand the problem without seeing the code.


PS   Perhaps you have used the function Finish() (I have unsuccessfully named this function, it would be more correct to call it Destroy()), not only in OnDeinit().

 
Nikolai Semko #:

Permanent resizing was implemented to demonstrate performance.

It's impossible to understand the problem without seeing the code.


PS   Perhaps you have used the function Finish() (I have unsuccessfully named this function, it would be more correct to call it Destroy()), not only in OnDeinit().

The code is very simple, I used your Cimage library, I took it from your MT5 version of ScalingBmp. Like the MT4 version here I expected that it shows the bitmap on the chart with new image size, but it does not show anything. (I attached your MT5 version for reference)

//+------------------------------------------------------------------+
//|                                                Bitmap change.mq5 |
//|                                  Copyright 2022, MetaQuotes Ltd. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Ltd."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#include <Canvas\CImage\CImage.mqh>

#resource  "\\Images\\22731093.bmp"
string bmp="::\\Images\\22731093.bmp";
CImage Image(bmp,0,0,Transp);

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   Image.ResizeImage(350);
   
  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
   Image.Finish();
}  
Files:
Scaling.ZIP  399 kb
 
Fatemeh Ameri #:

The code is very simple, I used your Cimage library, I took it from your MT5 version of ScalingBmp. Like the MT4 version here I expected that it shows the bitmap on the chart with new image size, but it does not show anything. (I attached your MT5 version for reference)

#property indicator_chart_window

#include <Canvas\CImage\CImage.mqh>
#resource  "\\Images\\22731093.bmp"
string bmp="::Images\\22731093.bmp";

input double Tr = 0.7; // image transparency from 0 to 1

double Transp=Tr;
CImage Image(bmp,500,200,Transp);

//+------------------------------------------------------------------+
int OnInit() {
   Image.ResizeImage(350);   
   return(INIT_SUCCEEDED); 
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
   Image.Finish();
}
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[]) {
   return(rates_total);
}

 
Nikolai Semko #:
Thanks very much Nikolai Semko again, it works very well. you were huge help.
 
Fatemeh Ameri #:
Thanks very much Nikolai Semko again, it works very well. you were huge help.
No problem ))