Tomy46 Posted April 20, 2010 Share Posted April 20, 2010 (edited) Hello everyone! Here is my problem: I want to make temporary GUI to extract a graph as an image ... But impossible! I just have a black box that comes as an image ... Can you help me?? My code attached ... File "data_graph.ini" : [Relevés] 1=75 2=30 3=30 4=90 5=100 6=110 7=70 8=86 9=60 10=78 11=83 12=89 13=180 14=120 15=95 16=89 17=86 18=65 19=90 20=34 21=0 22=0 23=56 24=0 P.S : Sorry for my english but i'm french TEST CREATION GRAPH SIMPLE.au3 Edited April 20, 2010 by Tomy46 ======> Tomy ... just for fun <====== Link to comment Share on other sites More sharing options...
Tomy46 Posted April 20, 2010 Author Share Posted April 20, 2010 (edited) UP UP ... Nobody ?? HELP .... .... Good night ... I will be back tomorrow Edited April 20, 2010 by big_daddy ======> Tomy ... just for fun <====== Link to comment Share on other sites More sharing options...
JohnOne Posted April 20, 2010 Share Posted April 20, 2010 http://www.autoitscript.com/wiki/FAQ#When_should_I_bump_my_threads.3F Or are you too important ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Tomy46 Posted April 20, 2010 Author Share Posted April 20, 2010 http://www.autoitscript.com/wiki/FAQ#When_should_I_bump_my_threads.3FOr are you too important ?Ah Ah Ah ...Thanks !Anybody? ======> Tomy ... just for fun <====== Link to comment Share on other sites More sharing options...
Tomy46 Posted April 21, 2010 Author Share Posted April 21, 2010 UP x) ======> Tomy ... just for fun <====== Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 21, 2010 Share Posted April 21, 2010 (edited) Shouldn't you be saving $backbuffer instead? ; !!!!!!! SAUVEGARDE EN FICHIER IMAGE !!!!!!! ; _GDIPlus_ImageSaveToFile ($bitmap, @MyDocumentsDir & "\TEST_GRAPH.bmp") _GDIPlus_ImageSaveToFile($backbuffer, @MyDocumentsDir & "\TEST_GRAPH.bmp") Not sure, couldn't test. Edited April 21, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Tomy46 Posted April 21, 2010 Author Share Posted April 21, 2010 Shouldn't you be saving $backbuffer instead? ; !!!!!!! SAUVEGARDE EN FICHIER IMAGE !!!!!!! ; _GDIPlus_ImageSaveToFile ($bitmap, @MyDocumentsDir & "\TEST_GRAPH.bmp") _GDIPlus_ImageSaveToFile($backbuffer, @MyDocumentsDir & "\TEST_GRAPH.bmp") Not sure, couldn't test. After test : bad :s No image saved ... No results... HELP UP... ======> Tomy ... just for fun <====== Link to comment Share on other sites More sharing options...
Tomy46 Posted April 22, 2010 Author Share Posted April 22, 2010 up.... ======> Tomy ... just for fun <====== Link to comment Share on other sites More sharing options...
numdig Posted January 7, 2011 Share Posted January 7, 2011 I just have a black box that comes as an image ...I have the exact same problem. God, help us, GDI+ is shit!I wish I had a wrapper for GD or GD2... I could write one but I don't know how to pass a FILE* in parameter during a DllCall (http://www.libgd.org/ImageCreation#gdImageCreateFromPng.28FILE_.2Ain.29_.28FUNCTION.29). So just stumbling from one problem to another. This is just too depressing... Link to comment Share on other sites More sharing options...
UEZ Posted January 7, 2011 Share Posted January 7, 2011 (edited) When you draw a black pen to a black screen then you will see only a black bitmap. Try this: expandcollapse popup#include <GDIPlus.au3> #include <WinAPI.au3> ;CONVENTIONNEL #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $GUI, $nombre, $start, $style, $graphics, $backbuffer, $bitmap, $nMsg Global $axe_x_1, $axe_y_1, $axe_x_2, $axe_y_2, $releve_axe_y, $valeurs_axe_y Global $GUI_GRAPH _GUI() _LANCER() _Main() Func _GUI() ; Initialisation du GDI+ et du GUI Virtuel $GUI_GRAPH = GUICreate("GUI Graph", 280, 150) GUISetBkColor(0xF0F0F0, $GUI_GRAPH) GUISetState(@SW_SHOW) EndFunc Func _LANCER() ; ======================================================================================= _GDIPlus_Startup () ;Création de la matrice graphique $graphics = _GDIPlus_GraphicsCreateFromHWND($GUI_GRAPH) ;Conversion de la matrice sous forme de Bitmap (Toujours en mémoire) $bitmap = _GDIPlus_BitmapCreateFromGraphics(280, 150, $graphics) ;Création du buffer de création des lignes de graph $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2) _GDIPlus_GraphicsClear($backbuffer, 0xFFF0F0F0) ; ==================== Realisation du graphique ==================== ;Initialisation des variables $axe_x_1 = 20 $axe_y_1 = 0 $releve_axe_y = 0 ;Parametre de création $style = _GDIPlus_PenCreate (0xFF000000) ;Création du repère (Start X/Y ; End X/Y) _GDIPlus_GraphicsDrawLine ($backbuffer, 20, 20, 20, 130, $style) _GDIPlus_GraphicsDrawLine ($backbuffer, 20, 130, 270, 130, $style) ;Chargement des valeurs $valeurs_axe_y = IniReadSection ("data_graph.ini", "Relevés") If @error Then MsgBox(64, "Erreur de chargement des données du graphique !", "Attention, les données du graphique n'ont pas été correctement chargées!") ;MAJ Positions sur -Y Do _PLACEMENT() Until $releve_axe_y = 24 ; ========================== Finalisation =========================== _GDIPlus_PenDispose($style) ;Affichage de l'image chargé en variable sur GUI de base (Position X/Y) = OK _GDIPlus_GraphicsDrawImageRect($graphics,$bitmap,0,0,280,150) ; !!!!!!! SAUVEGARDE EN FICHIER IMAGE !!!!!!! _GDIPlus_ImageSaveToFile ($bitmap, @ScriptDir & "\TEST_GRAPH.jpg") ;Nettoyage de la variable = OK _GDIPlus_BitmapDispose($bitmap) ; Arrêt de la librairie GDI+ _GDIPlus_ShutDown () ; ======================================================================================= EndFunc Func _PLACEMENT() ;Calcul X/Y Depart If $releve_axe_y = 0 Then $releve_axe_y += 1 $axe_x_1 += 10 $axe_y_1 = 130 - $valeurs_axe_y[""& $releve_axe_y &""][1] Else $releve_axe_y += 1 $axe_x_1 = $axe_x_2 $axe_y_1 = $axe_y_2 EndIf ;Calcul X/Y Final $axe_x_2 = $axe_x_1 + 10 $axe_y_2 = 130 - $valeurs_axe_y[""& $releve_axe_y &""][1] ;Création du repère (Start X/Y ; End X/Y) _GDIPlus_GraphicsDrawLine ($backbuffer, $axe_x_1, $axe_y_1, $axe_x_2, $axe_y_2, $style) EndFunc Func _MAIN() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Also check out the order how you paint to graphic and save the image afterwards! Br, UEZ Edit: original post is from 20 April 2010 - 01:34 AM Edited January 7, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now