Hier ein Link, falls du die Sache "mathematisch" angehen möchtest: Flake: Echtzeit-Simulation von Windfeldern mit OpenCL zur Modellierung von Schneefall (PDF-Version der Arbeit -> Vorgeschmack auf ein Informatikstudium ;))
Gruß,
UEZ
Hier ein Link, falls du die Sache "mathematisch" angehen möchtest: Flake: Echtzeit-Simulation von Windfeldern mit OpenCL zur Modellierung von Schneefall (PDF-Version der Arbeit -> Vorgeschmack auf ein Informatikstudium ;))
Gruß,
UEZ
Probiere es mal damit:
[autoit]
#include <Date.au3>
$Qstart=1
$yStart=2011
$QEnde=1
$YEnde=2013
ConsoleWrite(_DateDiff("M", $yStart & "/" & $Qstart * 3 & "/01", $YEnde & "/" & 3 * $QEnde & "/01") / 3 + 1 & @LF)
[/autoit]Gruß,
UEZ
Herzlichen Glückwunsch zum Geburtstag und alles Gute lieber Raupi.
Feier schön "alter Sack".
Gruß,
UEZ
Vielen Dank für die Glückwünsche!
Heute genau vor 5 Jahren, und sogar auf die Minute genau, habe mich hier registriert und eine Menge Dinge über AutoIt und das Programmieren gelernt und nette Leute kennen gelernt, auch persönlich.
Ich hoffte, dass ich noch weiter hier aktiv sein kann und meinen Beitrag leisten kann.
Prost auf die nächsten 5 Jahre! ![]()
Gruß,
UEZ
Aus dem engl. Forum hat jemand gefragt, ob man in AutoIt einen Marker mit Text erstellen kann, der so ähnlich aussieht, wie in diesem Bild: http://www.google.com/mapfiles/markerA.png
Deshalb die Frage, wie man solch einen "Tropfen" erstellen kann.
Ich habe mir das Leben etwas einfacher gemacht und es "nur" ähnlich gehalten, da mir nichts besseres eingefallen ist.
Danke Andy für die mathematische Lösung. ![]()
Hier die Lösung, ohne viel Mathe (benötigt die aktuelle Beta![]()
;coded by UEZ build 2013-11-24
#AutoIt3Wrapper_Version=b
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
_GDIPlus_Startup()
Global $hGUI = GUICreate("GDI+ Example", 340, 400)
GUISetState()
Global Const $hGfx = _GDIPlus_GraphicsCreateFromHWND($hGUI)
Global $hBitmap = _GDIPlus_CreateMarkerWithText("AutoIt" & @LF &"rulez")
;~ Global $hBitmap = _GDIPlus_CreateMarkerWithText("A")
_GDIPlus_GraphicsDrawImage($hGfx, $hBitmap, 0, 5)
Do
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_GDIPlus_GraphicsDispose($hGfx)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_Shutdown()
GUIDelete()
Exit
EndSwitch
Until False
Func _GDIPlus_CreateMarkerWithText($sText, $sFont = "Comic Sans MS", $iFSize = 15.5, $iFColor = 0xFF1F0F0F,$iColorBorder = 0xFF1F0F0F, $iColorFill = 0xFFFF766A) ;beta
Local Const $hFormat = _GDIPlus_StringFormatCreate()
Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFont)
Local Const $hFont = _GDIPlus_FontCreate($hFamily, $iFSize)
_GDIPlus_StringFormatSetAlign($hFormat, 1)
Local $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)
Local Const $hGfx_tmp = _GDIPlus_GraphicsCreateFromHDC(_WinAPI_GetWindowDC(0))
Local $aInfo = _GDIPlus_GraphicsMeasureString($hGfx_tmp, $sText, $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDispose($hGfx_tmp)
Local $iW = $aInfo[0].Width, $iH = $aInfo[0].Height, $iHF = 3
If $iW < 9 Then $iW = 9
Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW * 2, $iH * $iHF)
Local Const $hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetSmoothingMode($hGfxCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
_GDIPlus_GraphicsSetTextRenderingHint($hGfxCtxt, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT)
Local Const $hBrushBgColor = _GDIPlus_BrushCreateSolid($iColorFill)
Local Const $hBrushFontColor = _GDIPlus_BrushCreateSolid($iFColor)
Local Const $hPen = _GDIPlus_PenCreate($iColorBorder, 2)
Local Const $hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddPie($hPath, $iW / 4, 0, $iW * 1.5 - 2, $iH * 2, 150, 240)
Local $aCoords = _GDIPlus_PathGetPoints($hPath)
Local $aPoints[4][2] = [[3]]
$aPoints[1][0] = $aCoords[2][0]
$aPoints[1][1] = $aCoords[2][1]
$aPoints[2][0] = $iW
$aPoints[2][1] = $iH * $iHF - 7
$aPoints[3][0] = $aCoords[UBound($aCoords) - 1][0]
$aPoints[3][1] = $aCoords[UBound($aCoords) - 1][1]
_GDIPlus_PathAddCurve2($hPath, $aPoints, 0.25)
_GDIPlus_GraphicsDrawPath($hGfxCtxt, $hPath, $hPen)
_GDIPlus_GraphicsFillPath($hGfxCtxt, $hPath, $hBrushBgColor)
_GDIPlus_GraphicsFillEllipse($hGfxCtxt, $iW / 4 + 1, 1, 2 * $iW * 0.75 - $iHF - 1, $iH * ($iHF - 1), $hBrushBgColor)
_GDIPlus_PathReset($hPath)
$tLayout.X = $iW - 1
$tLayout.Y = $iH * 0.25
_GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $iFSize + 4, $hFormat)
_GDIPlus_GraphicsFillPath($hGfxCtxt, $hPath, $hBrushFontColor)
_GDIPlus_PenDispose($hPen)
_GDIPlus_BrushDispose($hBrushBgColor)
_GDIPlus_BrushDispose($hBrushFontColor)
_GDIPlus_PathDispose($hPath)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($hGfxCtxt)
Return $hBitmap
EndFunc
Gruß,
UEZ
Der Screenshooter erstellt vom Bereich eine Bitmap und schickt die Bitmap zum Encoder und das n mal die Sekunde.
Was der Encoder mit den Bitmap sukzessive genau macht, weiß ich nicht.
Gruß,
UEZ
Ich habe einige Kommentare hinzugefügt:
[autoit]
Func Btn_Drehen()
$f = Random(5, 15) ;zufälligen Drehwinkel in Grad erstellen
Do
If $f > 0 Then
Drehen($f) ;drehe Scheibe um $f Grad
$ff += $f ;addiere Drehwinkel zur Drehwinkel Summe ($ff)
$f -= 0.1 ;reduziere Drehwinkel um 1/10 Grad pro Schleifendurchgang
Else
$iRunden = Floor($ff / 360) ;messe Anzahl der Runden
$iSegment = Mod($iRunden + Ceiling($ff / 15), 25) ;bestimme Segment -> 24 Segmente zu je 15°
If Not $iSegment Then $iSegment += 1 ;korrigiere, wenn Segment Kalulation = 0 ist
If Mod($ff, 15) > 14.45 Or Mod($ff, 15) < 0.55 Then $iSegment = 0 ;finde "Kippe"
GUICtrlSetData($iLbl_Preis, $aFelder[$iSegment]) ;zeige "Gewinn"
ExitLoop
EndIf
Until False * Sleep(30)
EndFunc
Ich hoffe, dass es jetzt "klarer" wird.
Gruß,
UEZ
Andy: in AutoIt Windows Screenshooter wird der Avi Film On-the-fly erstellt, ohne vorher die einzelnen Frames zu speichern. Ferner kannst du theoretisch solange dein Desktop oder einen Bereich daraus aufnehmen, bis die Platte voll ist (habe ich aber nicht getestet).
Gruß,
UEZ
Schaue mal hier rein: AutoIt Windows Screenshooter v1.71 Build 2013-11-18 ![]()
Gruß,
UEZ
Hier die Version, die du ursprünglich geplant hattest (benötigt die aktuelle Beta!![]()
#AutoIt3Wrapper_Version=b
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
[/autoit][autoit][/autoit][autoit]Global $hImage, $hGUI, $hGrafics
[/autoit][autoit][/autoit][autoit]$hImage = _GDIPlus_BitmapCreateFromMemory(InetRead("http://aut1.autoit-cdn.com/images/logo_autoit_210x72@2x.png"))
Global $iWidth = _GDIPlus_ImageGetWidth($hImage)
Global $iHeight = _GDIPlus_ImageGetHeight($hImage)
$hGUI = GUICreate("Mein Design", $iWidth, $iHeight, -1, -1)
GUISetBkColor(0x808090, $hGUI)
$iLabel = GUICtrlCreateLabel("", 0, 0, $iWidth, $iHeight)
GUISetState()
$hGrafics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImageRect($hGrafics, $hImage, 0, 0, $iWidth, $iHeight)
GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT")
[/autoit][autoit][/autoit][autoit]While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_GDIPlus_GraphicsDispose($hGrafics)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
Exit
Case $iLabel
MsgBox(0, "Test", "Grafik wurde geklickt")
EndSwitch
WEnd
; Draw PNG image
Func MY_WM_PAINT($hWnd, $Msg, $wParam, $lParam)
_GDIPlus_GraphicsDrawImageRect($hGrafics, $hImage, 0, 0, $iWidth, $iHeight)
Return $GUI_RUNDEFMSG
EndFunc
Gruß,
UEZ
Andy: mir ging es mehr um das Speichern des Bildes direkt im Speicher, also ohne das Zwischenspeichern auf die Platte.
Gruß,
UEZ
Probiere es mal damit (benötigt die aktuelle Beta)!:
[autoit]
#AutoIt3Wrapper_Version=b
#include <Clipboard.au3>
#include <Crypt.au3>
#include <Screencapture.au3>
_GDIPlus_Startup()
$BILDinZWSPEICHER = _ScreenCapture_Capture("", 0, 0, 9, 9, 0) ; 10x10 an der Stelle 0,0
$bild = _GDIPlus_BitmapCreateFromHBITMAP($BILDinZWSPEICHER)
$sFile = _GDIPlus_StreamImage2BinaryString($bild, "PNG")
ConsoleWrite($sFile & @LF)
_WinAPI_DeleteObject($BILDinZWSPEICHER)
_GDIPlus_BitmapDispose($bild)
_Crypt_Startup()
$MD5 = _Crypt_HashData($sFile, $CALG_MD5)
MsgBox(0, 'Hash', "MD5: " & Hex($MD5))
_Crypt_Shutdown()
_GDIPlus_Shutdown()
Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "JPG", $iQuality = 80, $bSave = False, $sFilename = @ScriptDir & "\Converted.jpg") ;coded by UEZ 2013 build 2013-09-14
Local $sImgCLSID, $tGUID, $tParams
Switch $sFormat
Case "JPG"
$sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat)
$tGUID = _WinAPI_GUIDFromString($sImgCLSID)
Local $tData = DllStructCreate("int Quality")
DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100
Local $pData = DllStructGetPtr($tData)
$tParams = _GDIPlus_ParamInit(1)
_GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData)
Case "PNG", "BMP", "GIF", "TIF"
$sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat)
$tGUID = _WinAPI_GUIDFromString($sImgCLSID)
Case Else
Return SetError(1, 0, 0)
EndSwitch
Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx
If @error Then Return SetError(2, 0, 0)
_GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams))
If @error Then Return SetError(3, 0, 0)
_GDIPlus_BitmapDispose($hBitmap)
Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx
If @error Then Return SetError(4, 0, 0)
Local $iMemSize = _MemGlobalSize($hMemory)
If Not $iMemSize Then Return SetError(5, 0, 0)
Local $pMem = _MemGlobalLock($hMemory)
$tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem)
Local $bData = DllStructGetData($tData, 1)
_WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/…3(v=vs.85).aspx
_MemGlobalFree($hMemory)
If $bSave Then
Local $hFile = FileOpen($sFilename, 18)
If @error Then Return SetError(6, 0, $bData)
FileWrite($hFile, $bData)
FileClose($hFile)
EndIf
Return $bData
EndFunc ;==>_GDIPlus_StreamImage2BinaryString
Gruß,
UEZ
Na ja, ich würde es mehr Flexibilität nennen, anstatt Dynamik.
Anstatt das Glücksrad immer wieder neu zu berechnen, würde ich an deiner Stelle es nur einmal zeichnen und es nur noch rotieren lassen.
Wenn du was verändern möchtest, dann eben nur dann neuzeichnen.
Gruß,
UEZ
Welche Dynamik fehlt dir denn?
Meine Berechnung sieht etwas kompliziert aus, aber sollte nicht so schwer sein zu verstehen, da die Kalkulation sich im Prinzip auf 4 Zeilen beschränkt.
Im Prinzip werden die Rotationen zusammen gezählt und auf das Glücksrad übersetzt. Insgesamt sind es 24 Segmente zu je 15°. Ferner wird noch geprüft, ob der Zeiger auf der "Kippe" steht.
Gruß,
UEZ
Am besten das Icon in eine Bitmap umwandeln und den Button Control mit dem Style $BS_BITMAP verwenden.
Dann sollte es passen.
Gruß,
UEZ
Sollte auch mit $BS_ICON unter WinXP funzen.
Gruß,
UEZ
Ist geladen.
Gruß,
UEZ ![]()
...
wer sich über den Namen der BITMAPINFO-Struct wundert, der hat die neue Beta noch nicht mit "alten" BITMAPINFO-Funktionen verwendet. In der "neuen" Beta wurden die Namen der Datentypen ohne irgendwelche Veranlassung komplett umgeschrieben...*zu UEZ und eukalyptus rüberschiel*
Nicht alles, was in der GDIPlus verändert wurde, ist von uns initiiert worden. Warum man den Prefix "bi" zu den Struct Bezeichnungen hinzugefügt hat, weiß ich nicht.
Kann sein, dass jpm die Sachen komplett überarbeitet hat.
Gruß,
UEZ
Probiere es mal damit:
[autoit]
#include <GDIPlus.au3>
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\test.png")
$hBmpScaled = _GDIPlus_BitmapScale($hImage)
_GDIPlus_ImageSaveToFile($hBmpScaled, @ScriptDir & "\Scaled.png")
_GDIPlus_BitmapDispose($hBmpScaled)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_Shutdown()
ShellExecute(@ScriptDir & "\Scaled.png")
Func _GDIPlus_BitmapScale($hImage, $iFactor = 2) ;coded by UEZ 2013
Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0(_GDIPlus_ImageGetWidth($hImage) * $iFactor, _GDIPlus_ImageGetHeight($hImage) * $iFactor)
Local Const $hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsSetInterpolationMode($hGfxCtxt, 5)
_GDIPlus_GraphicsSetPixelOffsetMode($hGfxCtxt, $GDIP_PIXELOFFSETMODE_HIGHQUALITY)
_GDIPlus_GraphicsDrawImageRect($hGfxCtxt, $hImage, 0, 0, _GDIPlus_ImageGetWidth($hImage) * $iFactor, _GDIPlus_ImageGetHeight($hImage) * $iFactor)
Local Const $hBmpTexture = _GDIPlus_BitmapCreateFromScan0($iFactor, $iFactor)
Local Const $hTextureCtxt = _GDIPlus_ImageGetGraphicsContext($hBmpTexture)
_GDIPlus_GraphicsFillRect($hTextureCtxt, 0, 1, $iFactor, $iFactor)
_GDIPlus_GraphicsFillRect($hTextureCtxt, 1, 0, $iFactor, $iFactor)
Local Const $hTexture = _GDIPlus_TextureCreate($hBmpTexture)
_GDIPlus_GraphicsFillRect($hGfxCtxt, 0, 0, _GDIPlus_ImageGetWidth($hImage) * $iFactor, _GDIPlus_ImageGetHeight($hImage) * $iFactor, $hTexture)
_GDIPlus_BrushDispose($hTexture)
_GDIPlus_GraphicsDispose($hTextureCtxt)
_GDIPlus_GraphicsDispose($hGfxCtxt)
_GDIPlus_BitmapDispose($hBmpTexture)
Return $hBitmap
EndFunc
Die aktuelle Beta wird benötigt!
Das Resultat sollte das aus dem Screenshot entsprechen. Ich hoffe, dass das die Frage war.
Gruß,
UEZ