Per GDI+ Text auf Bild schreiben

  • Hallo liebe User,

    nach dem Wälzen mehrerer Threads komme ich leider nicht weiter: Ich möchte zunächst Text auf Bilder schreiben. Und zwar auf alle innerhalb des bestimmten Ordners:

    [autoit]

    Global $FileSearch = FileFindFirstFile(@ScriptDir & "\source\*.jpg")
    If $FileSearch = -1 Then Exit

    [/autoit][autoit][/autoit][autoit]

    Local $file
    While 1
    $file = FileFindNextFile($FileSearch)
    If @error Then ExitLoop
    _Losung_Bild($file)
    WEnd

    [/autoit]

    Dabei handelt es sich um 5 Strings (in verschiedenen Schriftarten), die auf die Images "aufgedruckt" werden sollen. Danach soll das Bild abgespeichert werden. Das Resultat dient mir dann als Desktop-Wallpaper.

    Die von UEZ vorgeschlagene, von mir minimal angepasste Version (bitte Bilderpfade anpassen) findet ihr hier:

    Spoiler anzeigen
    [autoit]

    ; Quelle: UEZ
    #include <GDIPlus.au3>

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    Local $hBild = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\source\img001.jpg")
    Local $iX = _GDIPlus_ImageGetWidth($hBild)
    Local $iY = _GDIPlus_ImageGetHeight($hBild)

    [/autoit] [autoit][/autoit] [autoit]

    Local $text = "Beispieltext"

    [/autoit] [autoit][/autoit] [autoit]

    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iX, $iY)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hPinsel = _GDIPlus_BrushCreateSolid (0xFFFFFFFF)
    Local $hFormat = _GDIPlus_StringFormatCreate ()
    Local $hFamily = _GDIPlus_FontFamilyCreate ("English")
    Local $font_size = Floor(($iX - StringLen($text)) / 20)
    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)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImageRect($hContext, $hBild, 0, 0, $iX, $iY)

    [/autoit] [autoit][/autoit] [autoit]

    Local $fWidth = DllStructGetData($aInfo[0], "Width")
    Local $fHeight = DllStructGetData($aInfo[0], "Height")

    [/autoit] [autoit][/autoit] [autoit]

    DllStructSetData($tLayout, "x", $iX / 2 - Round($fWidth / 2, 0))
    DllStructSetData($tLayout, "y", $iY / 2 - Round($fHeight / 2, 0) - 2)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawStringEx ($hContext, $text, $hFont, $tLayout, $hFormat, $hPinsel)

    [/autoit] [autoit][/autoit] [autoit]

    _Exit()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\ready\img001.jpg")
    _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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit]

    Diese ist auch sehr aufschlussreich, und es funktioniert wunderbar. Aber ich möchte die Strings bestimmt positionieren: Alle sollen (übereinander angeordnet) in der unteren, rechten Bildecke erscheinen. Dieses aber mit einem gewissen Abstand von unten (da die Taskbar im Weg ist). Deshalb müssen sie meiner Meinung nach rechtsbündig ausgerichtet werden.

    Darüber hinaus würde ich gerne die ursprünglich weiße Schrift schwarz umranden, damit man auch auf hellen Wallpapers die Schrift erkennt. Absolut scharf wäre ja wohl zusätzlich noch die Erkennung der unteren Ecke, ob sie etwa zu hell ist und schwarz als Schriftfarbe nicht besser angebracht wäre, wahrscheinlich über PixelGet.... Das übersteigt aber mein können (weil es punktuell nicht reicht, wäre doof, wenn ich den einzigen hellen Pixel erwische) und stößt wieder Diskussionen an...

    Viele Grüße und bereits im Voraus herzlichen Dank für Hilfe in jeglicher Hinsicht,
    Matthias

    4 Mal editiert, zuletzt von MatthiasG. (30. November 2010 um 18:30)

  • Schrift in die rechte untere Ecke platzieren:
    XSchrift = Bildbreite - Schriftbreite
    YSchrift = BildHöhe - Schrifthöhe - 40 (für die Taskleiste)
    Wo liegt da das Problem? ?(

    Und die Schrift schwarz umranden könntest du so:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GDIP.au3>
    #include <GUIConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    $iGUIColorBG = 0xFFFFFFFF
    $iGUIWidth = 400
    $iGUIHeight = 400

    [/autoit] [autoit][/autoit] [autoit]

    $sString = "AutoIt"

    [/autoit] [autoit][/autoit] [autoit]

    $hWnd = GUICreate("GDI+ Schrift umranden by name22", $iGUIWidth, $iGUIHeight)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iGUIWidth, $iGUIHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)
    _GDIPlus_GraphicsClear($hBuffer, $iGUIColorBG)

    [/autoit] [autoit][/autoit] [autoit]

    $hPen1 = _GDIPlus_PenCreate(0xFF000000, 8)
    $hBrush1 = _GDIPlus_BrushCreateSolid(0xFF0000FF)

    [/autoit] [autoit][/autoit] [autoit]

    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script")
    $hFont = _GDIPlus_FontCreate($hFamily, 12, 2)
    $tLayout = _GDIPlus_RectFCreate(100, 100)

    [/autoit] [autoit][/autoit] [autoit]

    $hPath = _GDIPlus_PathCreate(1)
    _GDIPlus_PathAddString($hPath, $sString, $tLayout, $hFamily, 0, 60, $hFormat)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawPath($hBuffer, $hPath, $hPen1)
    _GDIPlus_GraphicsFillPath($hBuffer, $hPath, $hBrush1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iGUIWidth, $iGUIHeight)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    While Sleep(1000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_GraphicsDispose($hBuffer)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_PenDispose($hPen1)
    _GDIPlus_BrushDispose($hBrush1)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_Shutdown()
    Exit
    EndFunc

    [/autoit]


    Dafür brauchst du noch die GDIP.au3 die hier irgendwo im Forum rumfährt... Ah hier :D.

  • Hallo name22!

    Vielen Dank für deine Hilfe! Das Problem liegt darin, dass ich nicht weiß, wie ich ermittle, wie breit die Schrift ist. Ich benutze verschiedene Schriftarten, die nicht monospace sind. Die Funktion _GDIPlus_GraphicsMeasureString ($hContext, $text, $hFont, $tLayout, $hFormat) gibt mir ja eine $tagGDIPRECTF-Struktur zurück, mit der ich nichts anfangen kann.

    Gruß,
    Matthias

  • Eine $tagGDIPRECTF-Struktur kannst du mit DLLStructGetData auslesen ;).

    [autoit]

    $tLayout = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)
    $iX = DllStructGetData($tLayout, "x")
    $iY = DllStructGetData($tLayout, "y")
    $iWidth = DllStructGetData($tLayout, "width")
    $iHeight = DllStructGetData($tLayout, "height")

    [/autoit]
  • Hallo nochmal!

    Heißt das, dass diese beiden Zeilen:

    [autoit]

    $iWidth = DllStructGetData($tLayout, "width")
    $iHeight = DllStructGetData($tLayout, "height")

    [/autoit]

    Mir die gewünschten Daten, also Höhe und Breite des Strings, ausgeben?

    Was machen dann die beiden:

    [autoit]

    $iX = DllStructGetData($tLayout, "x")
    $iY = DllStructGetData($tLayout, "y")

    [/autoit]

    Viele Grüße,
    Matthias

  • Falls du die von name22 gepostete Variante mit dem Path anwenden möchtest, dann könntest du auch folgendes probieren:

    _Gdiplus_PathAddString ohne irgendwelche X-Y Einstellungen vorzunehmen
    mit _Gdiplus_PathGetWorldBounds bekommst du X,Y,W,H vom Path

    Mit einer Matrix (_gdiplus_matrixcreate, _gdiplus_matrixtranslate und _gdiplus_pathtransform)
    kannst du dann den Schriftzug an die gewünschte Position verschieben und dann zeichnen

    E


    Edit: und da ich grad Lust hatte, hab ich auch ein Beispiel erstellt:
    Die Farben des Bildes, die später unter dem Schriftzug liegen, werden ausgelesen und davon der durchschnittliche Lumawert ausgerechnet
    Wenn dieser größer als 100, dann wird eine schwarze Scrift erstellt, sonst eine weiße.

    Dieser Schritt benötigt natürlich Zeit und kann auch deaktiviert werden, wenns Schneller gehen soll

    Spoiler anzeigen
    [autoit]

    #include <GDIP.au3>
    #include <Color.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $hFormat = _GDIPlus_StringFormatCreate()
    $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $hBrush = _GDIPlus_BrushCreateSolid(0x6600FF00)
    $hPen = _GDIPlus_PenCreate(0xFF000000, 2)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $FileSearch = FileFindFirstFile(@ScriptDir & "\source\*.jpg")
    If $FileSearch = -1 Then Exit

    [/autoit] [autoit][/autoit] [autoit]

    Local $file
    While 1
    $file = FileFindNextFile($FileSearch)
    If @error Then ExitLoop
    _Losung_Bild(@ScriptDir & "\source\" & $file)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Losung_Bild($file, $sText = "abc")
    Local $hImage = _GDIPlus_ImageLoadFromFile($file)
    Local $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)

    [/autoit] [autoit][/autoit] [autoit]

    Local $iWidth = _GDIPlus_ImageGetWidth($hImage)
    Local $iHeight = _GDIPlus_ImageGetHeight($hImage)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, 50, $hFormat)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, $iWidth - $aBounds[0] - $aBounds[2] - 10, $iHeight - $aBounds[1] - $aBounds[3] - 40)
    _GDIPlus_PathTransform($hPath, $hMatrix)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_MatrixDispose($hMatrix)

    [/autoit] [autoit][/autoit] [autoit]

    Switch _BildHelligkeit($hImage, $hPath)
    Case 0
    _GDIPlus_BrushSetSolidColor($hBrush, 0x66FFFFFF)
    _GDIPlus_PenSetColor($hPen, 0xFFFFFFFF)
    Case Else
    _GDIPlus_BrushSetSolidColor($hBrush, 0x66000000)
    _GDIPlus_PenSetColor($hPen, 0xFF000000)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_GraphicsDispose($hGraphics)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_ImageSaveToFile($hImage, StringTrimRight($file, 4) & "_Text.jpg")

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_ImageDispose($hImage)
    EndFunc ;==>_Losung_Bild

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _BildHelligkeit($hBitmap, $hPath)
    Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)

    [/autoit] [autoit][/autoit] [autoit]

    Local $BitmapData = _GDIPlus_BitmapLockBits($hBitmap, $aBounds[0], $aBounds[1], $aBounds[2], $aBounds[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    Local $Stride = DllStructGetData($BitmapData, "Stride")
    Local $Width = DllStructGetData($BitmapData, "Width")
    Local $Height = DllStructGetData($BitmapData, "Height")
    Local $Scan0 = DllStructGetData($BitmapData, "Scan0")
    Local $PixelData, $Color, $Luma = 0, $iCnt = 0

    For $row = 0 To $Height - 1
    $PixelData = DllStructCreate("dword[" & $Width & ']', $Scan0 + ($row * $Stride))
    For $col = 0 To $Width - 1
    If _GDIPlus_PathIsOutlineVisiblePoint($hPath, $aBounds[0] + $col, $aBounds[1] + $row) Then
    $iCnt += 1
    $Color = DllStructGetData($PixelData, 1, $col + 1)
    $Luma += _ColorGetRed($Color) * 0.3 + _ColorGetGreen($Color) * 0.59 + _ColorGetBlue($Color) * 0.11
    EndIf
    Next
    Next
    _GDIPlus_BitmapUnlockBits($hBitmap, $BitmapData)
    $Luma /= $iCnt
    If $Luma > 100 Then Return 1
    Return 0
    EndFunc ;==>_BildHelligkeit

    [/autoit]
  • Hallo nochmal!

    eukalyptus, deine Lösung ist genial, aber: Wenn ich Sätze eingebe (etwas längeres), dann bricht das Programm ab, und Windows meldet, es würde nicht mehr funktionieren. Auch Kompilieren und Adminrechte funktionieren nicht. Was kann ich hier tun?

    Viele Grüße,
    Matthias

  • Hallo UEZ,

    generell habe ich deine UDF schon angetestet und habe sie als sehr hilfreich empfunden und wollte sie auch ursprünglich einsetzen. Jedoch gefällt mir die Lösung von eukalyptus ehrlich gesagt besser - das Ergebnis überzeugt einfach. Aber ich werde wohl eine Kombination beider vornehmen. Gefällt mir doch nicht, gibt es da keine Lösung, das Skript etwas zu verändern, sodass es läuft?

    Spoiler anzeigen
    [autoit]

    #include <GDIP.au3>
    #include <Color.au3>
    #include <String.au3>
    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $hFormat = _GDIPlus_StringFormatCreate()
    $tLayout = _GDIPlus_RectFCreate(0, 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $hBrush = _GDIPlus_BrushCreateSolid(0x6600FF00)
    $hPen = _GDIPlus_PenCreate(0xFF000000, 2)

    [/autoit] [autoit][/autoit] [autoit]

    Global $FileSearch = FileFindFirstFile(@ScriptDir & "\source\*.jpg")
    If $FileSearch = -1 Then Exit

    [/autoit] [autoit][/autoit] [autoit]

    Global $hImage, $hGraphics, $iWidth, $iHeight, $Path

    [/autoit] [autoit][/autoit] [autoit]

    Local $file
    While 1
    $file = FileFindNextFile($FileSearch)
    If @error Then ExitLoop

    [/autoit] [autoit][/autoit] [autoit]

    $Path = @ScriptDir & "\source\" & $file

    [/autoit] [autoit][/autoit] [autoit]

    $hImage = _GDIPlus_ImageLoadFromFile($Path)
    $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)

    [/autoit] [autoit][/autoit] [autoit]

    $iWidth = _GDIPlus_ImageGetWidth($hImage)
    $iHeight = _GDIPlus_ImageGetHeight($hImage)

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox(0, "", "0")
    _Losung_Bild($file, "Text1", "Arial", 50, 300, True)
    MsgBox(0, "", "1")
    _Losung_Bild($file, "Text2", "English", 70, 250)
    MsgBox(0, "", "2")
    _Losung_Bild($file, "Text3", "Arial", 30, 180)
    MsgBox(0, "", "3")
    _Losung_Bild($file, "Text4", "English", 70, 150)
    MsgBox(0, "", "4")
    _Losung_Bild($file, "Text5", "Arial", 30, 120)
    MsgBox(0, "", "5")
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit]

    Func _Losung_Bild($file, $sText, $font, $size, $Height, $special = False)
    Local $hFamily = _GDIPlus_FontFamilyCreate($font)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFamily, 0, $size, $hFormat)

    [/autoit] [autoit][/autoit] [autoit]

    Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)

    [/autoit] [autoit][/autoit] [autoit]

    Local $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, $iWidth - $aBounds[0] - $aBounds[2] - 10, $iHeight - $aBounds[1] - $aBounds[3] - $Height)
    _GDIPlus_PathTransform($hPath, $hMatrix)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_MatrixDispose($hMatrix)

    [/autoit] [autoit][/autoit] [autoit]

    Switch _BildHelligkeit($hImage, $hPath)
    Case 0
    _GDIPlus_BrushSetSolidColor($hBrush, 0x66FFFFFF)
    _GDIPlus_PenSetColor($hPen, 0xFFFFFFFF)
    Case Else
    _GDIPlus_BrushSetSolidColor($hBrush, 0x66000000)
    _GDIPlus_PenSetColor($hPen, 0xFF000000)
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush)
    _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_GraphicsDispose($hGraphics)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\ready\" & $file)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_ImageDispose($hImage)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_FontFamilyDispose($hFamily)
    EndFunc ;==>_Losung_Bild

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _BildHelligkeit($hBitmap, $hPath)
    Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)

    [/autoit] [autoit][/autoit] [autoit]

    Local $BitmapData = _GDIPlus_BitmapLockBits($hBitmap, $aBounds[0], $aBounds[1], $aBounds[2], $aBounds[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB)
    Local $Stride = DllStructGetData($BitmapData, "Stride")
    Local $Width = DllStructGetData($BitmapData, "Width")
    Local $Height = DllStructGetData($BitmapData, "Height")
    Local $Scan0 = DllStructGetData($BitmapData, "Scan0")
    Local $PixelData, $Color, $Luma = 0, $iCnt = 0

    [/autoit] [autoit][/autoit] [autoit]

    For $row = 0 To $Height - 1
    $PixelData = DllStructCreate("dword[" & $Width & ']', $Scan0 + ($row * $Stride))
    For $col = 0 To $Width - 1
    If _GDIPlus_PathIsOutlineVisiblePoint($hPath, $aBounds[0] + $col, $aBounds[1] + $row) Then
    $iCnt += 1
    $Color = DllStructGetData($PixelData, 1, $col + 1)
    $Luma += _ColorGetRed($Color) * 0.3 + _ColorGetGreen($Color) * 0.59 + _ColorGetBlue($Color) * 0.11
    EndIf
    Next
    Next
    _GDIPlus_BitmapUnlockBits($hBitmap, $BitmapData)
    $Luma /= $iCnt
    If $Luma > 100 Then Return 1
    Return 0
    EndFunc ;==>_BildHelligkeit

    [/autoit]

    Edit: Es passiert mit der Schrift English: http://www.dafont.com/english.font Irgendeine Beziehung?

    Vielen Dank allerseits,
    Matthias

    2 Mal editiert, zuletzt von MatthiasG. (30. November 2010 um 18:35)