Nous sommes tous dans l'époque où les internautes volent les images.
Maintenant, avec Copyrighter, vous pourrez choisir vos images et les Copyrighter.
Sans plus, voici le code :
► Afficher le textecode
Code : Tout sélectionner
#include <GDIPlus.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Dim $img = ""
$Form1 = GUICreate("Copyrighter une image", 399, 121, 192, 124)
$Label1 = GUICtrlCreateLabel("Mon image :", 24, 24, 66, 17)
$Input1 = GUICtrlCreateInput("", 88, 24, 209, 21)
$Button1 = GUICtrlCreateButton("..", 304, 24, 19, 17, $WS_GROUP)
$Label2 = GUICtrlCreateLabel("Mon texte :", 24, 56, 57, 17)
$Input2 = GUICtrlCreateInput("", 88, 56, 257, 21)
$Button2 = GUICtrlCreateButton("Copyrighter", 136, 88, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$img = FileOpenDialog("Choisir l'image à copyrighter", @MyDocumentsDir, "(*.*)")
GUICtrlSetData($Input1, $img)
Case $Button2
If $img <> '' And GUICtrlRead($Input2) <> "" Then
$dir = FileSaveDialog("Enregistrer le fichier", @MyDocumentsDir, "(*.png)")
$societe = Inputbox("Copyrighter", "Quel est le nom de votre société ?")
_CreateCopyright_Image($img, $dir, GUICtrlRead($Input2) & "© Marque déposée par " & $societe)
Run('MSPaint.exe ' & @TempDir & '\apercu.png')
Sleep(10000) ;dix secondes
$mMsgbox = MsgBox(4, "Copyright", "Cela vous plaît ?")
If $mMsgbox = 6 Then
Msgbox(0, "Copyright", "Voici le chemin de l'image copyrighté :" & $dir)
Else
GUICtrlSetData($Input1, "")
GUICtrlSetData($Input2, "")
EndIf
Else
MsgBox(0 + 16 + 524288, "Erreur", "Un ou des champs n'est ou ne sont pas remplis")
EndIf
EndSwitch
WEnd
Global $hBitmap, $hImage, $hGraphic, $hFamily, $hFont, $tLayout, $hFormat, $aInfo, $hBrush1, $hBrush2, $iWidth, $iHeight, $hPen
Func _CreateCopyright_Image($img, $dir, $sString)
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile($img)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 16, 1)
$tLayout = _GDIPlus_RectFCreate(0, 0)
$hFormat = _GDIPlus_StringFormatCreate(2)
$hBrush1 = _GDIPlus_BrushCreateSolid(0xA2FFFFFF)
$hBrush2 = _GDIPlus_BrushCreateSolid(0xC4FF0000)
$hPen = _GDIPlus_PenCreate(0xC4000000, 2)
$aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat)
$iWidth = DllStructGetData($aInfo[0], "Width")
$iHeight = DllStructGetData($aInfo[0], "Height")
_GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrush1)
_GDIPlus_GraphicsDrawRect($hGraphic, 1, 1, $iWidth, $iHeight, $hPen)
_GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush2)
_GDIPlus_ImageSaveToFile($hImage, $dir)
_GDIPlus_ImageSaveToFile($hImage, @TempDir & '\apercu.png')
_GDIPlus_PenDispose($hPen)
_GDIPlus_BrushDispose($hBrush1)
_GDIPlus_BrushDispose($hBrush2)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
EndFunc ;==>_CreateCopyright_Image
► Afficher le texteimage

AutoIt3\Examples\GUI\Advanced\Emboss.au3
Alors ne me félicitez pas.
Je remercie Ricky qui à repéré les fautes (pas d'orthographe)^^