Noch'n Update: jetzt mit Video Aufzeichnungsfunktion (AVI noch unkomprimiert) + Lineal Funktion zum Messen von Distanzen.
Gruß,
UEZ
Noch'n Update: jetzt mit Video Aufzeichnungsfunktion (AVI noch unkomprimiert) + Lineal Funktion zum Messen von Distanzen.
Gruß,
UEZ
Noch'n Update: jetzt mit Video Aufzeichnungsfunktion (AVI noch unkomprimiert) + Lineal Funktion zum Messen von Distanzen.
Gruß,
UEZ
Wenn dann eher so:
[autoit]
If $instr = $inval1 Then
GUICtrlSetBkColor($inv1, 0x00a800)
Run($pro1)
EndIf
Was soll der Text am Ende sein?
Gruß,
UEZ
Hast recht, kommt wohl aus dem Englischen -> EXEs...
Apropos Exen, die muss ich noch hochladen...
Danke,
UEZ
Kleines Update!
Gruß,
UEZ
Für den GUIOnEvent-Mode benötigst du Funktionen, die von den Buttons angesprochen werden, wenn sie betätigt werden.
Beispiel:
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Dim $buttons[11]
[/autoit] [autoit][/autoit] [autoit]GUICreate("Test", 100, 400)
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To 10
$buttons[$i] = GUICtrlCreateButton("Button " & $i, 10, 10 + $i * 30)
GUICtrlSetOnEvent($buttons[$i], "B" & $i)
Next
GUISetState()
[/autoit] [autoit][/autoit] [autoit]GUISetOnEvent($GUI_EVENT_CLOSE, "_beenden")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While 1
Sleep(10)
WEnd
Func B1()
MsgBox(0, "Test", "Button1")
EndFunc
Func B2()
MsgBox(0, "Test", "Button2")
EndFunc
Func B3()
MsgBox(0, "Test", "Button3")
EndFunc
Func B4()
MsgBox(0, "Test", "Button4")
EndFunc
Func B5()
MsgBox(0, "Test", "Button5")
EndFunc
Func B6()
MsgBox(0, "Test", "Button6")
EndFunc
Func B7()
MsgBox(0, "Test", "Button7")
EndFunc
Func B8()
MsgBox(0, "Test", "Button8")
EndFunc
Func B9()
MsgBox(0, "Test", "Button9")
EndFunc
Func B10()
MsgBox(0, "Test", "Button10")
EndFunc
Func _beenden()
Exit
EndFunc ;==>_beenden
Dies war meine erste Idee, vielleicht gibt es elegantere Lösungen!
Gruß,
UEZ
andygo: das ist nicht das gleiche Freihandmarkieren! ![]()
Gruß,
UEZ
Schaue mal hier rein: AutoIt Windows Screenshooter v1.29 Build 2011-08-16 Final
Ich benutze keinerlei DLLs!
Wenn ich Zeit finde, werde ich noch das Freihand Markieren des Desktop Bereiches implementieren.
Gruß,
UEZ
Nette Idee mit den Farben!
Danke und Gruß,
UEZ
Nette Idee! ![]()
Übrigens: das nennt sich Halftone bzw. auf Deutsch Druckraster: -> http://de.wikipedia.org/wiki/Druckraster
Appropos Halftone (lag bei mir so rum):
#AutoIt3Wrapper_Compile_both=y
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UPX_Parameters=--brute --crp-ms=999999 --all-methods --all-filters
#AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Opt("GuiOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global Const $width = @DesktopWidth * 0.25
Global Const $height = @DesktopHeight * 0.25
Global Const $GUI_title = "GDI+ Halftone by UEZ 2011"
Global Const $hGui = GUICreate($GUI_title, $width, $height)
_GDIPlus_Startup()
Global $hBMP = _WinAPI_CreateBitmap($width, $height)
Global $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP)
Global $hHBITMAP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
Global $hDC = _WinAPI_GetDC($hGUI)
Global $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC)
Global $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBITMAP)
Global $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer)
Global Const $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
Global Const $hBrush_Clear = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
GUISetState()
Global $i, $t, $tt, $x, $y, $ii, $distx, $disty, $d, $r
Global Const $SRCCOPY = 0x00CC0020
Global Const $circles = 3
Global $s = 16 ;spacing between dots
Global $aCircles[$circles][5] ; x, y, dx, dy, m
For $i = 0 To UBound($aCircles) - 1
$aCircles[$i][0] = Random(0, 1) ;x -> x position
$aCircles[$i][1] = Random(0, 1) ;y -> y position
$aCircles[$i][2] = Random(0, 1) * 0.03 ;dx -> speed x vector
$aCircles[$i][3] = Random(0, 1) * 0.03 ;dy -> speed y vector
$aCircles[$i][4] = Random(0.08, 0.25) ;m -> mass
Next
GUISetOnEvent(-3, "_Exit")
[/autoit] [autoit][/autoit] [autoit]Global $fps = 0
AdlibRegister("FPS", 1000)
Do
_WinAPI_BitBlt($hDC, 0, 0, $width, $height, $hDC_backbuffer, 0, 0, $SRCCOPY)
;~ $t = TimerInit()
_GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $width, $height, $hBrush_Clear)
For $i = 0 To $circles - 1 ;move mass centers
$aCircles[$i][0] += $aCircles[$i][2]
$aCircles[$i][1] += $aCircles[$i][3]
If $aCircles[$i][0] > 1 Or $aCircles[$i][0] < 0 Then $aCircles[$i][2] *= -1
If $aCircles[$i][1] > 1 Or $aCircles[$i][1] < 0 Then $aCircles[$i][3] *= -1
Next
For $x = 0 To $width Step $s
For $y = 0 To $height Step $s
$ii = 0.2 ;intensity in this dot
For $i = 0 To $circles - 1 ;sum influence from all mass centers
$distx = $x - $aCircles[$i][0] * $width ;x distance
$disty = $y - $aCircles[$i][1] * $height ;y distance
$d = Sqrt($distx * $distx + $disty * $disty) / ($height + $width) ;dance between current mass center and current dot
If Not $d Then ;add influence from current mass center (but not too much!)
$ii += 2
Else
$ii += Min($aCircles[$i][4] / ($d * $d * 20), 2)
EndIf
Next
$r = Min($ii, $s) * $s * 0.70
_GDIPlus_GraphicsFillEllipse($hGraphic, $x + 1, $y + 1, $r, $r, $hBrush)
Next
Next
;~ $tt = TimerDiff($t)
;~ If $tt < 24 Then ;if the time was too short, half the spacing between dots
;~ $s /= 2
;~ ElseIf $tt > 74 Then ;if the time was too long, increase spacing by 8 pixels
;~ $s += 8
;~ EndIf
$fps += 1
Until Not Sleep(30)
Func FPS()
WinSetTitle($hGui, "", $GUI_title & " / FPS: " & $fps)
$fps = 0
EndFunc ;==>FPS
Func Min($a, $b)
If $a < $b Then Return $a
Return $b
EndFunc ;==>Min
Func _Exit()
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_BrushDispose($hBrush_Clear)
_WinAPI_SelectObject($hDC_backbuffer, $DC_obj)
_GDIPlus_GraphicsDispose($hGraphic)
_WinAPI_DeleteObject($hBMP)
_GDIPlus_BitmapDispose($hBitmap)
_WinAPI_DeleteObject($hHBITMAP)
_WinAPI_ReleaseDC($hGUI, $hDC)
_GDIPlus_Shutdown()
GUIDelete($hGui)
Exit
EndFunc ;==>_Exit
Gruß,
UEZ
Gefällt mir! Klasse Arbeit!
Hast du einen Vergleichsbenchmark, wo man den Unterschied messen kann? Z.B. das Beispiel als pur GDI+.
Gruß,
UEZ
eukalyptus: danke für den Benchmark! Wenn ich meine Funktion auf Speed optimieren würde, würde im Prinzip deine Version herauskommen!
Die Unterschiede sind auch nicht so gravierend ausgefallen...
Tool ms Speed
FreeImage 6704,621956 100%
GDIPlus 7424,867686 90,30%
FreeImage New 7547,155295 88,84%
UEZ 8915,102618 75,21%
ImageMagick 9683,291871 69,24%
Danke,
UEZ
Wie langsam war denn meine Funktion?
Sie war nicht auf Geschwindigkeit optimiert!
Gruß,
UEZ
Hier eine Funktion, um Bilder in JPGs umzuwandeln
#include-once
#include <GDIPlus.au3>
; #FUNCTION# ======================================================================================
; Name ..........: Convert2JPG()
; Description ...: Converts any image to a JPG file
; Syntax ........: Convert2JPG($inFile, $outFile[, $scaleW = 1[, $scaleH = 1[, $jpgQuality = 90[, $interpolationMode = 7]]]])
; Parameters ....: $inFile - input file name - should be any image file except jpg
; $outFile - output filename
; $scaleW - [optional] any number from 0 to x to scale width factor. Default = 1 - no scale (default:1)
; $scaleH - [optional] (default:1)
; $jpgQuality - [optional] jpg quality settings: 0 - 100 whereas 100 is best quality (default:90)
; $interpolationMode - [optional] any number from 0-7 (default:7):
; 0 - Default interpolation mode
; 1 - Low-quality mode
; 2 - High-quality mode
; 3 - Bilinear interpolation. No prefiltering is done
; 4 - Bicubic interpolation. No prefiltering is done
; 5 - Nearest-neighbor interpolation
; 6 - High-quality, bilinear interpolation. Prefiltering is performed to ensure high-quality shrinking
; 7 - High-quality, bicubic interpolation. Prefiltering is performed to ensure high-quality shrinking
; Return values .: Success -> True
; Failure:
; 1 - either no input or output file is given
; 2 - scale factor width or height is incorrect
; 3 - jpg quality value is out of range (0-100)
; 4 - interpolation mode value is out of range (0-7)
; 5 - $scaleW or $scaleH or $jpgQuality or $interpolationMode values are not numbers
; 6 - bitmap could not be created
; 7 - scaled bitmap could not be created
; 8 - scaled bitmap could not be saved
; 9 - bitmap could not be created
; Author ........: UEZ 2011
; Version .......: v0.90 build 2011-08-14
; Modified ......:
; Remarks .......:
; Related .......: GDIPlus.au3
; =================================================================================================
Func Convert2JPG($inFile, $outFile, $scaleW = 1, $scaleH = 1, $jpgQuality = 90, $interpolationMode = 7)
If $inFile = "" Or $outFile = "" Then Return SetError(1, 0, 0)
If $scaleW < 0 Or $scaleH < 0 Then Return SetError(2, 0, 0)
If $jpgQuality < 0 Or $jpgQuality > 100 Then Return SetError(3, 0, 0)
If $interpolationMode < 0 Or $interpolationMode > 7 Then Return SetError(4, 0, 0)
If Not IsNumber($scaleW) Or Not IsNumber($scaleH) Or Not IsNumber($jpgQuality) Or Not IsNumber($interpolationMode) Then Return SetError(5, 0, 0)
Local $declared = True
If Not $ghGDIPDll Then
_GDIPlus_Startup()
$declared = False
EndIf
If StringRight($outFile, 4) <> ".jpg" Then $outFile &= ".jpg"
Local Const $sCLSID = _GDIPlus_EncodersGetCLSID("JPG")
Local $tParams = _GDIPlus_ParamInit(1)
Local $tData = DllStructCreate("int Quality")
DllStructSetData($tData, "Quality", $jpgQuality)
Local $pData = DllStructGetPtr($tData)
_GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData)
Local Const $pParams = DllStructGetPtr($tParams)
Local Const $hBitmap = _GDIPlus_BitmapCreateFromFile($inFile)
If Not $hBitmap Then Return SetError(6, 0, 0)
Local $iW = _GDIPlus_ImageGetWidth($hBitmap)
Local $iH = _GDIPlus_ImageGetHeight($hBitmap)
Local $save, $err = 0
If $scaleW <> 1 Or $scaleH <> 1 Then
Local Const $newW = $iW * $scaleW
Local Const $newH = $iH * $scaleH
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $newW, "int", $newH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
If @error Then Return SetError(7, 0, 0)
Local $hBmp_scaled = $aResult[6]
Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBmp_scaled)
DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hContext, "int", $interpolationMode)
_GDIPlus_GraphicsDrawImageRect($hContext, $hBitmap, 0, 0, $newW, $newH)
_GDIPlus_GraphicsDispose($hContext)
$save = _GDIPlus_ImageSaveToFileEx($hBmp_scaled, $outFile, $sCLSID, $pParams)
$tParams = 0
$tData = 0
If Not $save Then $err = 8
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_BitmapDispose($hBmp_scaled)
If Not $declared Then _GDIPlus_Shutdown()
If $err Then Return SetError($err, 0, 0)
Return True
EndIf
$save = _GDIPlus_ImageSaveToFileEx($hBitmap, $outFile, $sCLSID, $pParams)
$tParams = 0
$tData = 0
If Not $save Then $err = 9
_GDIPlus_BitmapDispose($hBitmap)
If Not $declared Then _GDIPlus_Shutdown()
If $err Then Return SetError($err, 0, 0)
Return True
EndFunc
Falls ihr Fehler findet, bitte melden!
Gruß,
UEZ
Wenn du doch das Pic Control erstellst, solltest du doch wissen, welches Bild du genommen hast! Ich verstehe deine Frage nicht richtig!
Gruß,
UEZ
GDI+ basiert auf eine DLL und das Umwandeln sollte auch mit GDI+ relativ fix gehen.
Gruß,
UEZ
Update Ankündigung: jetzt mit der Möglichkeit das Bild in eine PDF Datei zu speichern! Einfach das Bild als Datei.pdf speichern.
Danke an taietel für die super UDF!
Gruß,
UEZ
Teste mal dies:
;coded by UEZ 2011
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("Prozentrechnung", 615, 277)
$idLabelLogo = GUICtrlCreateLabel("Prozentrechnung", 16, 8, 583, 101)
GUICtrlSetFont(-1, 64, 400, 0, "Times New Roman")
$idLabelG = GUICtrlCreateLabel("Grundwert G=", 32, 136, 134, 28)
GUICtrlSetFont(-1, 16, 400, 0, "Arial")
GUICtrlSetTip(-1, "G=W/p*100")
$idLabelW = GUICtrlCreateLabel("Prozentwert W=", 14, 176, 154, 28)
GUICtrlSetFont(-1, 16, 400, 0, "Arial")
GUICtrlSetTip(-1, "W=G*p/100")
$idLabelp = GUICtrlCreateLabel("Prozentsatz p=", 25, 216, 142, 28)
GUICtrlSetFont(-1, 16, 400, 0, "Arial")
GUICtrlSetTip(-1, "p=W/G*100")
$idGrundwert = GUICtrlCreateInput("0", 168, 136, 250, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Arial")
$idProzentwert = GUICtrlCreateInput("0", 168, 174, 250, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Arial")
$idProzentsatz = GUICtrlCreateInput("0", 168, 213, 250, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Arial")
$idExit = GUICtrlCreateButton("Exit", 545, 209, 50, 32)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
$idCalcG = GUICtrlCreateButton("Calc G", 425, 136, 75, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
$idCalcW = GUICtrlCreateButton("Calc W", 425, 176, 75, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
$idCalcp = GUICtrlCreateButton("Calc p", 425, 216, 75, 26)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $idExit
GUIDelete($hGUI)
Exit
Case $idCalcG
Calculate("G")
Case $idCalcW
Calculate("W")
Case $idCalcp
Calculate("p")
EndSwitch
WEnd
Func Calculate($prozent)
Local $G = GUICtrlRead($idGrundwert)
Local $W = GUICtrlRead($idProzentwert)
Local $p = GUICtrlRead($idProzentsatz)
Switch $prozent
Case "G"
If $p = 0 Then Return MsgBox(16, "Error", "p = 0")
GUICtrlSetData($idGrundwert, Round($W / $p * 100, 2)) ;G=W/p*100
Case "W"
GUICtrlSetData($idProzentwert, Round($G * $p / 100, 2)) ;W=G*p/100
Case "p"
If $G = 0 Then Return MsgBox(16, "Error", "G = 0")
GUICtrlSetData($idProzentsatz, Round($W / $g * 100, 2)) ;p=W/G*100
EndSwitch
EndFunc
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
Local $control_id = BitAND($wParam, 0x0000FFFF)
Switch $control_id
Case $idGrundwert
GUICtrlSetData($idGrundwert, CheckInput($idGrundwert))
Case $idProzentwert
GUICtrlSetData($idProzentwert, CheckInput($idProzentwert))
Case $idProzentsatz
GUICtrlSetData($idProzentsatz, CheckInput($idProzentsatz))
EndSwitch
Return "GUI_RUNDEFMSG"
EndFunc
Func CheckInput($control_id)
Local $number = StringRegExpReplace(GUICtrlRead($control_id), "[^0-9.]", "")
StringReplace($number, ".", ".")
If @extended > 1 Then $number = StringLeft($number, StringInStr($number, ".", 0, 2) - 1)
Return $number
EndFunc
Gruß,
UEZ