AutoIt: Писане на текст върху снимка

Публикувано: 13.07.16, 22:30:04 | Автор: ArMeN | Видяна: 204 | Редактирано: 19.07.16, 21:05:13

#Include <GDIPlus.au3>

$sText = 'Text'

$iLeft = 200
$iTop = 200

$xColor = 0xFFFFD823
$iFontSize = 24
$iFontStyle = 0

_GDIPlus_Startup()
$hFamily = _GDIPlus_FontFamilyCreate('Arial')
$hFont = _GDIPlus_FontCreate($hFamily, $iFontSize, $iFontStyle)
$hFormat = _GDIPlus_StringFormatCreate()


$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\base.jpg')
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
$tLayout = _GDIPlus_RectFCreate($iLeft, $iTop)
$hBrush = _GDIPlus_BrushCreateSolid($xColor)
$aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sText, $hFont, $tLayout, $hFormat)

_GDIPlus_GraphicsDrawStringEx($hGraphic, $sText, $hFont, $aInfo[0], $hFormat, $hBrush)
_GDIPlus_ImageSaveToFileEx($hImage, @ScriptDir & '\new.jpg', _GDIPlus_EncodersGetCLSID ('JPG'))
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImage )

_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_Shutdown()

Не сте влезли в акаунта си за да коментирате.


 

Няма коментари.