Bibliotheken: cIntBMP - eine Bibliothek für die Erstellung von Bildern im BMP-Format

 

cIntBMP - eine Bibliothek für die Erstellung von Bildern im BMP-Format:

Eine Klasse für die Erstellung und Anzeige von Bildern im BMP-Format.

cIntBMP - Dreiecke. Die Methode DrawTriangle()

Dreiecke. Die Methode DrawTriangle()

Autor: Dmitry Fedoseev

 
Unter Windows 7 64 Bit funktioniert es nicht.
 
barnix:
Unter Windows 7 64 Bit funktioniert es nicht.
Behoben. Bitte laden Sie es erneut herunter.
[Gelöscht]  

Ich versuche, ein transparentes Bild zu erstellen. Aber es funktioniert nicht. Sie könnten einen Fehler finden. Oder eine cIntBMP Trasnparent Add Funktionen.

//+------------------------------------------------------------------+
//|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"
//+------------------------------------------------------------------+
//| Skript-Programmstartfunktion|
//+------------------------------------------------------------------+

#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 */
 
   /* Wenn das Quellpixel transparent ist, wird nur der Hintergrund zurückgegeben */
   if (0 == a) return (bg);

   /* Alphamischung der Quell- und Hintergrundfarben */
 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:

Oder eine cIntBMP Trasnparent Add Funktion.

Sie brauchen eine solche Funktion nicht, Sie müssen das gesamte Bild bei jedem Tick neu berechnen und aktualisieren. Die Maschine ist eisern, aber lassen Sie sie sich mit nützlicheren Aufgaben beschäftigen.
 
Gibt es eine Möglichkeit, diese Bibliothek OHNE die von ihr aufgerufene DLL zu verwenden ( Dateifunktionen innerhalb des Codes)?
 
Leute, vielleicht gibt es andere Möglichkeiten, das Bild zu verbessern?
 
Dmitry Fedoseev jedem Tick neu berechnen und aktualisieren. Die Maschine ist eisern, aber lassen Sie sie sich mit nützlicheren Aufgaben beschäftigen.

Sie meinen, die einzige Möglichkeit, diese Rechteck- und Dreiecksobjekte transparent zu machen, besteht darin, die Lösung zu reproduzieren, die wir in diesem Artikel gefunden haben? Studieren Sie die CCanvas-Klasse. Wie man transparente Objekte zeichnet - MQL5 Artikel

Studying the CCanvas Class. How to Draw Transparent Objects
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.