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?
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.
Pixel in Bitmap schreiben
-
- [ offen ]
-
crocojunk -
5. April 2010 um 16:25 -
Geschlossen -
Erledigt
-
-
1. Schreib kleiner!
2. Wenn du mit GDI+ arbeitest, kannst du diese Funktion verwenden:Spoiler anzeigen
[autoit]; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; 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)If @error Then Return SetError(@error, @extended, False)
[/autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_BitmapSetPixel -
HÄÄÄÄ???
Das funktioniert nicht ich hab alles versucht nur es klappt nicht...Spoiler anzeigen
[autoit]$xy = 0
[/autoit] [autoit][/autoit] [autoit]
$y = 0$hBitmap = "C:\Xyron\Bit1.bmp"
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$Width = @DesktopWidth
$Height = @DesktopHeightfor $x = 0 to $Width-1 step +1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$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); #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; 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)If @error Then Return SetError(@error, @extended, False)
[/autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_BitmapSetPixel -
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 habeSpoiler 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
[/autoit] [autoit][/autoit] [autoit]
For $iY = 0 To 10
_GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, 0xFF0000FF)
Next
Next_GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "\Test (Neu).bmp")
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_ImageDispose($hBitmap)
_GDIPlus_Shutdown()MsgBox(64, "Info", "Pixel von X=0 ; Y=0 bis X=10 ; Y=10 wurden auf 0xFF0000FF gesetzt.")
[/autoit] [autoit][/autoit] [autoit]; #FUNCTION# ====================================================================================================================
[/autoit] [autoit][/autoit] [autoit]
; 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)If @error Then Return SetError(@error, @extended, False)
[/autoit]
$GDIP_STATUS = $aResult[0]
Return $aResult[0] = 0
EndFunc ;==>_GDIPlus_BitmapSetPixel -
GDI+ kann ich nicht ich hab das nie kapiert kann mir das einer beibringen???
-
Ja klar ich schreib dir mal eben ein vollständiges Tutorial. Gib mir 5 Minuten
Wieso nutzt du nicht einfach mal die Forensuche und alternativ auch Google? -
Und die AutoIt Hilfe/Onlinehilfe!!!