Pixel in Bitmap schreiben

  • Hey, ich hab mal wieder ne Frage:
    Ich möchte eine Bitmap erstellen lassen und dann ein Pixel mit genauen Coordianten und Farbe in diese Datei schreiben lassen.
    Ist das möglich? 8|
    Wenn ja wär das geil, wenn nicht muss ich wieder auf die alte Screenshot Funktion umsteigen, welche ich jedoch nicht so schön finde, da sie sehr langsam ist.
    Zweite Frage:
    Kann man ein Video vom Desktop aufnehmen??? 
    So das wärs dann. Ich erhoffe GUTE Antworten und keinen DRECK!
    Wenn nicht möglich ist ist's auch nicht schlimm.
    :thumbup: :thumbup: :thumbup:

  • 1. Schreib kleiner! :cursing:
    2. Wenn du mit GDI+ arbeitest, kannst du diese Funktion verwenden:

    Spoiler anzeigen
    [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_BitmapSetPixel
    ; Description ...: Sets the color of a specified pixel in this bitmap
    ; Syntax.........: _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, $iARGB)
    ; Parameters ....: $hBitmap - Pointer to the Bitmap object
    ; $iX - The X coordinate of the pixel
    ; $iY - The Y coordinate of the pixel
    ; $iARGB - The new color of the pixel
    ; 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 .......: None
    ; Related .......: _GDIPlus_BitmapGetPixel
    ; Link ..........; @@MsdnLink@@ GdipBitmapSetPixel
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, $iARGB)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "uint", $iARGB)

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

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_BitmapSetPixel

    [/autoit]
  • HÄÄÄÄ??? :?: :?: :?: :?: :?: :?:
    ?( ?( ?( ?( ?(
    Das funktioniert nicht ich hab alles versucht nur es klappt nicht...

    Spoiler anzeigen
    [autoit]

    $xy = 0
    $y = 0

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

    $hBitmap = "C:\Xyron\Bit1.bmp"
    $Width = @DesktopWidth
    $Height = @DesktopHeight

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

    for $x = 0 to $Width-1 step +1
    $XCOLOR = PixelGetColor( $x, $xy )
    _GDIPlus_BitmapSetPixel($hBitmap, $x, $xy, $XCOLOR)
    Next
    for $yx = 0 to $Height-1 step +1
    $YCOLOR = pixelgetcolor( $x, $yx)
    _GDIPlus_BitmapSetPixel($hBitmap, $x, $yx, $YCOLOR)
    Next
    msgbox( 64, "Fertig", "Fertig", 5)

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_BitmapSetPixel
    ; Description ...: Sets the color of a specified pixel in this bitmap
    ; Syntax.........: _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, $iARGB)
    ; Parameters ....: $hBitmap - Pointer to the Bitmap object
    ; $iX - The X coordinate of the pixel
    ; $iY - The Y coordinate of the pixel
    ; $iARGB - The new color of the pixel
    ; 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 .......: None
    ; Related .......: _GDIPlus_BitmapGetPixel
    ; Link ..........; @@MsdnLink@@ GdipBitmapSetPixel
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _GDIPlus_BitmapSetPixel($hBitmap, $x, $y, $iARGB)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $x, "int", $y, "uint", $iARGB)

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

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_BitmapSetPixel

    [/autoit]
  • Ich hab dir gesagt, dass du dafür mit GDI+ arbeiten musst...
    Ich schreib dir jetzt mal ein Beispiel weil ich grad nichts zu tun habe 8)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>

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

    _GDIPlus_Startup()

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

    $hBitmap = _GDIPlus_BitmapCreateFromFile(FileOpenDialog("Bild öffnen", @ScriptDir, "Bilder (*.png;*.jpg;*.bmp)"))

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

    For $iX = 0 To 10
    For $iY = 0 To 10
    _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFF0000FF)
    Next
    Next

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

    _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Test (Neu).bmp")
    _GDIPlus_ImageDispose($hBitmap)
    _GDIPlus_Shutdown()

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

    MsgBox(64, "Info", "Pixel von X=0 ; Y=0 bis X=10 ; Y=10 wurden auf 0xFF0000FF gesetzt.")

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_BitmapSetPixel
    ; Description ...: Sets the color of a specified pixel in this bitmap
    ; Syntax.........: _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, $iARGB)
    ; Parameters ....: $hBitmap - Pointer to the Bitmap object
    ; $iX - The X coordinate of the pixel
    ; $iY - The Y coordinate of the pixel
    ; $iARGB - The new color of the pixel
    ; 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 .......: None
    ; Related .......: _GDIPlus_BitmapGetPixel
    ; Link ..........; @@MsdnLink@@ GdipBitmapSetPixel
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _GDIPlus_BitmapSetPixel($hBitmap, $x, $y, $iARGB)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $x, "int", $y, "uint", $iARGB)

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

    If @error Then Return SetError(@error, @extended, False)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_BitmapSetPixel

    [/autoit]