[R] Aide concernant _GDIPlus_GraphicsDrawImage

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Répondre
Avatar du membre
toto1515
Niveau 3
Niveau 3
Messages : 35
Enregistré le : mer. 08 déc. 2010 17:18
Localisation : Corse
Status : Hors ligne

[R] Aide concernant _GDIPlus_GraphicsDrawImage

#1

Message par toto1515 »

Bonjour,
je teste l'affichage d’images dans une Gui à partir de strings en base64 et je me retrouve avec des affichages incohérents.
GDI+ 2021-02-15_141016.jpg
Il semblerait que si l'image convertie en base64 est un gif, l'affichage soit correct mais si l'image est un jpg, l'affichage n'est pas bon (mauvaises dimensions, mauvais centrage).
Lorsque j'utilise _GDIPlus_GraphicsDrawImage, l'image gif s'affiche correctement mais pas l'image jpg
Lorsque j'utilise _GDIPlus_GraphicsDrawImageRect avec les dimensions des images, c'est le bon affichage.
Voici mon script:

Code : Tout sélectionner

#include <GDIPlus.au3>

_GDIPlus_Startup()
Local Const $iWidth = 900, $iHeight = 420, $iBgColor = 0xFFE8FF ;$iBgColor format RRGGBB
Local $hGUI = GUICreate("GDI+ Example (" & @ScriptName & ")", $iWidth, $iHeight, -1, 100)
GUISetBkColor($iBgColor, $hGUI)
GUISetState(@SW_SHOW)

$left_10 = 10
$top_10 = 10
$delta_vert = 30
$delta_horiz = 110
$ecart_vert = 80

Local $hGraphics1 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap1 = _GDIPlus_BitmapCreateFromMemory(_green_gif())

Local $iW1 = _GDIPlus_ImageGetWidth($hBitmap1)
Local $iH1 = _GDIPlus_ImageGetHeight($hBitmap1)
ConsoleWrite("$iW1=" & $iW1 & @CRLF);300
ConsoleWrite("$iH1=" & $iH1 & @CRLF);25

Local $hGraphics2 = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap2 = _GDIPlus_BitmapCreateFromMemory(_green_jpg())

Local $iW2 = _GDIPlus_ImageGetWidth($hBitmap2)
Local $iH2 = _GDIPlus_ImageGetHeight($hBitmap2)
ConsoleWrite("$iW2=" & $iW2 & @CRLF);300
ConsoleWrite("$iH2=" & $iH2 & @CRLF);25

GUICtrlCreateLabel("green_gif à " & $left_10 + $delta_horiz, $left_10, $top_10)
_GDIPlus_GraphicsDrawImage($hGraphics1, $hBitmap1, $left_10 + $delta_horiz, $top_10)
GUICtrlCreateLabel("green_jpg à " & $left_10 + $delta_horiz, $left_10, $top_10 + $delta_vert)
_GDIPlus_GraphicsDrawImage($hGraphics2, $hBitmap2, $left_10 + $delta_horiz, $top_10 + $delta_vert)

$top_10 += $ecart_vert
GUICtrlCreateLabel("green_gif(rect) à " & $left_10 + $delta_horiz, $left_10, $top_10)
_GDIPlus_GraphicsDrawImageRect($hGraphics1, $hBitmap1, $left_10 + $delta_horiz, $top_10, $iW1, $iH1)
GUICtrlCreateLabel("green_jpg(rect)  à " & $left_10 + $delta_horiz, $left_10, $top_10 + $delta_vert)
_GDIPlus_GraphicsDrawImageRect($hGraphics2, $hBitmap2, $left_10 + $delta_horiz, $top_10 + $delta_vert, $iW2, $iH2)


$top_10 += $ecart_vert
GUICtrlCreateLabel("green_gif centré", $left_10, $top_10)
_GDIPlus_GraphicsDrawImage($hGraphics1, $hBitmap1, ($iWidth - $iW1) / 2, $top_10); centré horizontalement
GUICtrlCreateLabel("green_jpg centré", $left_10, $top_10 + $delta_vert)
_GDIPlus_GraphicsDrawImage($hGraphics2, $hBitmap2, ($iWidth - $iW2) / 2, $top_10 + $delta_vert); centré horizontalement

$top_10 += $ecart_vert
$pos_gauche = 190
GUICtrlCreateLabel("green_gif à " & $pos_gauche, $left_10, $top_10)
_GDIPlus_GraphicsDrawImage($hGraphics1, $hBitmap1, $pos_gauche, $top_10)
GUICtrlCreateLabel("green_jpg à " & $pos_gauche, $left_10, $top_10 + $delta_vert)
_GDIPlus_GraphicsDrawImage($hGraphics2, $hBitmap2, $pos_gauche, $top_10 + $delta_vert)

$top_10 += $ecart_vert
$pos_gauche = 450
GUICtrlCreateLabel("green_gif à " & $pos_gauche, $left_10, $top_10)
_GDIPlus_GraphicsDrawImage($hGraphics1, $hBitmap1, $pos_gauche, $top_10)
GUICtrlCreateLabel("green_jpg à " & $pos_gauche, $left_10, $top_10 + $delta_vert)
_GDIPlus_GraphicsDrawImage($hGraphics2, $hBitmap2, $pos_gauche, $top_10 + $delta_vert)

While 1
	Switch GUIGetMsg()
		Case -3
			_GDIPlus_BitmapDispose($hBitmap1)
			_GDIPlus_GraphicsDispose($hGraphics1)
			_GDIPlus_BitmapDispose($hBitmap2)
			_GDIPlus_GraphicsDispose($hGraphics2)
			_GDIPlus_Shutdown()
			Exit
	EndSwitch
WEnd

Func _green_jpg()
	Local $Base64String
	$Base64String &= '/9j/4AAQSkZJRgABAQEASABIAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD//gATQ3JlYXRlZCB3aXRoIEdJTVD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCAAZASwDASIAAhEBAxEB/8QAHAAAAQUBAQEAAAAAAAAAAAAABAABAgYHBQMI/8QAPxAAAQIEAgUIBgcJAAAAAAAAAAEDAgQFBlKhERUxQpISFiEyQVORkxMUQ1GBogciMzZydLIlNVRVYWVxc4L/xAAbAQADAQEBAQEAAAAAAAAAAAABAgMABAUGB//EADARAAECAwUGBQQDAAAAAAAAAAEAAgOh4QQFBhZSERVBQlGRFDFDU2ESE+LwITKB/9oADAMBAAIRAxEAPwDapK5bfgag9ffpkUwsKK4rzsHKVdHTp09OkNguO1I+q7R/g42YDci/tR78RGRi2Hx77wewkbOK/LrRiKPBe5oHkTx+V9CpXrYXY7SfMbJJXLc7HaX5jZhTUQW1GQN5v6LlzTaNIW2pWrf7Hqd5kBJKzQux6Q8yAxluM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v5EVObUdgpuNp5pVU3YThHnlVFu0N/R18geOgzGPIrEz9tEeQu4Wa5VUDg2EfUlVWaKgTGPI8Y7emF38iviBl9muVVM4Jgn1JVXbit2Zx5EIrcmceRxxAy8zXKqQ4Ggn1ZVXUW25nHkRW2pnHkc0QMvM1yqlOBIPuyqujzZmceQy2zM48jniNl1muVUMhwPdlVH82ZnHkNzZmceQCIGXWa5VQyFA92X'
	$Base64String &= '5I5bYme8yG5sTPeZAQjZdZrlVbIUD3ZfkjebEz3mQubEz3mQEI2XWa5VWyFA92X5IxbYmceQJNWxNpCvJi0/AYQRh5o55VRGA4I9WVVwZuizjTv1m4tH+Cz0OF2Wp0DcTUSqqquxQY1/6Hvuo5+bj/TCddjunw0X7n17f8qvVunDIu60feET6v4I2bNnn87Sv//Z'
	Local $bString = _WinAPI_Base64Decode($Base64String)
	Return $bString
EndFunc   ;==>_green_jpg

Func _green_gif()
	Local $Base64String
	$Base64String &= 'R0lGODdhLAEZAPcAAA+mLHyahATNLnzahETNVbTZrnSbfXzuhgS4IiTNRETjW5zsoSS3PbTys2Tma9Txzny6dCTcQgbWKwTEJ5y5n5z3o0y1XIH2i5zSnGTLbLT8siSkNGS6XBS4K5zEmVTlZRTNMzTdS2TucQWuG6TgpETYW4zslDTMUcT7vxTXM5z2rCTEQxSsMKztsUTBVxTFMqzEqAW+JHTjf1TqZIz2lNT616TXoGTabDTiTgXSKHzhh8T1vZTDkVTYZRTeNoTtl6TqtGTGbBTNPCTVRFS0XRy4PUzqYuTu3CviR8T9zIzelAS4LJzypGTqbNzx3oy4j6y+rJzKngSyIjTWTKz5sXTZfbTktILyizS7TATENKS+maz+pLz+xSSxOXS+dZTyrBTXPDTGTAzNMlTKZEzkYCTdTBS+K3TvgKzgn4zykhSyKI/+nH/mgp/+oazRrKTCnFzlaTTdVETeWBTCPFTqbMz0xym+Sbz8uqzKqSzVSoyrkHSmhITriqTtpdT20gTWNAzEK5TSlIeljGy5dFS+YcTmxBygNDSuRHy+hIT+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ILJdjxtNgy0Nj7wNgiHdmPjdiUYNmYDU+ZfdmardnytNiRjdjNQAyjTQymzQ3cwFHmUA8uIA8uQAhewA9HIAh7sAeXUDtP8ASLsAh08RRR4AG/HQXCDQPCXRGZcNzIzQn/sNz/MAvObQXQHd2lYAWlMN3VHQ/THd3abQWOwN2ObVAA4F0AbjDe5I0H5o0HCJHeCrHepUEanfHe8G0YiRHf9C3fhkEBt0AB+m0KpqAH/i0IpxAAAWAAAz7gBG4ACI7gBm7gCd7gDv7gEB7hEj7hEL7gCn7hB57hFq7hGL7hHk7hFG7gp2AAeuAEAQEAOw=='
	Local $bString = _WinAPI_Base64Decode($Base64String)
	Return $bString
EndFunc   ;==>_green_gif

Func _WinAPI_Base64Decode($sB64String)
	Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
	If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
	Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
	$aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
	If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
	Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode

Voici les images que j'utilise:
green.jpg
green.jpg
green.jpg (2.1 Kio) Vu 107 fois
green.jpg
green.jpg
green.jpg (2.1 Kio) Vu 107 fois
green.gif
green.gif
green.gif (5.38 Kio) Vu 107 fois
green.gif
green.gif
green.gif (5.38 Kio) Vu 107 fois
Pour l'encodage, j'ai utilisé le "'File to Base64 String' Code Generator v1.20 Build 2020-06-05 by UEZ "
J’avoue ne pas comprendre ces différences d'affichage. Pourquoi _GDIPlus_GraphicsDrawImage ne respecte pas les dimensions de l'image jpg?
Merci
Modifié en dernier par toto1515 le mar. 16 févr. 2021 14:01, modifié 1 fois.
Autoit 3.3.14.5 - Scite 4.2.0 - Windows 8
Avatar du membre
mikell
Modérateur
Modérateur
Messages : 6087
Enregistré le : dim. 29 mai 2011 17:32
Localisation : Deep Cévennes
Status : Hors ligne

Re: Aide concernant _GDIPlus_GraphicsDrawImage

#2

Message par mikell »

walkson, tu réponds à côté ... Image

@toto1515
Tu as peut-être fait une erreur quelque part. Je viens de refaire la manip avec les images fournies et le script de UEZ et je n'ai plus le problème avec le code obtenu
Code ci-dessous :

#include <GDIPlus.au3>

_GDIPlus_Startup()
Local $hGUI = GUICreate("GDI+ Example (" & @ScriptName & ")", 400, 100, -1, 100)
GUISetState(@SW_SHOW)

Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap1 = _GDIPlus_BitmapCreateFromMemory(_green_gif())
Local $hBitmap2 = _GDIPlus_BitmapCreateFromMemory(_green_jpg())
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap1, 10, 10)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap2, 10, 40)


While 1
   Switch GUIGetMsg()
      Case -3
         _GDIPlus_BitmapDispose($hBitmap1)
         _GDIPlus_BitmapDispose($hBitmap2)
         _GDIPlus_GraphicsDispose($hGraphics)
         _GDIPlus_Shutdown()
         Exit
   EndSwitch
WEnd

Func _green_jpg()
   Local $Base64String
   $Base64String &= '/9j/4AAQSkZJRgABAQAAAQABAAD/4QAWRXhpZgAATU0AKgAAAAgAAAAAAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCAAZASwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QA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/AGLD+b8P+CZS4VoP7X4f8E228O3P9/8ASmN4cuf7/wClY9FL+xIfzfh/wTN8J0H9t/d/wTUPhu5/v/pTT4auf7/6Vm0Uv7Fh/N+H/BIfCND+d/d/wTR/4Rm5/v8A6Uh8M3P9/wDSs+il/YlP+b8A/wBUMP8Azv7v+CX/APhGbn+/+lJ/wjNz/f8A0qjRR/YkP5vw/wCCH+puH/n/AA/4JePhi5/56fpSf8Ixc/8APT9KpUUf2JD+b8P+CH+puH/n/D/gl3/hGLn/AJ6fpR/wjFz/AM9P0qlRR/YkP5vw/wCCH+puH/n/AA/4JcPhi5/v/pVS68MXYU7Wz+FJRQsmgvtfgKPCNBfbf3f8EwbvRbyKX5o2x9K6jQopYNORGjbOSehqrXsHwd/5FSX/AK+3/wDQVrow2VqE2+b8D0sv4fjhqvMp307f8E//2Q=='
   Local $bString = _WinAPI_Base64Decode($Base64String)
   If @error Then Return SetError(1, 0, 0)
   $bString = Binary($bString)
   Return $bString
EndFunc   ;==>_green_jpg

Func _green_gif()
   Local $Base64String
   $Base64String &= 'R0lGODdhLAEZAPcAAA+mLHyahATNLnzahETNVbTZrnSbfXzuhgS4IiTNRETjW5zsoSS3PbTys2Tma9Txzny6dCTcQgbWKwTEJ5y5n5z3o0y1XIH2i5zSnGTLbLT8siSkNGS6XBS4K5zEmVTlZRTNMzTdS2TucQWuG6TgpETYW4zslDTMUcT7vxTXM5z2rCTEQxSsMKztsUTBVxTFMqzEqAW+JHTjf1TqZIz2lNT616TXoGTabDTiTgXSKHzhh8T1vZTDkVTYZRTeNoTtl6TqtGTGbBTNPCTVRFS0XRy4PUzqYuTu3CviR8T9zIzelAS4LJzypGTqbNzx3oy4j6y+rJzKngSyIjTWTKz5sXTZfbTktILyizS7TATENKS+maz+pLz+xSSxOXS+dZTyrBTXPDTGTAzNMlTKZEzkYCTdTBS+K3TvgKzgn4zykhSyKI/+nH/mgp/+oazRrKTCnFzlaTTdVETeWBTCPFTqbMz0xym+Sbz8uqzKqSzV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dZwPdd0rQNwbdckndd6'
   $Base64String &= 'rU8kbdIlrU8o3QwiPdiBzdd+3QyIXdILJdjxtNgy0Nj7wNgiHdmPjdiUYNmYDU+ZfdmardnytNiRjdjNQAyjTQymzQ3cwFHmUA8uIA8uQAhewA9HIAh7sAeXUDtP8ASLsAh08RRR4AG/HQXCDQPCXRGZcNzIzQn/sNz/MAvObQXQHd2lYAWlMN3VHQ/THd3abQWOwN2ObVAA4F0AbjDe5I0H5o0HCJHeCrHepUEanfHe8G0YiRHf9C3fhkEBt0AB+m0KpqAH/i0IpxAAAWAAAz7gBG4ACI7gBm7gCd7gDv7gEB7hEj7hEL7gCn7hB57hFq7hGL7hHk7hFG7gp2AAeuAEAQEAOw=='
   Local $bString = _WinAPI_Base64Decode($Base64String)
   If @error Then Return SetError(1, 0, 0)
   $bString = Binary($bString)
   Return $bString
   EndFunc   ;==>_green_gif

Func _WinAPI_Base64Decode($sB64String)
   Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
   If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
   Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
   $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
   If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
   Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode
 
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
Avatar du membre
toto1515
Niveau 3
Niveau 3
Messages : 35
Enregistré le : mer. 08 déc. 2010 17:18
Localisation : Corse
Status : Hors ligne

Re: Aide concernant _GDIPlus_GraphicsDrawImage

#3

Message par toto1515 »

Bonjour,
j'ai testé votre code et ça fonctionne.
Il y a une différence ente le Base64String de la fonction _green_jpg() de votre code et le mien.
Par contre, le Base64String de la fonction _green_gif() est bien le même.
Pourriez-vous me dire comment vous avez obtenu la valeur du Base64String de la fonction _green_jpg()
Merci.
Autoit 3.3.14.5 - Scite 4.2.0 - Windows 8
Avatar du membre
mikell
Modérateur
Modérateur
Messages : 6087
Enregistré le : dim. 29 mai 2011 17:32
Localisation : Deep Cévennes
Status : Hors ligne

Re: Aide concernant _GDIPlus_GraphicsDrawImage

#4

Message par mikell »

toto1515 a écrit : mar. 16 févr. 2021 09:47Pourriez-vous me dire comment vous avez obtenu la valeur du Base64String de la fonction _green_jpg()
Rien de particulier... ouvert le fichier 'green.jpg' dans le programme de UEZ, cliqué sur le bouton de conversion en laissant les réglages par défaut, puis j'ai sélectionné dans l'edit juste la partie $Base64String et copié/collé dans votre code
" L'échec est le fondement de la réussite. " (Lao-Tseu )
" Plus ça rate, plus on a de chances que ça marche " (les Shadoks )
Avatar du membre
toto1515
Niveau 3
Niveau 3
Messages : 35
Enregistré le : mer. 08 déc. 2010 17:18
Localisation : Corse
Status : Hors ligne

Re: Aide concernant _GDIPlus_GraphicsDrawImage

#5

Message par toto1515 »

Très étrange....
J'ai re-testé avec mon fichier 'green.jpg' dans le programme de UEZ et j'ai encore obtenu un résultat différent du votre.
Ensuite, j'ai téléchargé le fichier green.jpg à partir de mon post. J'ai refait la manip et là, je trouve la même chose que vous.
Je n'y comprends rien, mais ça fonctionne.
Donc résolu.
Merci.
Autoit 3.3.14.5 - Scite 4.2.0 - Windows 8
Répondre