Probier' doch mal Write Text on Bitmap.au3 aus.
Gruß,
UEZ
Probier' doch mal Write Text on Bitmap.au3 aus.
Gruß,
UEZ
Hier eine andere Variante mit einem alten GDI+ Zeug von mir ![]()
;coded by UEZ 2009
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GDIplus.au3>
#include <WindowsConstants.au3>
Local Const $width = @DesktopWidth / 2
Local Const $height = @DesktopHeight / 2
Opt("GUIOnEventMode", 1)
Local $fps = 0, $fps_diff, $fps_maintimer, $fps_timer, $display_FPS = -15
Local $trig = ACos(-1) / 180
Local $max_dots = 100
Local $max_speed = 8
Local $iWidth = 10
Local $iHeight = 10
Local $hGUI = GUICreate("Border Collision with " & $max_dots & " objects! 0 FPS", $width, $height, -1, -1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
Local $Button = GUICtrlCreateButton("Exit", $width / 2 - 50, $height / 2 - 15, 100, 30)
Local $Input = GUICtrlCreateInput("Coded by UEZ", $width / 4, $height - 40, $width / 2, 20, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $hGraphics)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;~ _GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)
Local $hBrush_Clear = _GDIPlus_BrushCreateSolid(0xFF000000)
Global Const $GW_CHILD = 5
Global Const $GW_HWNDNEXT = 2
Global $hRegion = _GDIPlus_RegionCreateFromRect(_GDIPlus_RectFCreate(0, 0, $width, $height))
Global $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD)
Global $aRect
Do
$aRect = ControlGetPos($hChild, "", 0)
_GDIPlus_RegionCombineRect($hRegion, _GDIPlus_RectFCreate($aRect[0], $aRect[1], $aRect[2], $aRect[3]), 3)
$hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT)
Until Not $hChild
_GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion)
_GDIPlus_RegionDispose($hRegion)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]GUICtrlSetOnEvent($Button, "Close")
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
Dim $coordinates[$max_dots][5], $angle
Dim $hBrush[$max_dots]
Initialize()
$fps_maintimer = TimerInit()
Do
For $x = -0x7FFFFFFF To 0x7FFFFFFF
$fps_timer = TimerInit()
Draw_Dots()
Calculate_New_Position()
Sleep(30)
$fps_diff = TimerDiff($fps_timer)
If TimerDiff($fps_maintimer) >= 1000 Then ;calculate FPS
$fps = Round(1000 / $fps_diff)
$fps_maintimer = TimerInit()
EndIf
WinSetTitle($hGUI, "", "Border Collision with " & $max_dots & " objects! " & $fps & " FPS")
Next
Until False
Func Initialize()
For $k = 0 To $max_dots - 1
$hBrush[$k] = _GDIPlus_BrushCreateSolid(Random(0xD0808080, 0xD0FFFFFF, 1))
New_Coordinates($k)
Next
EndFunc ;==>Initialize
Func Draw_Dots()
Local $i, $temp_x, $temp_y
_GDIPlus_GraphicsFillRect($hBackbuffer, 0, 0, $width, $height, $hBrush_Clear)
For $i = 0 To $max_dots - 1
_GDIPlus_GraphicsFillEllipse($hBackbuffer, $coordinates[$i][0], $coordinates[$i][1], $iWidth, $iHeight, $hBrush[$i])
Next
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $width, $height)
EndFunc ;==>Draw_Dots
Func New_Coordinates($k)
$coordinates[$k][0] = $width / 2 ;Random($width / 20, $width - $width / 20, 1);start x position
$coordinates[$k][1] = $height / 2 ;Random($height / 20, $height - $height / 20, 1) ;start y position
$coordinates[$k][2] = Random(1, $max_speed, 1) ;speed of pixel
$angle = Random(0, 359, 1)
;~ ConsoleWrite("Angle: " & $angle & "°" & @CRLF)
$coordinates[$k][3] = $coordinates[$k][2] * Cos($angle * $trig)
$coordinates[$k][4] = $coordinates[$k][2] * Sin($angle * $trig)
EndFunc ;==>New_Coordinates
Func Calculate_New_Position()
Local $k
For $k = 0 To $max_dots - 1
$coordinates[$k][0] += $coordinates[$k][3] ;increase x coordinate with appropriate slope
$coordinates[$k][1] += $coordinates[$k][4] ;increase y coordinate with appropriate slope
If $coordinates[$k][0] <= 0 Then ;border collision x left
$coordinates[$k][0] = 1
$coordinates[$k][3] *= -1
ElseIf $coordinates[$k][0] >= $width - $iWidth Then ;border collision x right
$coordinates[$k][0] = $width - ($iWidth + 1)
$coordinates[$k][3] *= -1
EndIf
If $coordinates[$k][1] <= 0 Then ;border collision y top
$coordinates[$k][1] = 1
$coordinates[$k][4] *= -1
ElseIf $coordinates[$k][1] >= $height - $iHeight Then ;border collision y bottom
$coordinates[$k][1] = $height - ($iHeight + 1)
$coordinates[$k][4] *= -1
EndIf
Next
EndFunc ;==>Calculate_New_Position
Func close()
For $k = 0 To $max_dots - 1
_GDIPlus_BrushDispose($hBrush[$k])
Next
_GDIPlus_BrushDispose($hBrush_Clear)
_GDIPlus_GraphicsDispose($hBackbuffer)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>close
Func _GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion, $iCombineMode = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetClipRegion", "hwnd", $hGraphics, "hwnd", $hRegion, "int", $iCombineMode)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_RegionCreateFromRect($tRectF)
Local $pRectF, $aResult
$pRectF = DllStructGetPtr($tRectF)
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateRegionRect", "ptr", $pRectF, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
Return $aResult[2]
EndFunc
Func _GDIPlus_RegionCombineRect($hRegion, $tRectF, $iCombineMode = 2)
Local $pRectF, $aResult
$pRectF = DllStructGetPtr($tRectF)
$aResult = DllCall($ghGDIPDll, "uint", "GdipCombineRegionRect", "hwnd", $hRegion, "ptr", $pRectF, "int", $iCombineMode)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc
Func _GDIPlus_RegionDispose($hRegion)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteRegion", "hwnd", $hRegion)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0] = 0
EndFunc
Nachtrag: du wolltest ja ein GDI+ Button. Nun ja, hier die Version mit den Build-In Button. Habe es wohl überlesen... ![]()
Gruß,
UEZ
Herzlichen Glückwunsch zum Geburtstag und alles Gute!
Gruß,
UEZ
___ ___ ________ ______ ______ __ __
/__/\ /__/\ /_______/\ /_____/\ /_____/\ /_/\/_/\
\::\ \\ \ \ \::: _ \ \ \:::_ \ \ \:::_ \ \ \ \ \ \ \
\::\/_\ .\ \ \::(_) \ \ \:(_) \ \ \:(_) \ \ \:\_\ \ \
\:: ___::\ \ \:: __ \ \ \: ___\/ \: ___\/ \::::_\/
\: \ \\::\ \ \:.\ \ \ \ \ \ \ \ \ \ \::\ \
\__\/ \::\/ \__\/\__\/ \_\/ \_\/ \__\/
____ __ __ __
/\ _`\ __ /\ \__ /\ \ /\ \
\ \ \L\ \ /\_\ _ __ \ \ ,_\ \ \ \___ \_\ \ __ __ __
\ \ _ <' \/\ \ /\`'__\ \ \ \/ \ \ _ `\ /'_` \ /'__`\ /\ \/\ \
\ \ \L\ \ \ \ \ \ \ \/ \ \ \_ \ \ \ \ \ /\ \L\ \ /\ \L\.\_ \ \ \_\ \
\ \____/ \ \_\ \ \_\ \ \__\ \ \_\ \_\\ \___,_\\ \__/.\_\ \/`____ \
\/___/ \/_/ \/_/ \/__/ \/_/\/_/ \/__,_ / \/__/\/_/ `/___/> \
/\___/
\/__/
Alles anzeigen
Gruß,
UEZ
Ich weiß nicht, wie du auf die Formel kommst.
Hier eine Alternativformel:
[autoit]
#cs
Summe(k=0,unendlich) = (-1)^k/4^k*((2/(4k+1))+(2/(4k+2))+1/(4k+3))
#ce
$pi = 0
For $k = 0 To 100000
$pi += (-1)^$k / (4^$k) * ((2 / (4 * $k+1)) + (2 / (4 * $k+2)) + 1 / (4 * $k+3))
Next
ConsoleWrite($pi & @CRLF)
Gruß,
UEZ
| | .'. |`````````, |`````````, ``.. ..''
|_________| .''```. |''''''''' |''''''''' ``.''
| | .' `. | | |
| | .' `. | | |
____ _ _ _ _
| _ \ (_) | | | | | |
| |_) | _ _ __ | |_ | |__ __| | __ _ _ _
| _ < | | | '__| | __| | '_ \ / _` | / _` | | | | |
| |_) | | | | | | |_ | | | | | (_| | | (_| | | |_| |
|____/ |_| |_| \__| |_| |_| \__,_| \__,_| \__, |
__/ |
|___/
Alles anzeigen
Gruß,
UEZ
In Bezug auf Anonymität: ich sehe eher ein Problem darin, dass vielleicht der Eine oder Andere sich "angepisst" fühlt, weil gewisse Personen nicht für ihn / sie gestimmt haben.
Gruß,
UEZ
PS: die Prozentanzeige scheint wirklich nicht zu stimmen!
Die Abstimmung selbst ist anonym, man muss ja nicht seine Meinung posten,
mfg AutoBert
Dann sollte ich dies ja nicht sehen können:
Gruß,
UEZ ![]()
Die Abstimmung ist ja nicht Anonym! Ist das so gewollt?
Mir persönlich ist das ja egal...
Gruß,
UEZ
Ja dann, jetzt wird in die Hände gespuckt...
Gruß,
UEZ
PS: ich wünschte, ich könnte dich in ASM unterstützen, abgesehen davon, dass ich wieder momentan voll ausgelastet und keine große Hilfe in ASM bin...
Alles anzeigenOK,
[autoit]
dann hole ich mir den Pointer und $hBmp_buffer über CreateNewBitmap32($ix,$iy,$Ptr_buffer,$hBmp_buffer), welches dann$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphics)
[/autoit]ersetzt, und ihr könnt euch per
[autoit]$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBmp_buffer)
[/autoit]
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hImage)den $hBackbuffer holen? Ist das so ok?
Danach könnte man z.B. eine Funktion _Rect_to_Trapezoid($aEckpunkteRect[],$aEckpunkte_Trapezoid,$ix,$iy,$ptr_buffer) aufrufen, welche direkt in den Backbuffer schreibt.
Btw, in CreateNewBitmap32() werden nur AutoIt-Funktionen verwendet.
Nächste Frage:
Durch bestimmte Prozessorbefehle (MMX/SSE), die ab den P3/P4 implementiert wurden, kann die Grafikberechnung wesentlich beschleunigt werden. Kann ich vorraussetzen, dass nur Prozessoren neuer als P3 (also ab P4) eingesetzt werden? Immerhin hat diese schon 10 Jahre alte Technik in den neuesten Linuxkernel Einzug gehalten. Auch die "großen" Bildbe(ver)arbeitungs-Softwarepakete setzen in den neuesten Versionen nun endlich diese uralten Prozessor-Befehle ein. Heureka, die Software tappert 10 Jahre hinter der Hardware her...
Wir sollten P4+ voraussetzen!
Gruß,
UEZ
Hier ein recht simples Skript zum Darstellen von Bildern als Slideshow mit nur einem Überblendeffekt!
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Description=Simple Image Slideshow Program
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=UEZ 2010
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_Field=Coded by|UEZ
#AutoIt3Wrapper_Res_Field=Build|2011-04-30 Beta
#AutoIt3Wrapper_Res_Field=Compile date|%longdate% %time%
#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer%
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UPX_Parameters=--ultra-brute
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#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 <Array.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
Global $c, $i, $k, $l, $chk, $end, $fn
Global $hGUI[3], $graphic0, $graphic1, $graphic2, $hGraphic[2], $hImage, $hBrush1, $hBrush2, $hFamily, $hFont, $hFormat, $tLayout, $aInfo
Global Const $SC_DRAGMOVE = 0xF012, $fsize = 8, $fh = 15
Global Const $ratio = 16 / 10
Global Const $height = Floor(@DesktopHeight * 0.9 /
* 8, $width = Floor($height * $ratio /
* 8
Global Const $bg_color = "F0F0F0"
Global Const $title = "Simple Image Slideshow by UEZ"
Global $imagedir = FileSelectFolder("Select folder with images", "", 4, @ScriptDir)
If $imagedir = "" Then Exit MsgBox(16, "Error", "No folder selected!", 5)
Global $aFiles = _FileListToArray($imagedir, "*.*", 1)
If Not UBound($aFiles) Then Exit MsgBox(16, "Error", "No files found!", 5)
$l = 1
Do
$chk = StringRegExp($aFiles[$l], "(?i:.*\.jpg|.*\.png|.*\.bmp|.*\.gif)", 3)
If @error Then
_ArrayDelete($aFiles, $l)
$l -= 1
EndIf
$l += 1
Until $l = UBound($aFiles)
If UBound($aFiles) = 1 Then Exit MsgBox(16, "Error", "No images found!", 5)
[/autoit] [autoit][/autoit] [autoit]Global $audio = _FileListToArray(@ScriptDir, "*.mp3", 1)
Global $play = False, $rand, $a
$a = UBound($audio) - 1
If Not @error Then
If $a Then
$rand = 1
Else
$rand = Random(1, $a, 1)
EndIf
$play = True
SoundPlay($audio[$rand])
EndIf
Fader_Init($width, $height)
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hGUI[2])
WinActivate($hGUI[2])
GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")
[/autoit] [autoit][/autoit] [autoit]For $k = 1 To UBound($aFiles) - 1
Fader($imagedir & "\" & $aFiles[$k])
Next
Sleep(3000)
_Exit(True)
Func WM_ERASEBKGND($hWnd, $msg, $wParam, $lParam)
_WinAPI_RedrawWindow($hGUI[2], 0, 0, 0)
Return 1
EndFunc
Func Fader($image, $delay = 12, $speed = 3, $sleep = 1500, $display_fn = True)
Local $a, $d = Mod($c, 2), $iW, $iH, $f, $w, $h
$hImage = _GDIPlus_ImageLoadFromFile($image)
$iW = _GDIPlus_ImageGetWidth($hImage)
$iH = _GDIPlus_ImageGetHeight($hImage)
If $iW < $width + 1 And $iH < $height + 1 Then
_GDIPlus_GraphicsDrawImageRect($hGraphic[$d], $hImage, $width / 2 - $iW / 2, $height / 2 - $iH / 2, $iW, $iH)
Else
If $iW > $iH Then
$f = $iW / $width
Else
$f = $iH / $height
EndIf
$w = Int($iW / $f)
$h = Int($iH / $f)
_GDIPlus_GraphicsDrawImageRect($hGraphic[$d], $hImage, $width / 2 - $w / 2, $height / 2 - $h / 2, $w, $h)
EndIf
If $display_fn Then
_GDIPlus_GraphicsFillRect($hGraphic[$d], 0, $height - $fh, $width, $fh, $hBrush2)
$fn = $k & "/" & UBound($aFiles) - 1 & ": " & $image & " (" & $iW & "x" & $iH & ")"
If StringLen($fn) > Floor($width / 5.5) Then $fn = StringLeft($fn, 30) & "..." & StringRight($fn, StringLen($fn) - StringInStr($fn, "\", 0, -1) + 30)
_GDIPlus_GraphicsDrawStringEx($hGraphic[$d], $fn, $hFont, $tLayout, $hFormat, $hBrush1)
EndIf
For $a = 0 To 0xFF - $speed Step $speed
WinSetTrans($hGUI[$d], "", $a)
WinSetTrans($hGUI[Not $d], "", 0xFF - $speed - $a)
Sleep($delay)
Next
_GDIPlus_GraphicsClear($hGraphic[Not $d], "0xFF" & $bg_color)
$c += 1
Sleep($sleep)
EndFunc ;==>Fader
Func Fader_Init($width, $height)
$hGUI[2] = GUICreate($title, $width, $height, -1, -1, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_DLGMODALFRAME)
$hGUI[0] = GUICreate($title, $width, $height, 0, 0, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_MDICHILD, $hGUI[2])
$hGUI[1] = GUICreate($title, $width, $height, 0, 0, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_MDICHILD, $hGUI[2])
GUISetBkColor("0x" & $bg_color, $hGUI[2])
GUISetState(@SW_SHOW, $hGUI[2])
GUISetState(@SW_SHOW, $hGUI[0])
GUISetState(@SW_SHOW, $hGUI[1])
WinSetTrans($hGUI[0], "", 0x00)
WinSetTrans($hGUI[1], "", 0x00)
_GDIPlus_Startup()
$hGraphic[0] = _GDIPlus_GraphicsCreateFromHWND($hGUI[0])
$hGraphic[1] = _GDIPlus_GraphicsCreateFromHWND($hGUI[1])
_GDIPlus_GraphicsClear($hGraphic[0], "0xFF" & $bg_color)
_GDIPlus_GraphicsClear($hGraphic[1], "0xFF" & $bg_color)
$hBrush1 = _GDIPlus_BrushCreateSolid(0xFFF0F080)
$hBrush2 = _GDIPlus_LineBrushCreate(0, 0, $width, $fh, 0xD0101020, 0x08D0D080, 0x03)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, $fsize)
$tLayout = _GDIPlus_RectFCreate(0, $height - $fh, 0, 0)
EndFunc ;==>Fader_Init
Func _Exit($end = False)
GUIRegisterMsg($WM_LBUTTONDOWN, "")
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush1)
_GDIPlus_BrushDispose($hBrush2)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hGraphic[0])
_GDIPlus_GraphicsDispose($hGraphic[1])
GUIDelete($hGUI[0])
GUIDelete($hGUI[1])
GUIDelete($hGUI[2])
_GDIPlus_Shutdown()
If $play Then SoundPlay("")
If $end Then Exit MsgBox(0, "Information", "End reached! Closing in 10 seconds!", 10)
Exit
EndFunc ;==>_Exit
Func _GDIPlus_LineBrushCreate($nX1, $nY1, $nX2, $nY2, $iARGBClr1, $iARGBClr2, $iWrapMode = 0)
Local $tPointF1, $pPointF1
Local $tPointF2, $pPointF2
Local $aResult
$tPointF1 = DllStructCreate("float;float")
$pPointF1 = DllStructGetPtr($tPointF1)
$tPointF2 = DllStructCreate("float;float")
$pPointF2 = DllStructGetPtr($tPointF2)
DllStructSetData($tPointF1, 1, $nX1)
DllStructSetData($tPointF1, 2, $nY1)
DllStructSetData($tPointF2, 1, $nX2)
DllStructSetData($tPointF2, 2, $nY2)
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateLineBrush", "ptr", $pPointF1, "ptr", $pPointF2, "uint", $iARGBClr1, "uint", $iARGBClr2, "int", $iWrapMode, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
Return $aResult[6]
EndFunc ;==>_GDIPlus_LineBrushCreate
Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
_SendMessage($hGUI[2], $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc ;==>_WM_LBUTTONDOWN
Läuft sauber nur auf Vista+ Betriebssystemen!!! Sollte jetzt auch unter WinXP funzen!
Gruß,
UEZ
Hi Andy,
da ich und auch die anderen mit dem Backbuffer arbeiten,
[autoit]
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iX, $iY, $hGraphics)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
wäre es klasse, wenn wir das Bild auch direkt in den Backbuffer ($hBackbuffer) schreiben könnten!
Geht das?
Gruß,
UEZ
Suche mal den Bass.dll und eukalyptus!
Hier ist was, was nur teilweise in die Richtung geht: Audio Visualization Collection
Gruß,
UEZ
Hier ein Beispiel von Authenticity (dem GDIp.au3 Ersteller):
#include <GDIplus.au3>
Global Const $GDIP_BLUREFFECT = "{633C80A4-1843-482b-9EF2-BE2834C5FDD4}"
Global Const $GDIP_SHARPENEFFECT = "{63CBF3EE-C526-402c-8F71-62C540BF5142}"
Global Const $GDIP_COLORMATRIXEFFECT = "{718F2615-7933-40e3-A511-5F68FE14DD74}"
Global Const $GDIP_COLORLUTEFFECT = "{A7CE72A9-0F7F-40d7-B3CC-D0C02D5C3212}"
Global Const $GDIP_BRIGHTNESSCONTRASTEFFECT = "{D3A1DBE1-8EC4-4c17-9F4C-EA97AD1C343D}"
Global Const $GDIP_HUESATURATIONLIGHTNESSEFFECT = "{8B2DD6C3-EB07-4d87-A5F0-7108E26A9C5F}"
Global Const $GDIP_LEVELSEFFECT = "{99C354EC-2A31-4f3a-8C34-17A803B33A25}"
Global Const $GDIP_TINTEFFECT = "{1077AF00-2848-4441-9489-44AD4C2D7A2C}"
Global Const $GDIP_COLORBALANCEEFFECT = "{537E597D-251E-48da-9664-29CA496B70F8}"
Global Const $GDIP_REDEYECORRECTIONEFFECT = "{74D29D05-69A4-4266-9549-3CC52836B632}"
Global Const $GDIP_COLORCURVEEFFECT = "{DD6A0022-58E4-4a67-9D9B-D48EB881A53D}"
_GDIPlus11_Startup()
If @error Then Exit MsgBox(0x10, "Error", "GDIPlus v1.1 is not installed")
;~ _GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]Local $hGUI, $hGraphics, $hImage, $hBlurredImage, $hEffect, $file
$file = FileOpenDialog("Select Image", "", "Images (*.jpg;*.png;*.bmp;*.gif)")
If @error Then Exit
$hImage = _GDIPlus_ImageLoadFromFile($file)
$hGUI = GUICreate("GDI+ v1.1 Demo Blur", _GDIPlus_ImageGetWidth($hImage), _GDIPlus_ImageGetHeight($hImage))
GUISetState()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hEffect = _GDIPlus_EffectCreate($GDIP_BLUREFFECT)
$hBlurredImage = _GDIPlus_BitmapCreateWithEffect($hImage, $hEffect)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBlurredImage, 0, 0)
[/autoit] [autoit][/autoit] [autoit]Do
Until GUIGetMsg() = -3
_GDIPlus_BitmapDispose($hBlurredImage)
_GDIPlus_EffectDispose($hEffect)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus11_Shutdown()
;~ _GDIPlus_Shutdown()
Func _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect, $pROI = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapApplyEffect", "hwnd", $hBitmap, "hwnd", $hEffect, "ptr", $pROI, "int", 0, "ptr*", 0, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc
Func _GDIPlus_BitmapCreateWithEffect($hBitmap, $hEffect, $pROI = 0, $pOutRect = 0)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapCreateApplyEffect", "ptr*", $hBitmap, "int", 1, "hwnd", $hEffect, "ptr", $pROI, "ptr", $pOutRect, "int*", 0, "int", 0, "ptr*", 0, "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
Return SetError($aResult[0], 0, $aResult[6])
EndFunc
Func _GDIPlus_EffectCreate($sEffectGUID)
Local $iI, $tGUID, $pGUID, $tElem, $aElem[4], $aResult
$tGUID = _WinAPI_GUIDFromString($sEffectGUID)
$pGUID = DllStructGetPtr($tGUID)
$tElem = DllStructCreate("int[4]", $pGUID)
For $iI = 1 To 4
$aElem[$iI-1] = DllStructGetData($tElem, 1, $iI)
Next
$aResult = DllCall($ghGDIPDll, "uint", "GdipCreateEffect", "int", $aElem[0], "int", $aElem[1], "int", $aElem[2], "int", $aElem[3], "int*", 0)
If @error Then Return SetError(@error, @extended, 0)
Return SetError($aResult[0], 0, $aResult[5])
EndFunc
Func _GDIPlus_EffectDispose($hEffect)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeleteEffect", "hwnd", $hEffect)
If @error Then Return SetError(@error, @extended, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc
Func _GDIPlus11_Startup()
Local $pInput, $tInput, $pToken, $tToken, $aResult, $os
$giGDIPRef += 1
If $giGDIPRef > 1 Then Return True
If @OSVersion = "WIN_VISTA" Then
$ghGDIPDll = DllOpen(@WindowsDir & "\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6000.16386_none_8df21b8362744ace\gdiplus.dll")
ElseIf @OSVersion = "WIN_7" Then
$ghGDIPDll = DllOpen(@SystemDir & "\gdiplus.dll")
Else
Return SetError(1)
EndIf
;~ _WinAPI_Check("_GDIPlus_Startup (GDIPlus.dll not found)", @error, False)
$tInput = DllStructCreate($tagGDIPSTARTUPINPUT)
$pInput = DllStructGetPtr($tInput)
$tToken = DllStructCreate("int Data")
$pToken = DllStructGetPtr($tToken)
DllStructSetData($tInput, "Version", 1)
$aResult = DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", $pToken, "ptr", $pInput, "ptr", 0)
If @error Then Return SetError(@error, @extended, False)
$giGDIPToken = DllStructGetData($tToken, "Data")
Return $aResult[0] = 0
EndFunc
Func _GDIPlus11_Shutdown()
If $ghGDIPDll = 0 Then Return SetError(-1, -1, False)
$giGDIPRef -= 1
If $giGDIPRef = 0 Then
DllCall($ghGDIPDll, "none", "GdiplusShutdown", "ptr", $giGDIPToken)
DllClose($ghGDIPDll)
$ghGDIPDll = 0
EndIf
Return True
EndFunc
Solle ab Vista+ laufen!
Gruß,
UEZ
Ich weiß nicht, ob du das hier meinst:
; #DANKE# ====================================================================================================================
;
; Ersteinmal Vielen Dank an ....: UEZ
; Author (Hauptprogramm)........: UEZ
; Author (Function).............: UEZ
; Weiterentwickelt von .........: GHF
; Natürlich mit Hilfe von.......: UEZ und den AutoIt Forum Mitgliedern
;
; #DANKE# ====================================================================================================================
#include <Array.au3>
#include <GDIPlus.au3>
#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <File.au3>
#include <WindowsConstants.au3>
#Include <WinAPIEx.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
$hGUI1 = GUICreate("Daten werden geladen ...", 400, 80)
GUISetBkColor(0xFFFFFF)
GuiCtrlCreateProgress(100, 20, 150, 20)
GuiCtrlSetData(-1, 5)
GuiCtrlSetData(-1, 10)
GuiCtrlSetData(-1, 15)
GuiCtrlSetData(-1, 20)
GuiCtrlSetData(-1, 40)
GuiCtrlSetData(-1, 60)
GuiCtrlSetData(-1, 75)
GuiCtrlSetData(-1, 80)
GuiCtrlSetData(-1, 85)
GuiCtrlSetData(-1, 96)
GuiCtrlCreateLabel("Status:", 10, 22, 100)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("26.10.2010"&@CRLF&"Version: 0.0.1", 240, 9, 150, -1, $ES_RIGHT)
GUICtrlSetFont(-1, 10, 400, 4, "Arial")
GuiCtrlCreateLabel("(Daten werden geladen bitte haben Sie etwas geduld)", 10, 55, 400, 30)
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
GUICtrlSetColor(-1, 0x000000)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
$image_path = (@ScriptDir & '\include01\')
$image_pathover = (@ScriptDir & '\include02\')
Global $hPic = -99
Global $hPicover = -99
$count = _FileListToArray($image_path, "*.gif", 1)
$countover = _FileListToArray($image_pathover, "*.gif", 1)
If Not IsArray($count) Then Exit MsgBox(16, "Fehler", "Fehlende Dateien in " & $image_path, 10)
If Not IsArray($countover) Then Exit MsgBox(16, "Fehler", "Fehlende Dateien in " & $image_pathover, 10)
$hGUI = GUICreate("Bild1 und Bild2 - Vorschau", 798, 655)
GUISetBkColor(0xFFFFFF)
$hComboover = _GUICtrlComboBoxEx_Create($hGUI, "", 640, 15, 70, 335, $CBS_DROPDOWNLIST)
Dim $bitmap_from_file[$countover[0] + 1]
_GDIPlus_Startup()
$iCX = 48
$iCY = 48
$hImageover = _GUIImageList_Create(48, 48, 5, 1)
For $i = 1 To $countover[0]
_GUIImageList_AddBitmapEx($hImageover, $image_pathover & "\" & $countover[$i], $iCX, $iCY)
Next
_GUICtrlComboBoxEx_SetImageList($hComboover, $hImageover)
For $i = 0 To $countover[0] - 1
_GUICtrlComboBoxEx_AddString($hComboover, $image_pathover & "\" & $countover[$i], $i, $i)
Next
_GUICtrlComboBoxEx_SetItemHeight($hComboover, 0, 51)
_GUICtrlComboBoxEx_SetCurSel($hComboover, 0)
$bottonover = GUICtrlCreateButton("Bild1 anzeigen", 715, 14, 60, 56, $BS_MULTILINE)
$hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 640, 76, 70, 335, $CBS_DROPDOWNLIST)
Dim $bitmap_from_file[$count[0] + 1]
_GDIPlus_Startup()
$iCX = 48
$iCY = 48
$hImage = _GUIImageList_Create(48, 48, 5, 1)
For $i = 1 To $count[0]
_GUIImageList_AddBitmapEx($hImage, $image_path & "\" & $count[$i], $iCX, $iCY)
Next
_GUICtrlComboBoxEx_SetImageList($hCombo, $hImage)
For $i = 0 To $count[0] - 1
_GUICtrlComboBoxEx_AddString($hCombo, $image_path & "\" & $count[$i], $i, $i)
Next
_GUICtrlComboBoxEx_SetItemHeight($hCombo, 0, 51)
_GUICtrlComboBoxEx_SetCurSel($hCombo, 0)
$botton = GUICtrlCreateButton("Bild2 anzeigen", 715, 75, 60, 56, $BS_MULTILINE)
$Textanzeigen1 = GUICtrlCreateButton("Text 1", 640, 350, 150, 25, $BS_CENTER)
$Textanzeigen2 = GUICtrlCreateButton("Text 2", 640, 380, 150, 25, $BS_CENTER)
$SaveButton = GUICtrlCreateButton("SAVE", 640, 410, 150, 25, $BS_CENTER)
$Software1 = GUICtrlCreateButton(" Soft1 Starten", 640, 440, 150, 25, $BS_CENTER)
$Info = GUICtrlCreateButton(" Info zur Software", 640, 470, 150, 25, $BS_CENTER)
$Button1 = GUICtrlCreateButton(" ", 640, 500, 150, 25, $BS_CENTER)
$Button2 = GUICtrlCreateButton(" ", 640, 530, 150, 25, $BS_CENTER)
$Button3 = GUICtrlCreateButton(" ", 640, 560, 150, 25, $BS_CENTER)
GUICtrlCreateLabel("Version: 0.0.1", 640, 630, 100, -1, $ES_LEFT)
GUICtrlSetFont(-1, 10, 400, 4, "Arial")
GUISetState(@SW_HIDE, $hGUI1)
GUISetState(@SW_SHOW, $hGUI)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $gui_event_close
_GDIPlus_Shutdown()
GUIDelete($hGUI)
Exit
Case $msg = $bottonover
$iItemover = _GUICtrlComboBoxEx_GetCurSel($hComboover)+1
$aItemover = _GUICtrlComboBoxEx_GetItem($hComboover,$iItemover)
$hImageover = _GDIPlus_BitmapCreateFromFile ($aItemover[0])
$iX = _GDIPlus_ImageGetWidth($hImageover)
$iY = _GDIPlus_ImageGetHeight($hImageover)
_GDIPlus_BitmapDispose($hImageover)
$iRatio = $iX / $iY
if $iRatio >= 1 Then
$iX = 300
$iY = 300
Else
$iY = 300
$iX = 300
EndIf
if $hPicover <> -99 then GUICtrlDelete($hPicover)
$hPicover = GUICtrlCreatePic($aItemover[0], 175, 110, $iX , $iY)
Case $msg = $botton
$iItem = _GUICtrlComboBoxEx_GetCurSel($hCombo)+1
$aItem = _GUICtrlComboBoxEx_GetItem($hCombo,$iItem)
$hImage = _GDIPlus_BitmapCreateFromFile ($aItem[0])
$iX = _GDIPlus_ImageGetWidth($hImage)
$iY = _GDIPlus_ImageGetHeight($hImage)
_GDIPlus_BitmapDispose($hImage)
$iRatio = $iX / $iY
if $iRatio >= 1 Then
$iX = 650
$iY = 600
Else
$iY = 650
$iX = 600
EndIf
if $hPic <> -99 then GUICtrlDelete($hPic)
$hPic = GUICtrlCreatePic($aItem[0], 0, 20, $iX, $iY)
Case $msg = $Info
If $Info Then ContinueLoop MsgBox(64, "Info: Bitte Lesen", "Bedienungsanleitung:"&@CRLF&""&@CRLF&"1. Motiv auswählen"&@CRLF&"Motiv anzeigen Button anklicken"&@CRLF&" "&@CRLF&"2. Produkt auswählen"&@CRLF&"Produkt anzeigen Button anklicken"&@CRLF&" "&@CRLF&" "&@CRLF&" ")
Exit
Case $msg = $Software1
ShellExecute("Soft1.exe")
Case $msg = $SaveButton
;~ $himg2 = _GDIPlus_ImageLoadFromFile($aItem[0])
;~ $himg3 = _GDIPlus_ImageLoadFromFile($aItemover[0])
$Save = FileSaveDialog("Speichere Bild", @ScriptDir, "JPG (*.JPG)")
;~ $ToBild2 = _GDIPlus_ImageGetGraphicsContext ($himg2)
;~ $iX = _GDIPlus_ImageGetWidth ($himg2)
;~ $iY = _GDIPlus_ImageGetHeight ($himg2)
;~ $iX2 = _GDIPlus_ImageGetWidth ($himg3)
;~ $iY2 = _GDIPlus_ImageGetHeight ($himg3)
;~ $a=_GDIPlus_GraphicsDrawImage ($ToBild2,$himg3, 400, 210)
;~ _GDIPlus_ImageSaveToFile($himg2, $Save & "")
_GDIPlus_Save_to_Image($Save, $hGUI, 640, 655)
If Not @error Then MsgBox(0, "Information", "Bild wurde gespeichert!")
;~ _GDIPlus_ImageDispose($himg2)
;~ _GDIPlus_ImageDispose($himg3)
;~ _GDIPlus_ImageDispose($himg3)
EndSelect
WEnd
; #FUNCTION# ====================================================================================================================
; Name...........: _GUIImageList_AddBitmapEx
; Description ...: Creates a bitmap from an image file (JPG, PNG, BMP, GIF, ICO, etc.) and adds it to the _GUIImageList control
; Syntax.........: _GUIImageList_AddBitmapEx($hWnd, $sFile, $iWidth, $iHeight)
; Parameters ....: $hWnd - file name where the icon should be extracted from (*.dll, *.ico, *.exe)
; $sFile - path to the bitmap that contains the image
; $iWidth - width of the _GUIImageList
; $iHeight - height of the _GUIImageList
; Return values .: Success - Returns 1
; Failure - @error
; Author ........: UEZ
; Version .......: 0.75 Build 2010-06-23 beta
; Remarks .......: <GDIPlus.au3> must be included and _GDIPlus_Startup() must be started to use GDI+ functions.
; Don't forget the _GDIPlus_Shutdown() when closing!
; ===============================================================================================================================
Func _GUIImageList_AddBitmapEx($hWnd, $sFile, $iWidth = 48, $iHeight = 48, $iIndex = 0)
If Not IsHWnd($hWnd) = 0 Or $sFile = "" Or Not FileExists($sFile) Or IsDeclared("ghGDIPDll") <> 1 Then Return SetError(1, 0, 0)
Local $bitmap_from_file = _GDIPlus_BitmapCreateFromFile($sFile)
If @error Then Return SetError(@error, @extended, 0)
Local $ext = StringRight($sFile, 3)
If $ext = "ico" Then
Local $aRet = DllCall("shell32", "long", "ExtractAssociatedIcon", "int", 0, "str", $sFile, "word*", 0)
If @error Then Return SetError(@error, @extended, 0)
Local $hIcon = $aRet[0]
Local $hDC = _WinAPI_GetDC(0) ;thanks to Yashied
Local $hBackDC = _WinAPI_CreateCompatibleDC($hDC)
Local $hBitmap = _WinAPI_CreateSolidBitmap(0, _WinAPI_GetSysColor($COLOR_MENU), $iWidth, $iHeight)
Local $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap)
_WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, 3)
_WinAPI_SelectObject($hBackDC, $hBackSv)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_DeleteDC($hBackDC)
_GUIImageList_Add($hWnd, $hBitmap)
_WinAPI_DeleteObject($hBitmap)
Else
Local $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)
Local $hClone = $aResult[6]
Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hClone)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $bitmap_from_file, 0, 0, $iWidth, $iHeight)
Local $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hClone)
_GUIImageList_Add($hWnd, $hBmp)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_BitmapDispose($hClone)
_WinAPI_DeleteObject($hBmp)
EndIf
_GDIPlus_BitmapDispose($bitmap_from_file)
Return SetError(0, 0, 1)
EndFunc
; #FUNCTION# =============================================================================
; Name...........: _GDIPlus_Save_to_Image
; Description ...: INTERNAL FUNCTION - save drawn image to file
; Syntax.........: _GraphGDIPlus_Reference_Pixel($file, $hWnd)
; Parameters ....: $file - filename
; $hWnd - handle to GUI
; Autor .........: ptrex, ProgAndy, UEZ
; =========================================================================================
Func _GDIPlus_Save_to_Image($file, $hWnd, $w, $h, $CLSID = "JPG")
Local $hDC, $memBmp, $memDC, $hImage, $size, $sCLSID, $err
If $file <> "" Or $hWnd <> "" Then
If $w < 1 And $h < 1 Then
$size = WinGetClientSize($hWnd)
$w = $size[0]
$h = $size[1]
EndIf
$hDC = _WinAPI_GetDC($hWnd)
$memDC = _WinAPI_CreateCompatibleDC($hDC)
$memBmp = _WinAPI_CreateCompatibleBitmap($hDC, $w, $h)
_WinAPI_SelectObject ($memDC, $memBmp)
_WinAPI_BitBlt($memDC, 0, 0, $w, $h, $hDC, 0, 0, 0x00CC0020) ; 0x00CC0020 = $SRCCOPY
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($memBmp)
$sCLSID = _GDIPlus_EncodersGetCLSID ($CLSID)
;~ _GDIPlus_ImageSaveToFile($hImage, $file)
If Not _GDIPlus_ImageSaveToFileEx ($hImage, $file & "." & StringLower($CLSID), $sCLSID) Then $err = 1
_GDIPlus_ImageDispose ($hImage)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($memDC)
_WinAPI_DeleteObject ($memBmp)
If $err Then Return SetError(2, 0, 0)
Return SetError(0, 0, 0)
Else
Return SetError(1, 0, 0)
EndIf
EndFunc
Da du mit GUICtrlCreatePic() arbeitest, kann man das BIld nicht einfach abspeichern, zumindest kenne ich keine Möglichkeit. Ansonsten ist GDI+ eine Möglichkeit.
Gruß,
UEZ
Da bin ich echt mal gespannt!
Gruß,
UEZ
Auch von mir ein herzliches
_ _ _ __ _ __ _ _
| || | __ _ | '_ \ | '_ \ | || |
| __ | / _` | | .__/ | .__/ \_, |
|_||_| \__,_| |_|__ |_|__ _|__/
_|"""""| _|"""""| _|"""""| _|"""""| _| """"|
"`-0-0-' "`-0-0-' "`-0-0-' "`-0-0-' "`-0-0-'
___ _ _ _ _ _ _
| _ ) (_) _ _ | |_ | |_ __| | __ _ | || |
| _ \ | | | '_| | _| | ' \ / _` | / _` | \_, |
|___/ _|_|_ _|_|_ _\__| |_||_| \__,_| \__,_| _|__/
_|"""""| _|"""""| _|"""""| _|"""""| _|"""""| _|"""""| _|"""""| _| """"|
"`-0-0-' "`-0-0-' "`-0-0-' "`-0-0-' "`-0-0-' "`-0-0-' "`-0-0-' "`-0-0-'
Alles anzeigen
Gruß,
UEZ
Hier mal ein Versuch mit GIMP:
Vielleicht hift's ja weiter!
Gruß,
UEZ