On Windows 7 64 bit don't work.
I'm trying to create a transparent one. But it doesn't work. You could find a bug. Or one cIntBMP Trasnparent Add functions.

//+------------------------------------------------------------------+ //|test.mq5 | //| Copyright 2011, MetaQuotes Software Corp. | | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2011, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| Script programme start function| //+------------------------------------------------------------------+ #import "user32.dll" int GetDC(int hwnd); int ReleaseDC(int hwnd,int hdc); #import "gdi32.dll" int GetPixel(int hdc,int x,int y); int SetPixel(int hdc,int x,int y, int c); #import void OnStart() { int i, H, V, shH=0, shV=0, header; double hgh; color screen [80][80]; color r, g, b, cv=Red; //--- long hwnd=ChartGetInteger(ChartID(),CHART_WINDOW_HANDLE); int hdc=GetDC((int)hwnd); for(V=0; V<80; V++) { for(H=0; H<80; H++) { screen[V][H]=GetPixel(hdc,V,H); } } for(V=0; V<80; V++) { for(H=0; H<80; H++) { cv=screen[V][H]; cv=AlphaBlend(cv ,clrRed ); SetPixel(hdc, V+shV,H+shH,cv); } } Sleep(3000); } //+------------------------------------------------------------------+ /* alpha blend routine */ int AlphaBlend(int bg, int src) { int alpha = 100; return (src * alpha / 255 + bg * (255 - alpha) / 255); int a = src >> 24; /* alpha */ /* If source pixel is transparent, just return the background */ if (0 == a) return (bg); /* alpha blending the source and background colours */ int rb = (((src & 0x00ff00ff) * a) + ((bg & 0x00ff00ff) * (0xff - a))) & 0xff00ff00; int g = (((src & 0x0000ff00) * a) + ((bg & 0x0000ff00) * (0xff - a))) & 0x00ff0000; return ( (src & 0xff000000) | ((rb | g) >> 8) ); }
FinGeR:
You don't need such a function, you will need to recalculate and update the whole image on every tick. The machine is iron, but let it deal with more useful tasks.
Or one cIntBMP Trasnparent Add function.
Guys, maybe there are other ways to make the picture better?
Dmitry Fedoseev #:
You don't need such a function, you will need to recalculate and update the whole image on every tick. The machine is iron, but let it deal with more useful tasks.
You don't need such a function, you will need to recalculate and update the whole image on every tick. The machine is iron, but let it deal with more useful tasks.
You mean, the only way to have transparency on those rectangle and triangle objects are by reproducing the solution we have here in this article? Studying the CCanvas Class. How to Draw Transparent Objects - MQL5 Articles
Studying the CCanvas Class. How to Draw Transparent Objects
- www.mql5.com
Do you need more than awkward graphics of moving averages? Do you want to draw something more beautiful than a simple filled rectangle in your terminal? Attractive graphics can be drawn in the terminal. This can be implemented through the CСanvas class, which is used for creating custom graphics. With this class you can implement transparency, blend colors and produce the illusion of transparency by means of overlapping and blending colors.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
cIntBMP - a library for creation of BMP images:
A class for creation and output of BMP images.
Class Methods:
aSizeX - width (in pixels);
aSizeY - height (in pixels);
aBGColor - background color;
aWidth - pen width.
aX - X coordinate;
aY - Y cooordinate;
aColor - color;
aX1, aY1 - starting coordinates;
aX2, aY2 - ending coordinates;
aColor - color;
aX1, aY1 - coordinates of the upper left corner;
aX2, aY2 - coordinates of the lower right corner;
aColor - color;
aSolid - true - filled.
aX1, aY1, aX2, aY2, aX3, aY3 - edge coordinates;
aColor - color;
aSolid - true - filled.
aX - X coordinate;
aY - Y coordinate;
aRadius1 - radius of the 1st circle;
aRadius2 - radius of the 2nd circle;
aColor - color;
aRatio - ratio (ratio=1, circle, overwise ellipse).
aAngleFrom - starting angle;
aAngleTo - ending angle. if aAngleFrom=aAngleTo, it will draw a circle;
aSolid - true - filled circle/ellipse.
aX, aY - coordinates of the fill area;
aColor - fill color.
aX, aY - coordinates of the left upper corner of the text;
aColor - text color.
aFileName - File name (it isn't necessary to specify the extension) ;
aToImages - file will be saved to the MQL5\Images\ folder, overwise it will be saved to the MQL5\Files\ folder.
aX, aY - coodinates;
aBMPFileName - file name of the image;
aObjectName - graphic object of OBJ_BITMAP_LABEL type.
aObjectName - name of the object to delete.
aFileName - Name of the bmp file to delete (without path, it isn't necessary to specify the extension);
aFromImages - if true, the file will be deleted from MQL5\Images\ folder, overwise it will be deleted from MQL5\Files\ folder.
Author: Дмитрий
An example of DrawTriangle() method
An example of DrawRectangle() method
An example of DrawCircle() method
An example of Fill() method