Sag' mal, benutzt du Google Translator?
Gruß,
UEZ
Sag' mal, benutzt du Google Translator?
Gruß,
UEZ
Kannst ja mal hier reinschauen: http://www.autoitscript.com/forum/index.php?showtopic=120384
Gruß,
UEZ
Eine andere Möglichkeit ist Adlib:
#include <File.au3>
#include <Array.au3>
#include <GUIConstants.au3>
$pic = 0
$width = 375
$height = 354
$time = 3000
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", $width,$height, 223, 148)
$Slider1 = GUICtrlCreateSlider(70,310,209,40)
GUICtrlSetLimit($slider1, 18000,3000)
GUICtrlSetData($slider1, $time)
$stop = GUICtrlCreateButton("Stop",340,315)
$Start = GUICtrlCreateButton("Start",300,315)
GUISetBkColor(0xA6CAF0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$height -= 50
$path = "..\Images\"
$pics = _FileListToArray($path,"*.jpg",1)
While 1
[/autoit] [autoit][/autoit] [autoit]$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
AdlibUnRegister("Diashow")
Exit
Case $nMsg = $stop
AdlibUnRegister("Diashow")
Case $nMsg = $start
$time = GUICtrlRead($Slider1)
AdlibRegister("Diashow", $time)
Case $nMsg = $Slider1
$time = GUICtrlRead($Slider1)
AdlibUnRegister("Diashow")
AdlibRegister("Diashow", $time)
ConsoleWrite($time & @CRLF)
EndSelect
WEnd
Func Diashow()
GUICtrlDelete($pic)
$bild = Random(1,$pics[0],1)
;ConsoleWrite($pics[1])
;ConsoleWrite($bild)
$i = $bild
$pic = GUICtrlCreatePic ( $path & $pics[$i], 1, 1,$width,$height)
EndFunc
Gruß,
UEZ
Bei mir wird das Rechteck irgendwo plaziert. Abgesehen davon, kann ich da mal schauen, ob ich die bei den GDI+ Sachen helfen kann!
Gruß,
UEZ
Das Problem ist nicht GDI+, sondern die Berechnung der Koodinate für das Rechteck. Natürlich kann man auch noch zusätzlich GDI+ optimieren, aber zunächst sollte die Berechnung klappen.
Da ich so gut wie nie mit den IE.au3 gearbeitet habe, weiß ich nicht, wie man vernünftig die Position berechnet, denn bei mir wird das Rechteck irgendwo platziert.
Gruß,
UEZ
Ich habe auch aus der Idee eine UDF gebastelt.
Vielleicht nützt es ja jemanden...
Den Pfad im Beispiel 1 zur Bitmap Datei muss noch manuell angepasst werden.
Umgezogen: Write Text on Bitmap v0.90 Build 2011-03-23 Beta
Gruß,
UEZ
Ich weiß und du bist "voll" dabei. ![]()
Gruß,
UEZ
Habe noch ein paar kleine Effekte hinzugefügt (siehe Post#1). ![]()
Gruß,
UEZ
Bei mir geht's!
Check mal den Pfad zu den Bildern!
Gruß,
UEZ
So müsste es rein theoretisch gehen:
#include <GuiConstants.au3>
#include <GdiPlus.au3>;das include
#include <Misc.au3>
OnAutoItExitRegister("_end") ; die Funktion _end am Ende des Scriptes ausführen
[/autoit] [autoit][/autoit] [autoit]$x = 0; Poition von Bild auf X-Achse
$y = 0; Poition von Bild auf Y-Achse
$Gui = GUICreate("Beispiel", 179, 163, 100, 100); GUI erstellen
GUISetState(@SW_SHOW); Anzeigen
_GDIPlus_Startup() ;Gdi starten
[/autoit] [autoit][/autoit] [autoit]$figur = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\tux.jpg"); Meine Bild reinladen
$background = _GDIPlus_ImageLoadFromFile(@ScriptDIr & "\al.png")
$height = _GDIPlus_ImageGetHeight($figur); Größe meines Bildes ermitteln (Höhe)
$width = _GDIPlus_ImageGetWidth($figur); Größe meines Bildes ermitteln (Breite)
$verhaelnis = $height / $width; Verhältnis ausrechen, damit kleiner
$graphic = _GDIPlus_GraphicsCreateFromHWND($Gui); Object um drauf zu malen
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphic) ;erstelle Bitmap von der Grafik
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) ;erstelle Grafik Kontext von der Bitmap (dient für die Doppeltbufferung der Grafik, damit die Bewegungen flüssiger aussehen
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2) ; da
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE ; Event CLose
Exit
EndSwitch
[/autoit] [autoit][/autoit] [autoit]Select
Case _IsPressed(25); Links pfeiltaste änder die koordinaten so, dass bild sich nach links bewegt!
$x -= 1
Case _IsPressed(26); Oben pfeiltaste änder die koordinaten so, dass bild sich nach oben bewegt!
$y -= 1
Case _IsPressed(27); Rechts pfeiltaste änder die koordinaten so, dass bild sich nach rechts bewegt!
$x += 1
Case _IsPressed(28); Runter pfeiltaste änder die koordinaten so, dass bild sich nach unten bewegt!
$y += 1
EndSelect
_GDIPlus_GraphicsDrawImageRect($backbuffer,$background,0,0,179,163)
_GDIPlus_GraphicsDrawImageRect($backbuffer, $figur, $x, $y, 20,20 * $verhaelnis) ;die Figur wird an der neuen Position gezeichnet
;($graphic = Unser Hintergrund also Wodrauf er neuzeichnen soll)
;($figur= Was er neuzeichnen soll also unser Bild!)
;($x= Die veränderte X Koordinate)
;($y= Die veränderte Y Koordinate)
;(20 = Die Größe(Weite!) )
;(20 *$verhaelnis = Die größe(Höhe))
_GDIPlus_GraphicsDrawImageRect($graphic, $bitmap, 0, 0, 179,163)
WEnd
Func _end();die Exit funktion
_GDIPlus_GraphicsDispose($graphic);Grafik Objekt freigeben
_GDIPlus_ImageDispose($figur);Bild Objekt freigeben
; _GDIPlus_GraphicsDispose($backbuffer)
; _GDIPlus_BitmapDispose($bitmap)
_GDIPlus_ImageDispose($background);Bild Objekt freigeben
_GDIPlus_Shutdown();Ressourcen freigeben
EndFunc ;==>_end
Gruß,
UEZ
Bitte sehr!
#include <String.au3>
$zahlen = ""
$zahl = 2047
$t = TimerInit()
$len = StringLen(Integer2Binary($zahl, 0))
For $i = 0 To $zahl
$zahlen &= Integer2Binary($i, $len) & @CRLF
Next
ConsoleWrite("Laufzeit: " & Round(TimerDiff($t), 2) & " ms." & @CRLF)
$hFile = FileOpen("Zählen.txt", 2)
FileWrite($hFile, $zahlen)
FileClose($hFile)
Exit
Func Integer2Binary($int, $stellen = 11)
Local $bin, $null
If Not IsFloat($int) And Not IsString($int) And $int >= 0 Then
While $int >0
$bin &= Mod($int, 2)
$int = Floor($int / 2)
WEnd
SetError(0)
For $i = 1 To $stellen - StringLen($bin)
$null &= 0
Next
Return($null & _StringReverse($bin))
Else
SetError(1)
Return "Error"
EndIf
EndFunc
Gruß,
UEZ
Ineluki, dein Script funzt soweit.
UEZ, dein Beispiel ist perfekt. Voralledingen die Fontgröße und Positionierung.
Hab aber jetzt mal eine Frage dazu. Braucht man die GUI dazu überhaupt?
Irgendwie kapiere ich nicht für was ein Bitmap von der GUI ertstellt werden muß.
Kann man das nicht direkt machen?
Kannst ja daraus eine Funktion basteln ![]()
;Fast hack by UEZ 2010 ![]()
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
_GDIPlus_Startup()
Local $hBild = _GDIPlus_ImageLoadFromFile("Button1.bmp")
Local $iX = _GDIPlus_ImageGetWidth($hBild)
Local $iY = _GDIPlus_ImageGetHeight($hBild)
Local $text = "Beispieltext"
[/autoit] [autoit][/autoit] [autoit]Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iX, $iY)
Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
Local $hPinsel = _GDIPlus_BrushCreateSolid (0xFFFFFFFF)
Local $hFormat = _GDIPlus_StringFormatCreate ()
Local $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
Local $font_size = Floor(($iX - StringLen($text)) / 10)
Local $hFont = _GDIPlus_FontCreate ($hFamily, $font_size, 0)
Local $tLayout = _GDIPlus_RectFCreate (0, 0, 0, 0)
Local $aInfo = _GDIPlus_GraphicsMeasureString ($hContext, $text, $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDrawImageRect($hContext, $hBild, 0, 0, $iX, $iY)
[/autoit] [autoit][/autoit] [autoit]Local $fWidth = DllStructGetData($aInfo[0], "Width")
Local $fHeight = DllStructGetData($aInfo[0], "Height")
DllStructSetData($tLayout, "x", $iX / 2 - Round($fWidth / 2, 0))
DllStructSetData($tLayout, "y", $iY / 2 - Round($fHeight / 2, 0) - 2)
_GDIPlus_GraphicsDrawStringEx ($hContext, $text, $hFont, $tLayout, $hFormat, $hPinsel)
[/autoit] [autoit][/autoit] [autoit]_Exit()
[/autoit] [autoit][/autoit] [autoit]Func _Exit()
_GDIPlus_ImageSaveToFile($hBitmap, "Button1+.bmp")
_GDIPlus_ImageDispose($hBild)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hPinsel)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_Shutdown()
Exit
EndFunc
Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = 0x0026200A, $pScan0 = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
Return $aResult[6]
EndFunc
Gruß,
UEZ
Meinst du so was?
;Fast hack by UEZ 2010 ![]()
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
_GDIPlus_Startup()
Local $hBild = _GDIPlus_ImageLoadFromFile("Button1.bmp")
Local $iX = _GDIPlus_ImageGetWidth($hBild)
Local $iY = _GDIPlus_ImageGetHeight($hBild)
Local $hGUI = GUICreate("GDI+ Raupi", $iX, $iY)
GUISetState()
Local $text = "Beispieltext"
[/autoit] [autoit][/autoit] [autoit]Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphic)
Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
Local $hPinsel = _GDIPlus_BrushCreateSolid (0xFFFFFFFF)
Local $hFormat = _GDIPlus_StringFormatCreate ()
Local $hFamily = _GDIPlus_FontFamilyCreate ("Arial")
Local $font_size = Floor(($iX - StringLen($text)) / 10)
Local $hFont = _GDIPlus_FontCreate ($hFamily, $font_size, 0)
Local $tLayout = _GDIPlus_RectFCreate (0, 0, 0, 0)
Local $aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $text, $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDrawImageRect($hContext, $hBild, 0, 0, $iX, $iY)
[/autoit] [autoit][/autoit] [autoit]Local $fWidth = Floor(DllStructGetData($aInfo[0], "Width"))
Local $fHeight = Floor(DllStructGetData($aInfo[0], "Height"))
DllStructSetData($tLayout, "x", $iX / 2 - $fWidth / 2)
DllStructSetData($tLayout, "y", $iY / 2 - $fHeight / 2 - 2)
_GDIPlus_GraphicsDrawStringEx ($hContext, $text, $hFont, $tLayout, $hFormat, $hPinsel)
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iX, $iY)
[/autoit] [autoit][/autoit] [autoit]GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
[/autoit] [autoit][/autoit] [autoit]While Sleep(1000)
WEnd
Func _Exit()
_GDIPlus_ImageSaveToFile($hBitmap, "Button1+.bmp")
_GDIPlus_ImageDispose($hBild)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hPinsel)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
EndFunc
Gruß,
UEZ
Hier meine Version:
[autoit]
#Include <String.au3>
$soll = "ÿÿÿÿÿÿÿÿÿÿinfo0.5.1 unnamed server dm1 DM 0 -1 0 8 "
$binray = "0xFFFFFFFFFFFFFFFFFFFF696E666F302E352E3100756E6E616D65642073657276657200646D3100444D0030002D310030003800"
$filter = "0x" & _StringReverse(StringRegExpReplace(_StringReverse(StringMid($binray, 3)), "(?i)(00)", "02"))
$ist = BinaryToString($filter)
;~ $read = FileRead("info.txt")
;~ MsgBox(0,"Sollte/Ist-Vergleich","ÿÿÿÿÿÿÿÿÿÿinfo0.5.1 unnamed server dm1 DM 0 -1 0 8 " & @CRLF & $read)
MsgBox(0,"Sollte/Ist-Vergleich", $soll & @CRLF & $ist)
Gruß,
UEZ
#include <GDIPlus.au3>
_GDIPlus_Startup()
$Datei = FileOpenDialog("Bitte ein Bild aussuchen", "", "Bilder (*.jpg;*.png;*.bmp)")
If @error Then Exit
$Bild = _GDIPlus_ImageLoadFromFile($Datei)
$iX = _GDIPlus_ImageGetWidth($Bild)
$iY = _GDIPlus_ImageGetHeight($Bild)
_GDIPlus_ImageDispose($Bild)
_GDIPlus_ShutDown()
MsgBox(0, "Bild Auflösung", $Datei & " hat eine Auflösung von :" & @CRLF & @CRLF & $iX & " x " & $iY & " Pixel.")
Exit
Gruß,
UEZ
Es gibt kein Copyright auf meine veröffentlichten Source Codes. Jeder darf die Sources verwenden und auch modifizieren, nur würde ich gerne in den Credits auftauchen. ![]()
Gruß,
UEZ
Schade, dass es nur sehr wenig Feedback gibt. ![]()
Nach meiner Meinung ist das, was hier von eukalyptus geboten wird, GDI+ Coding Crème de la Crème - absolut top! ![]()
Gruß,
UEZ
Ich habe jetzt den Code aktualisiert u.a. mit dem Vorschlag von eukalyptus! Ihr könnt ja mal testen, ob diese Version unter Windows XP besser läuft!
Natürlich liegt es in der Natur von AutoIt ab einer bestimmten Anzahl von Pixel langsamer zu laufen (abhängig von der CPU)...
Ich persönlich habe keinen Unterschied auf Vista x32 gesehen, aber wenn diese Version "flüssiger" unter WinXP läuft, dann um so besser!
Vielen Dank für die Kommentare!
Gruß,
UEZ
SplashTextOn("Test", "Hallo" & @CRLF & "Du" & @CRLF & "Da!", 70, 90, -1, -1, 1 + 32)
Sleep(5000)
[/autoit][autoit][/autoit][autoit]SplashOff()
[/autoit]Gruß,
UEZ
Ich glaube, du suchst so was:
[autoit]
ProgressOn("Progress Meter", "", "", -1, -1, 1 + 16)
For $i = 10 to 100 step 10
Sleep(1000)
ProgressSet( $i, "")
Next
Sleep(500)
ProgressOff()
Gruß,
UEZ