• Ein einfaches und leider teilweise noch verbuggtes Paint mit folgenden Funktionen:

    Spoiler anzeigen

    -Freihand zeichnen
    -Linien zeichnen
    -Pipette
    -Eine etwas übereifrige Füllfunktion :D
    -Farben invertieren
    -in Graustufen umwandeln
    -Schwarzweiß umwandler
    -History und Undo/Redo Funktionen
    -ToolBox zum verändern der Pen Eigenschaften etc.
    -Menü zur Auswahl zwischen den Extras

    weitere Funktionen Folgen...
    Hoffe auf Lob und konstruktive Kritik ;)

    Edit: Die Toolbar Funktionen sind absichtlich ausgeklammert (bin noch auf der suche nach passenden Icons).

    Changelog: 1.1

    Spoiler anzeigen

    -Ich verwende jetzt Prog@ndys Methode um die Invertierung durchzuführen (vielen Dank übrigens).
    -Jetzt sind auch die Werkzeuge Ellipse/Kreis und Rechteck/Quadrat vorhanden (Strg füllt die Objekte aus, und Shift Wandelt jeweils Ellipse in Kreis und Rechteck in Quadrat um)


    Changelog: 1.2

    Spoiler anzeigen

    -Invert und Graustufen umwandlung, nun mit ColorMatrix umgesetzt (schnellere Berechnung)

  • Naja nette Idee aber überflüssig wie ich finde. Es gibt zich Tausend Bildbearbeitungsprogamme.

    Das finden von Rechtschreibfehlern muss sofort und unverzüglich dem Autor gemeldet werden. Das eigennützige Verwenden dieser Rechtschreibfehler ist strengstens untersagt und kann mit Freiheitsenzug bestraft werden.

  • Kanns mir jetzt grad nicht anschaun, freu mich aber schon drauf. :)

    Es wär gut, wenn man Ellipsen (Kreise bei gedrückter Strg-Taste), Rechtecke (Quadrate bei gedrückter Strg-Taste), Polygone, usw, zeichnen könnte.

    Zitat

    [Heute, 11:39] Raupi: Soll ich es dir machen?
    [Heute, 11:47] BugFix: "Soll ich es dir machen? " - also Raupi !! bitte nicht so öffentlich :rofl:

    Zitat

    [Heute, 11:51] BugFix: und ich werde es mir jetzt machen - das Mittagessen :P

    AMsg UDF v1.00.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%
    OwnStyle UDF Version 1.10.00 IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 100%

    Einmal editiert, zuletzt von H2112 (28. März 2010 um 15:09)

  • Zitat

    Naja nette Idee aber überflüssig wie ich finde. Es gibt zich Tausend Bildbearbeitungsprogamme.


    Das ist mir klar, aber ich habe es einfach nur aus Spaß geschrieben :)
    Ich benutze schließlich auch PaintShopPro und nicht dieses Programm :rofl:

  • Invertieren der Bitmaps funktioniert am besten so. (Oder gleich in Assembler-Code :P )

    Spoiler anzeigen
    [autoit]

    $BitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iWidth, $iHeight, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB)
    $Scan = DllStructGetData($BitmapData, "Scan0")
    $Stride = DllStructGetData($BitmapData, "Stride")

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

    For $iY = 0 To $iHeight - 1
    $PixelData = DllStructCreate("dword[" & $iWidth & ']', $Scan + ($iY * $Stride)) ; Eine Zeile als Struct
    For $iX = 1 To $iWidth
    $Color = DllStructGetData($PixelData, 1, $iX)
    DllStructSetData($PixelData, 1, BitOR(BitAND($Color, 0xFF000000), BitAND(BitNOT($Color), 0x00FFFFFF)), $iX) ; Alpha behalten, Farben komplett invertieren
    Next
    Next

    [/autoit]
  • Für Effekte solltest du mal nach Colormatrix googlen

    Hier ein Beispielscript:

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    Opt("TrayIconDebug",1)

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

    $sFile = FileOpenDialog("Wähle Bilddatei",@ScriptDir,"(*.jpg;*.bmp;*.png;*.gif)")

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

    _GDIPlus_Startup()
    $hImage = _GDIPlus_ImageLoadFromFile($sFile)
    $iH = _GDIPlus_ImageGetHeight($hImage)*96/_GDIPlus_ImageGetHorizontalResolution($hImage)
    $iW = _GDIPlus_ImageGetWidth($hImage)*96/_GDIPlus_ImageGetVerticalResolution($hImage)

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

    $hGui = GUICreate("Test", $iW, $iH)
    GUISetState()

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

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBitmap=_GDIPlus_BitmapCreateFromGraphics($iW, $iH,$hGraphics)
    $hContext=_GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsDrawImage($hContext, $hImage, 0, 0)
    GUIRegisterMsg($WM_ERASEBKGND, "_WM_ERASEBKGND")

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

    _WinAPI_RedrawWindow($hGui,0,0,5)
    MsgBox(0, "", "Original" & @LF & "Drücke Ok")

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

    $hImage1 = _ColorMatrix($hImage,"0.30,0.30,0.30,0,0|0.59,0.59,0.59,0,0|0.11,0.11,0.11,0,0|0,0,0,1,0|0,0,0,0,1")
    _GDIPlus_GraphicsDrawImage($hContext, $hImage1, 0, 0)
    _WinAPI_RedrawWindow($hGui,0,0,5)
    MsgBox(0, "", "Greyscale" & @LF & "Drücke Ok")
    _GDIPlus_ImageDispose($hImage1)

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

    $hImage1 = _ColorMatrix($hImage,"-1,0,0,0,0|0,-1,0,0,0|0,0,-1,0,0|0,0,0,1,0|0,0,0,0,1")
    _GDIPlus_GraphicsDrawImage($hContext, $hImage1, 0, 0)
    _WinAPI_RedrawWindow($hGui,0,0,5)
    MsgBox(0, "", "Invert" & @LF & "Drücke Ok")
    _GDIPlus_ImageDispose($hImage1)

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

    $hImage1 = _ColorMatrix($hImage,"1,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,1,0|0,0,0,0,1")
    _GDIPlus_GraphicsDrawImage($hContext, $hImage1, 0, 0)
    _WinAPI_RedrawWindow($hGui,0,0,5)
    MsgBox(0, "", "Red" & @LF & "Drücke Ok")
    _GDIPlus_ImageDispose($hImage1)

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

    $hImage1 = _ColorMatrix($hImage,"0,0,0,0,0|0,1,0,0,0|0,0,0,0,0|0,0,0,1,0|0,0,0,0,1")
    _GDIPlus_GraphicsDrawImage($hContext, $hImage1, 0, 0)
    _WinAPI_RedrawWindow($hGui,0,0,5)
    MsgBox(0, "", "Green" & @LF & "Drücke Ok")
    _GDIPlus_ImageDispose($hImage1)

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

    $hImage1 = _ColorMatrix($hImage,"0,0,0,0,0|0,0,0,0,0|0,0,1,0,0|0,0,0,1,0|0,0,0,0,1")
    _GDIPlus_GraphicsDrawImage($hContext, $hImage1, 0, 0)
    _WinAPI_RedrawWindow($hGui,0,0,5)
    MsgBox(0, "", "Blue" & @LF & "Drücke Ok")
    _GDIPlus_ImageDispose($hImage1)

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

    $hImage1 = _ColorMatrix($hImage,"1,1,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,1,0|0,0,0,0,1")
    _GDIPlus_GraphicsDrawImage($hContext, $hImage1, 0, 0)
    _WinAPI_RedrawWindow($hGui,0,0,5)
    MsgBox(0, "", "Yellow" & @LF & "Drücke Ok")
    _GDIPlus_ImageDispose($hImage1)

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

    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()

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

    Func _ColorMatrix($hImage,$sMatrix)
    Local $hGraphics=_GDIPlus_ImageGetGraphicsContext($hImage)
    Local $iWidth = _GDIPlus_ImageGetWidth($hImage)
    Local $iHeight = _GDIPlus_ImageGetHeight($hImage)
    Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    _GDIPlus_GraphicsDispose($hGraphics)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    Local $tColorMatrix = DllStructCreate("float[5];float[5];float[5];float[5];float[5]")
    Local $aMatrix=StringSplit(StringReplace($sMatrix,"|",","),","), $iCnt=0
    For $i=1 To 5
    For $j=1 To 5
    $iCnt+=1
    DllStructSetData($tColorMatrix, $i, $aMatrix[$iCnt], $j)
    Next
    Next
    Local $hImgAttrib = _GDIPlus_ImageAttributesCreate()
    _GDIPlus_ImageAttributesSetColorMatrix($hImgAttrib, 1, DllStructGetPtr($tColorMatrix))
    _GDIPlus_GraphicsDrawImageRectRectEx($hContext, $hImage, 0, 0, $iWidth, $iHeight, 0, 0, $iWidth, $iHeight, 2, $hImgAttrib)
    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_ImageAttributesDispose($hImgAttrib)
    Return $hBitmap
    EndFunc ;==>_GreyScale

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

    Func _WM_ERASEBKGND($hWnd, $iMsg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)
    Return True
    EndFunc

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

    Func _GDIPlus_ImageAttributesSetColorMatrix($hImgAttrib, $iColorAdjustType, $pColorMatrix = 0, $pGrayMatrix = 0, $iColorMatrixFlags = 0)
    Local $fEnable = 1, $aResult = DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", $iColorAdjustType, _
    "int", $fEnable, "ptr", $pColorMatrix, "ptr", $pGrayMatrix, "int", $iColorMatrixFlags)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_ImageAttributesSetColorMatrix

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

    ;;Creates ImageAttributes object
    Func _GDIPlus_ImageAttributesCreate()
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
    Return SetError($aResult[0], 0, $aResult[1])
    EndFunc ;==>_GDIPlus_ImageAttributesCreate

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

    ;;Deletes ImageAttributes object
    Func _GDIPlus_ImageAttributesDispose($hImgAttrib)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_ImageAttributesDispose

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

    ;; _GDIPlus_GraphicsDrawImageRectRectEx()
    ;; Same as _GDIPlus_GraphicsDrawImageRectRect(), but adds 1 optional parameter - $hImgAttrib (handle to ImageAttributes object)
    Func _GDIPlus_GraphicsDrawImageRectRectEx($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit = 2, $hImgAttrib = 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGraphics, "hwnd", $hImage, "int", $iDstX, "int", _
    $iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
    $iSrcHeight, "int", $iUnit, "ptr", $hImgAttrib, "int", 0, "int", 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectEx

    [/autoit]

    mfgE

  • Vielen Dank für das Beispiel, ich hab nur mal im MSDN Library nach ColorMatrix gesucht. :rolleyes:
    Ich hab zwar was gefunden, aber keine Ahnung gehabt wie ich das in einen DLLCall einbaue.

    Wenn das so weitergeht haben wir hier bald einen Paint Ersatz :rofl: