Canvas issue New comment Lorentzos Roussos 2025.02.04 16:17 Hello I've found a small issue on canvas where if you erase a canvas with 0 opacity and subsequently save the placeholder bmp it does not save the bmp as an empty fully transparent one. Change ColorToARGB from ,0 to ,1 to see the difference . Thanks #include <Canvas\Canvas.mqh> CCanvas DESIGNER; int OnInit() { ResourceFree("YELLOW_RESOURCE"); ResourceFree("VOID_RESOURCE"); DESIGNER.Destroy(); DESIGNER.Create("DESI",200,100,COLOR_FORMAT_ARGB_NORMALIZE); DESIGNER.Erase(ColorToARGB(clrBlack,0)); DESIGNER.Update(true); ResourceSave(DESIGNER.ResourceName(),"void_square.bmp"); DESIGNER.Destroy(); DESIGNER.Create("DESI2",200,200,COLOR_FORMAT_ARGB_NORMALIZE); DESIGNER.Erase(0); DESIGNER.FillRectangle(0,0,199,199,ColorToARGB(clrYellow,255)); DESIGNER.Update(true); ResourceSave(DESIGNER.ResourceName(),"yello_square.bmp"); DESIGNER.Destroy(); //load files as res ResetLastError(); if(!ResourceCreate("YELLOW_RESOURCE","..\\..\\Files\\yello_square.bmp")){ Print("Cannot load the yellow box resource #"+IntegerToString(GetLastError())); } ResetLastError(); if(!ResourceCreate("VOID_RESOURCE","..\\..\\Files\\void_square.bmp")){ Print("Cannot load the void box resource #"+IntegerToString(GetLastError())); } ObjectCreate(0,"YELLOW_SQUARE",OBJ_BITMAP_LABEL,0,0,0); ObjectSetInteger(0,"YELLOW_SQUARE",OBJPROP_XSIZE,200); ObjectSetInteger(0,"YELLOW_SQUARE",OBJPROP_YSIZE,200); ObjectSetInteger(0,"YELLOW_SQUARE",OBJPROP_XDISTANCE,20); ObjectSetInteger(0,"YELLOW_SQUARE",OBJPROP_YDISTANCE,20); ObjectSetString(0,"YELLOW_SQUARE",OBJPROP_BMPFILE,"::YELLOW_RESOURCE"); ObjectCreate(0,"VOID_SQUARE",OBJ_BITMAP_LABEL,0,0,0); ObjectSetInteger(0,"VOID_SQUARE",OBJPROP_XSIZE,200); ObjectSetInteger(0,"VOID_SQUARE",OBJPROP_YSIZE,100); ObjectSetInteger(0,"VOID_SQUARE",OBJPROP_XDISTANCE,20); ObjectSetInteger(0,"VOID_SQUARE",OBJPROP_YDISTANCE,120); ObjectSetString(0,"VOID_SQUARE",OBJPROP_BMPFILE,"::VOID_RESOURCE"); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { ResourceFree("YELLOW_RESOURCE"); ResourceFree("VOID_RESOURCE"); ObjectDelete(0,"YELLOW_SQUARE"); ObjectDelete(0,"VOID_SQUARE"); } void OnTick() { } Errors, bugs, questions Questions from Beginners MQL5 MT5 MetaTrader 5 Canvas is cool! New comment
Hello
I've found a small issue on canvas where if you erase a canvas with 0 opacity and subsequently save the placeholder bmp it does not save the bmp as an empty fully transparent one.
Change ColorToARGB from ,0 to ,1 to see the difference .
Thanks