Image Writer 1.0

« Older   Newer »
  Share  
-Anubi-
icon10  CAT_IMG Posted on 26/3/2010, 14:30     +1   -1




SPOILER (click to view)
#NoTrayIcon
#include <gdiplus.au3>


Opt("MustDeclareVars", 1)


Global $hBitmap, $hImage, $hGraphic, $hFamily, $hFont, $tLayout, $hFormat, $aInfo, $hBrush1, $hBrush2, $iWidth, $iHeight, $hPen, $aerwe
Global $sString=InputBox ( "Write the text", "", " " )
if $sString = "" Then
Exit
EndIf


_GDIPlus_StartUp()


$hBitmap = FileOpenDialog ( "Chose the image to write-on", @DocumentsCommonDir, "All (*.*)" )


$hImage = _GDIPlus_ImageLoadFromFile($hBitmap)
$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, FileSaveDialog ("Chose the image name", @WorkingDir, "All (*.*)") )

_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()


Scrive del testo su di un'immagine
 
Top
ACIDBURN16
CAT_IMG Posted on 26/3/2010, 16:06     +1   -1




si carino questo :P bravo :)
 
Top
-Anubi-
CAT_IMG Posted on 26/3/2010, 17:04     +1   -1




Grazie
 
Top
2 replies since 26/3/2010, 14:30   132 views
  Share