Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Problem Gdi ++ uses much RAM

$
0
0

LOOK

 

 

http://www.youtube.com/watch?v=khUZIy22idg

AutoIt         
#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> Global $_Gui[30], $fontsiz = 32, $txtsiz = 222, $nexttmp, $b, $Search, _         $shadow, $next, $i, $Opas = 40, $String = Getext(), $picp = Getjpg() For $i = 1 To 15     _GDIPlus_Startup()     spic(randpic(), randtxt())     Sleep(999)     DelGui()     _GDIPlus_Shutdown() Next exitt() Func Getext()     Local $OPENEtx, $Read, $CHARS, $Zz, $txtphat     $txtphat = @ScriptDir & "\data\data.txt"     If FileExists($txtphat) = 0 Then Exit     $OPENEtx = FileOpen($txtphat, 0)     If @error Then Exit     $Read = FileRead($OPENEtx)     FileClose($OPENEtx)     Local $CHARS = StringReplace(StringRegExpReplace($Read, "\r\n|\r|\n", Chr(32)), '"', "'")     For $i = 1 To StringLen($CHARS) Step 1         If StringMid($CHARS, $i, 1) = Chr(32) And StringMid($CHARS, $i - 1, 1) = Chr(32) Then ContinueLoop         $Zz &= StringMid($CHARS, $i, 1)     Next     Return StringReplace($Zz, "*", @CRLF) EndFunc   ;==>Getext Func Getjpg()     Local $jpg[30], $file, $Search     $Search = FileFindFirstFile(@ScriptDir & "\data\*.jpg")     If $Search = -1 Then Exit     For $i = 1 To 29         $file = FileFindNextFile($Search)         If @error Then ExitLoop         $jpg[$i] = $file     Next     $jpg[0] = $i - 1     FileClose($Search)     Return $jpg EndFunc   ;==>Getjpg Func randpic()     Local $random     If $picp[0] = 1 Then         $random = 1     Else         $random = Random(1, $picp[0], 1)     EndIf     Return @ScriptDir & "\data\" & $picp[$random] EndFunc   ;==>randpic Func randtxt()     Local $random, $arr     $arr = StringSplit($String, "|", 1)     If @error Then Return $String     $random = Random(1, $arr[0], 1)     Return $arr[$random] EndFunc   ;==>randtxt Func spic($_PngPath, $text)     $i = 0     Local $_Image, $_Width, $_Height, $_Ratio, $trans, $DesktopWidth = @DesktopWidth, _             $pWidth = Round($DesktopWidth / 3, 0)     $_Image = _GDIPlus_ImageLoadFromFile($_PngPath)     $_Width = _GDIPlus_ImageGetWidth($_Image)     $_Height = _GDIPlus_ImageGetHeight($_Image)     $_Ratio = $_Width / $_Height     Switch $_Ratio         Case 0 To 0.8             $txtsiz = 550         Case 0.8 To 1             $txtsiz = 450         Case 1 To 1.6             $txtsiz = 250         Case 1.6 To 2             $txtsiz = 180     EndSwitch     For $_Width = $DesktopWidth / 6 To $pWidth Step 25         $i += 1         $_Gui[$i] = GUICreate("", $_Width, $_Width / $_Ratio, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))         $_Image = _ImageResize($_PngPath, $_Width, $_Width / $_Ratio)         $trans = Round(Round($_Width, 0) * $Opas / $pWidth, 0)         _SetBitmap($_Gui[$i], $_Image, $trans, $_Width, $_Width / $_Ratio)         GUISetState(@SW_SHOW)         Sleep(22)     Next     Opt("GUIONEVENTMODE", 1)     $chil = GUICreate("", $DesktopWidth / 3, $_Width / $_Ratio, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $_Gui[$i])     GUISetBkColor(0x222222)     GUICtrlCreatePic(@ScriptDir & "\data\grey.gif", 0, 0, $DesktopWidth / 3, $_Width / $_Ratio)     GUICtrlSetState(-1, $GUI_DISABLE)     $b = addlab("...تكملة", 25, $_Width / $_Ratio - 110, $DesktopWidth / 3 - 25, 300, "", "DecoType Naskh Variants", 44, 800)     GUICtrlSetOnEvent($b, "nex")     GUICtrlSetState($b, $GUI_hide)     $exit = addbot("X", $_Width - 20, 5, 15, 15, "0xFFFFFF", "0x448CAF")     GUICtrlSetOnEvent($exit, "DelGui")     $shadow = addlab("", 2, 15, $DesktopWidth / 3 - 18, $_Width / $_Ratio - 85, $SS_CENTER, "DecoType Naskh Variants", $fontsiz, 400, "")     $Search = addlab("", 0, 13, $DesktopWidth / 3 - 16, $_Width / $_Ratio - 85, $SS_CENTER, "DecoType Naskh Variants", $fontsiz, 400)     strinsiz($text)     GUISetState()     _GDIPlus_GraphicsDispose($_Image) EndFunc   ;==>spic Func addlab($txxt, $w, $h, $wp, $hp, $sty, $font, $fsiz, $fg, $col = 0xF1F1F1)     Local $clab     $clab = GUICtrlCreateLabel($txxt, $w, $h, $wp, $hp, $sty)     GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)     GUICtrlSetFont(-1, $fsiz, $fg, 0, $font)     GUICtrlSetColor(-1, $col)     Return $clab EndFunc   ;==>addlab Func addbot($txxt, $w, $h, $wp, $hp, $bcol, $col)     Local $cbou     $cbou = GUICtrlCreateButton($txxt, $w, $h, $wp, $hp)     GUICtrlSetBkColor(-1, $bcol)     GUICtrlSetColor(-1, $col)     Return $cbou EndFunc   ;==>addbot Func DelGui()     For $s = $i To 1 Step -1         Sleep(29)         GUIDelete($_Gui[$s])     Next EndFunc   ;==>DelGui Func exitt()     Exit EndFunc   ;==>exitt Func nex()     strinsiz($nexttmp) EndFunc   ;==>nex Func strinsiz($txto)     Local $STEXT1, $TXT     $STEXT1 = StringSplit($txto, Chr(32), 1)     For $O = 1 To $STEXT1[0]         $TXT &= $STEXT1[$O] & Chr(32)         If StringLen($TXT) > $txtsiz Then             GUICtrlSetState($b, $GUI_show)             GUICtrlSetData($Search, $TXT)             GUICtrlSetData($shadow, $TXT)             $next = 1             $nexttmp = StringTrimLeft($txto, StringLen($TXT))             ExitLoop         ElseIf $O = $STEXT1[0] Then             If $next = 1 Then                 GUICtrlSetState($b, $GUI_hide)                 $next = 0             EndIf             GUICtrlSetData($Search, $TXT)             GUICtrlSetData($shadow, $TXT)         EndIf     Next EndFunc   ;==>strinsiz Func _SetBitmap($hGUI, $hImage, $iOpacity, $n_width, $n_height)     Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend     $hScrDC = _WinAPI_GetDC(0)     $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)     $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)     $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)     $tSize = DllStructCreate($tagSIZE)     $pSize = DllStructGetPtr($tSize)     DllStructSetData($tSize, "X", $n_width)     DllStructSetData($tSize, "Y", $n_height)     $tSource = DllStructCreate($tagPOINT)     $pSource = DllStructGetPtr($tSource)     $tBlend = DllStructCreate($tagBLENDFUNCTION)     $pBlend = DllStructGetPtr($tBlend)     DllStructSetData($tBlend, "Alpha", $iOpacity)     DllStructSetData($tBlend, "Format", 1)     _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)     _WinAPI_ReleaseDC(0, $hScrDC)     _WinAPI_SelectObject($hMemDC, $hOld)     _WinAPI_DeleteObject($hBitmap)     _WinAPI_DeleteDC($hMemDC) EndFunc   ;==>_SetBitmap Func _ImageResize($sInImage, $newW, $newH, $sOutImage = "")     Local $oldImage, $GC, $newBmp, $newGC     If $sOutImage = "" Then _GDIPlus_Startup()     $oldImage = _GDIPlus_ImageLoadFromFile($sInImage)     $GC = _GDIPlus_ImageGetGraphicsContext($oldImage)     $newBmp = _GDIPlus_BitmapCreateFromGraphics($newW, $newH, $GC)     $newGC = _GDIPlus_ImageGetGraphicsContext($newBmp)     _GDIPlus_GraphicsDrawImageRect($newGC, $oldImage, 0, 0, $newW, $newH)     _GDIPlus_GraphicsDispose($GC)     _GDIPlus_GraphicsDispose($newGC)     _GDIPlus_ImageDispose($oldImage)     Return $newBmp EndFunc   ;==>_ImageResize

Download ful pack : http://www.mediafire.com/?9vzknf0ep281177


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>