Lasse $WS_BORDER in Zeile 56 einfach weg.
Gruß,
UEZ
Lasse $WS_BORDER in Zeile 56 einfach weg.
Gruß,
UEZ
Du kannst mal
[autoit]
GUICtrlSetFont (-1,10,400,0,"Arial", 4)
probieren.
Gruß,
UEZ
Lasse doch die Transparenz vom Label weg und setze die Hintergrundfarbe vom Label schwarz.
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
Global Const $hImage_BG = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\background.png")
Global Const $iW = _GDIPlus_ImageGetWidth($hImage_BG)
Global Const $iH = _GDIPlus_ImageGetHeight($hImage_BG)
Global Const $hGUI = GUICreate("", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST)
SetTransparentBitmap($hGUI, $hImage_BG)
Global Const $iFW = 90
Global Const $iFH = 50
Global Const $hGUI_Child = GUICreate("", $iFW, $iFH, 100, 100, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
Global Const $idLabel = GUICtrlCreateLabel("Test", 0, 0, $iFW, $iFH)
GUICtrlSetBkColor(-1, 0)
GUICtrlSetColor(-1, 0xF0F0F0)
GUICtrlSetFont(-1, 32, 400, 0, "Arial", 4)
GUISetState(@SW_SHOW, $hGUI)
GUISetState(@SW_SHOW, $hGUI_Child)
_GDIPlus_ImageDispose($hImage_BG)
[/autoit] [autoit][/autoit] [autoit]Global Const $SC_DRAGMOVE = 0xF012
GUIRegisterMsg($WM_LBUTTONDOWN, "_WM_LBUTTONDOWN")
Do
Until GUIGetMsg() = -3
_GDIPlus_Shutdown()
Exit
Func _WM_LBUTTONDOWN($hWnd, $iMsg, $wParam, $lParam)
_SendMessage($hWnd, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0)
EndFunc ;==>_WM_LBUTTONDOWN
Func SetTransparentBitmap($hGUI, $hImage, $iOpacity = 0xFF)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
_WinAPI_ReleaseDC(0, $hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", 1)
_WinAPI_UpdateLayeredWindow($hGUI, 0, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>SetTransparentBitmap
Gruß,
UEZ
Andy: Feine Sache! Genau sowas hatte ich mir vorgestellt, aber mit ASM bin ich seit der Primzahlen Geschichte nicht mehr vertraut, obwohl so viel Potential darin steckt!
Gruß,
UEZ
Es ist weder GDI+ noch QuickDraw das Problem, sondern AutoIt!
256*256=256^2= 65536 Schleifendurchgänge sind für AutoIt als Intepretersprache leider zu langsam. ASM würde dir hier sehr wahrscheinlich weiterhelfen!
Gruß,
UEZ
Herzlichen Glückwunsch Mr. GDI+ und alles Gute!
Ich hoffe weitere ultra coole GDI+ Demos zu sehen! ![]()
Gruß,
UEZ
In AutoIt Windows Screenshooter v1.43 Build 2012-02-16 Final habe ich das implementiert. Du kannst das Vorschaubild mit der Maus bewegen und mit dem Mausrad rein- bzw. rauszoomen.
Gruß,
UEZ
Vielleicht so was?
[autoit]
#include <Array.au3>
$days = "So;So,Mo;Mo,Di;Di,Mi;Mi,Do;Do,Fr;Fr,Sa;Sa"
$aDays = StringSplit(StringRegExpReplace($days, "(\w+);(\w+)", "$1"), ",", 2)
_ArrayDisplay($aDays)
Gruß,
UEZ
Bis ich den Code fertig bekommen habe, hast du es bereits selbst hinbekommen!
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Opt("GuiOnEventMode", 1)
OnAutoItExitRegister("_end")
[/autoit] [autoit][/autoit] [autoit]$chipsetpfad = FileOpenDialog("Chipset", @ScriptDir & "\", "Bilder (*.png)", 1)
_GDIPlus_Startup()
$chipset = _GDIPlus_ImageLoadFromFile($chipsetpfad)
$iW = _GDIPlus_ImageGetWidth($chipset)
$iH = _GDIPlus_ImageGetHeight($chipset)
$newchipset = GUICreate("Neues Chipset", $iW, $iH)
GUISetState(@SW_SHOW)
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($newchipset)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGraphics)
$hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsDrawImage($hGraphics, $chipset, 0, 0)
_GDIPlus_GraphicsDrawImage($hContext, $chipset, 0, 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUISetOnEvent($GUI_EVENT_PRIMARYUP, "getPixelcolor")
While 1
Sleep(100)
WEnd
Func getPixelcolor()
$pos = MouseGetPos()
$pix = PixelGetColor($pos[0], $pos[1])
$sMsgText = StringFormat("Der hexadezimale Wert der Farbe ist: %#06x\t", $pix)
MsgBox(0, "PixelGetColor", $sMsgText)
Local $x, $y, $aResult, $iColor
For $y = 0 To $iH -1
For $x = 0 To $iW - 1
$aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapGetPixel", "hwnd", $hBitmap, "int", $x, "int", $y, "uint*", 0)
$iColor = $aResult[4]
If (("0x" & Hex($iColor, 6)) / $pix) = 1 Then DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $x, "int", $y, "uint", "0x00" & Hex($pix, 6))
Next
Next
_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Test.png")
_end()
EndFunc ;==>getPixelcolor
Func CLOSEClicked()
_end()
EndFunc ;==>CLOSEClicked
Func _end()
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_ImageDispose($chipset)
_GDIPlus_Shutdown()
ShellExecute(@ScriptDir & "\Test.png")
Exit
EndFunc ;==>_end
Die Ideen waren die Gleichen!
Gruß,
UEZ
Habe Post#7 aktualisiert!
Gruß,
UEZ
Hier meine Version:
#include-once
#include <String.au3>
Global $ip = "32.64.0.3"
MsgBox(0, "IP Address to Binary String", "IP = " & @TAB & $ip & @LF & "Binary = " & @TAB & IPv4toBIN($ip))
Global $sBin = "10000001 111000 1010 00001111"
MsgBox(0, "Binary String to IP Address", "Binary = " & @TAB & $sBin & @LF & "IP = " & @TAB & BINtoIPv4($sBin))
;===============================================================================
; Function Name: IPv4toBIN
; Description: Converts an IP v4 string to a binary string format
; Parameter(s): $sIP: the ip v4 address with a format "a.b.c.d"
; $bLen8
; True: output binary string length is always 8 digits
; False: output is truncated to minimum length
; Requirement(s): String.au3
; Return Value(s): binary string format of all octets from the ip address with a format "a b c d"
;Error Codes: 1: ip adress not in appropiate format
; 2: invalid ip token size -> must be between 0 and 255
; Author(s): UEZ
;Version: v0.99 Build 2012-02-28
;===============================================================================
Func IPv4toBIN($sIP, $bLen8 = True)
Local $aIPTokens = StringRegExp($sIP, "(\d+)\.(\d+)\.(\d+)\.(\d+)", 3)
If @error Then Return SetError(1, 0, -1)
Local $bin, $sBin, $i
For $i = 0 To 3
If Int($aIPTokens[$i]) Then
If $aIPTokens[$i] > 255 Then Return SetError(2, 0, -1)
While $aIPTokens[$i] > 0
$bin &= Mod($aIPTokens[$i], 2)
$aIPTokens[$i] = Floor($aIPTokens[$i] / 2)
WEnd
Else
If $bLen8 Then
$bin = "00000000"
Else
$bin = "0"
EndIf
EndIf
If $bLen8 Then
$sBin &= StringFormat("%0.8i", _StringReverse($bin)) & " "
Else
$sBin &= _StringReverse($bin) & " "
EndIf
$bin = ""
Next
Return StringMid($sBin, 1, StringLen($sBin) - 1)
EndFunc
;===============================================================================
; Function Name: BINtoIPv4
; Description: Converts a binary string format to an IP v4 string
; Parameter(s): $sBin: the binary string with format "a b c d"
; Requirement(s): String.au3
; Return Value(s): the ip address in format "a.b.c.d"
;Error Codes: 1: string is not a binary string
; 2: too much tokens
; Author(s): UEZ
;Version: v0.99 Build 2012-02-28
;===============================================================================
Func BINtoIPv4($sBin) ;coded by UEZ 2012
Local $aIPTokens = StringRegExp($sBin, "[01]{1,8}", 3)
If @error Then Return SetError(1, 0, -1)
If UBound($aIPTokens) <> 4 Then Return SetError(2, 0, -1)
Local $sIP, $int, $x, $y, $i = 1, $aTmp
For $y = 0 To 3
$aTmp = StringSplit(_StringReverse($aIPTokens[$y]), "")
For $x = 1 To UBound($aTmp) - 1
$int += $aTmp[$x] * $i
$i *= 2
Next
$sIP &= $int & "."
$int = 0
$i = 1
$aTmp = 0
Next
Return StringMid($sIP, 1, StringLen($sIP) - 1)
EndFunc
Gruß,
UEZ
Meinst du so was?
#include <GuiConstants.au3>
#include <GdiPlus.au3>
OnAutoItExitRegister("_end")
[/autoit] [autoit][/autoit] [autoit]$Gui = GUICreate("Beispiel", 500, 600)
$iLabel = GUICtrlCreateLabel("", 11, 10, 188, 23)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($Gui)
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Backgrounds\gui_background5.jpg")
_GDIPlus_GraphicsDrawImage($hGraphics, $hImage, 0, 0)
$hImage2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Backgrounds\gui_background_label.jpg")
_GDIPlus_GraphicsDrawImage($hGraphics, $hImage2, 11,10)
_GDIPlus_StringFormatCreate(0x0001,0)
$c = 0
[/autoit] [autoit][/autoit] [autoit]While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
_end()
Exit
EndSwitch
$aMPos = GUIGetCursorInfo($Gui)
If IsArray($aMPos) Then
If $aMPos[4] = $iLabel Then
If $c Then
_GDIPlus_GraphicsDrawImage($hGraphics, $hImage2, 11,10)
_GDIPlus_GraphicsDrawString($hGraphics,"Es wurde 'A' 10 mal gedrückt.", 15,12)
$c = 0
EndIf
Else
If Not $c Then
_GDIPlus_GraphicsDrawImage($hGraphics, $hImage2, 11,10)
$c = 1
EndIf
EndIf
EndIf
WEnd
Func _end()
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ImageDispose($hImage2)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
EndFunc
Gruß,
UEZ
Warum das Rad neu erfinden?
In der GDIp.au3 ist bereits die Funktion _GDIPlus_GraphicsSetInterpolationMode() implementiert, die beim Scalen eines Bildes 7 verschiedene Interploationsmodis mitbringt.
; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsSetInterpolationMode
; Description ...: Sets the interpolation mode of a Graphics object
; Syntax.........: _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
; Parameters ....: $hGraphics - Pointer to a Graphics object
; $iInterpolationMode - Interpolation mode:
; |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 - False and either:
; |@error and @extended are set if DllCall failed
; |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: The interpolation mode determines the algorithm that is used when images are scaled or rotated
; Related .......: _GDIPlus_GraphicsGetInterpolationMode
; Link ..........; @@MsdnLink@@ GdipSetInterpolationMode
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hGraphics, "int", $iInterpolationMode)
If @error Then Return SetError(@error, @extended, False)
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_GraphicsSetInterpolationMode
Gruß,
UEZ
Sorry, ich verstehe nicht ganz was du machen willst.
Hilft dir das hier weiter?
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$Breite = 600
$Hoehe = 400
$y = 110
$TestGUI = GUICreate("Test", $Breite, $Hoehe, 192, 124)
$NeuZeichnen = GUICtrlCreateButton("Neu zeichnen", 424, 48, 75, 25)
GUISetState(@SW_SHOW)
$iRGB = "0xFF" & _WinAPI_GetGUIBkColor($TestGUI)
Global $sFile = StringReplace(@AutoItExe, "autoit3.exe", "Examples\GUI\Torus.png")
$Grafik = _GDIPlus_GraphicsCreateFromHWND($TestGUI)
$Bitmap = _GDIPlus_BitmapCreateFromGraphics($Breite/2, $Hoehe, $Grafik)
$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)
$hHintergrund = _GDIPlus_ImageLoadFromFile($sFile)
_GDIPlus_GraphicsClear($Buffer, $iRGB)
_GDIPlus_GraphicsDrawImage($Buffer, $hHintergrund, 0, 50)
_GDIPlus_GraphicsDrawString($Buffer, "Test1", 70, 110)
_GDIPlus_GraphicsDrawImage($Grafik, $Bitmap, 0, 0)
AdlibRegister("Scroll", 50)
$i = 2
While Sleep(10)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
AdlibUnRegister("Scroll")
_GDIPlus_ImageDispose($hHintergrund)
_GDIPlus_GraphicsDispose($Buffer)
_GDIPlus_BitmapDispose($Bitmap)
_GDIPlus_GraphicsDispose($Grafik)
_GDIPlus_Shutdown()
Exit
Case $NeuZeichnen
$i += 1
EndSwitch
WEnd
Func Scroll()
_GDIPlus_GraphicsClear($Buffer, $iRGB)
_GDIPlus_GraphicsDrawImage($Buffer, $hHintergrund, 0, 50)
_GDIPlus_GraphicsDrawString($Buffer, "Test" & $i, 70, $y)
_GDIPlus_GraphicsDrawImage($Grafik, $Bitmap, 0, 0)
If $y = -10 Then $y = $Hoehe
$y -= 1
EndFunc
Func _WinAPI_GetGUIBkColor($hWnd) ;taken from WinAPIEx.au3
Local $hDC = _WinAPI_GetDC($hWnd)
If Not $hDC Then Return SetError(1, 0, 0)
Local $bgcolor = DllCall("GDI32.dll", "int", "GetBkColor", "hwnd", $hDC)
If @error Or $bgcolor[0] = -1 Then Return SetError(2, 0, 0)
_WinAPI_ReleaseDC($hWnd, $hDC)
$bgcolor = $bgcolor[0] ;BGR
$bgcolor = Hex(BitOR(BitAND($bgcolor, 0x00FF00), BitShift(BitAND($bgcolor, 0x0000FF), -16), BitShift(BitAND($bgcolor, 0xFF0000), 16)), 6) ;convert to RGB
Return $bgcolor ;return RGB
EndFunc
Gruß,
UEZ
Es kommt darauf an, was du genau machen willst! Wenn du "nur" Test1 löschen und Test2 schreiben möchtest, dann mache das lieber mit GUICtrlCreateLabel().
Probiere es mal damit:
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$Breite = 600
$Hoehe = 400
$TestGUI = GUICreate("Test", $Breite, $Hoehe, 192, 124)
$NeuZeichnen = GUICtrlCreateButton("Neu zeichnen", 424, 48, 75, 25)
GUISetState(@SW_SHOW)
$iRGB = "0xFF" & _WinAPI_GetGUIBkColor($TestGUI)
$Grafik = _GDIPlus_GraphicsCreateFromHWND($TestGUI)
$Bitmap = _GDIPlus_BitmapCreateFromGraphics($Breite/2, $Hoehe, $Grafik)
$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)
_GDIPlus_GraphicsClear($Buffer, $iRGB)
_GDIPlus_GraphicsDrawString($Buffer, "Test1", 170, 110)
_GDIPlus_GraphicsDrawImage($Grafik, $Bitmap, 0, 0)
$i = 2
[/autoit] [autoit][/autoit] [autoit]While Sleep(10)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_GDIPlus_GraphicsDispose($Buffer)
_GDIPlus_BitmapDispose($Bitmap)
_GDIPlus_GraphicsDispose($Grafik)
_GDIPlus_Shutdown()
Exit
Case $NeuZeichnen
_GDIPlus_GraphicsClear($Buffer, $iRGB)
_GDIPlus_GraphicsDrawString($Buffer, "Test" & $i, 170, 110)
_GDIPlus_GraphicsDrawImage($Grafik, $Bitmap, 0, 0)
$i +=1
EndSwitch
WEnd
Func _WinAPI_GetGUIBkColor($hWnd) ;taken from WinAPIEx.au3
Local $hDC = _WinAPI_GetDC($hWnd)
If Not $hDC Then Return SetError(1, 0, 0)
Local $bgcolor = DllCall("GDI32.dll", "int", "GetBkColor", "hwnd", $hDC)
If @error Or $bgcolor[0] = -1 Then Return SetError(2, 0, 0)
_WinAPI_ReleaseDC($hWnd, $hDC)
$bgcolor = $bgcolor[0] ;BGR
$bgcolor = Hex(BitOR(BitAND($bgcolor, 0x00FF00), BitShift(BitAND($bgcolor, 0x0000FF), -16), BitShift(BitAND($bgcolor, 0xFF0000), 16)), 6) ;convert to RGB
Return $bgcolor ;return RGB
EndFunc
Gruß,
UEZ
Schaue mal hier rein, ob das Performant genug ist: ArrayUnique ohne Bug´s und Schneller
Vergiss es, geht am Thema vorbei!
Sorry,
UEZ
Kurz und elegant gelöst! ![]()
Top!
Gruß,
UEZ
Ich habe noch nie Fasching gemocht und werde es sehr wahrscheinlich auch nie mögen, aber ich liebe den Karnveval in Rio...
http://www.brazilcarnival.com.br/videos ![]()
Gruß,
UEZ
Vielleicht so?
#include <String.au3>
#include <StaticConstants.au3>
Global $startcd = 10
$hGUI = GUICreate("Test", 200, 100)
$idLabel = GUICtrlCreateLabel(".......... "& $startcd & " ..........", 0, 40, 200, 50, $SS_CENTER)
GUICtrlSetFont(-1, 10)
GUISetState()
AdlibRegister("Countdown", 99)
[/autoit] [autoit][/autoit] [autoit]Do
Until GUIGetMsg() = -3
AdlibUnRegister("Countdown")
Exit
Func Countdown()
Local Static $c = 10
If Not $startcd Then AdlibUnRegister("Countdown")
Local $s = _StringRepeat(".", $c)
GUICtrlSetData($idLabel, $s & " " & $startcd & " " & $s)
$c = Mod($c - 1, 10)
If Not $c Then
$c = 10
$startcd -= 1
EndIf
EndFunc
Gruß,
UEZ
Schaue dir doch mal in der Help Datei unter InputBox den 9. Parameter an ![]()
Gruß,
UEZ