Hiho,
angesporen von dem Thread [ offen ] Gdi+ Clone/Save
Hab ich diese UDF mal gemacht.
ClonePicDown
Spoiler anzeigen
#include <GDIplus.au3>
#Include <ScreenCapture.au3>
_ClonePicDown(@DesktopDir&"\Bild2Druck.JPG", @DesktopDir&"\test.jpg")
[/autoit] [autoit][/autoit] [autoit]Func _ClonePicDown($PfadZuBild,$PfadNeuerName)
; Greek
_GDIPlus_Startup()
$hImg1 = _GDIPlus_ImageLoadFromFile($PfadZuBild)
$H=_GDIPlus_ImageGetHeight($hImg1)
$W=_GDIPlus_ImageGetWidth($hImg1)
$hGDIBitmap = _ScreenCapture_Capture("",0,0,$W,$H*2)
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hGDIBitmap)
_WinAPI_DeleteObject($hGDIBitmap)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
$ImageAttributes = _GDIPlus_ImageAttributesCreate()
_GDIPlus_GraphicsDrawImageRectRectAttr($hGraphic, $hImg1, 0, 0, $W, $H, 0, 0, $W, $H, 2, $ImageAttributes)
_GDIPlus_GraphicsDrawImageRectRectAttr($hGraphic, $hImg1, 0, 0, $W, $H, 0, $H, $W, $H, 2, $ImageAttributes)
_GDIPlus_ImageSaveToFile($hBitmap, $PfadNeuerName)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImg1)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_ImageAttributesDispose($ImageAttributes)
_GDIPlus_Shutdown()
EndFunc
Func _GDIPlus_GraphicsDrawImageRectRectAttr($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit = 2, $pImageAttributes=0)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "ptr", $hGraphics, "ptr", $hImage, "int", $iDstX, "int", _
$iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
$iSrcHeight, "int", $iUnit, "ptr", $pImageAttributes, "ptr", 0, "ptr", 0)
If @error Then Return SetError(@error, @extended, False)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectAttr
Func _GDIPlus_ImageAttributesCreate()
; Prog@ndy
Local $aResult = DllCall($ghGDIpDLL, "int", "GdipCreateImageAttributes", "ptr*", 0)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0],0,$aResult[1])
EndFunc
Func _GDIPlus_ImageAttributesDispose($pImageAttributes)
; Prog@ndy
Local $aResult = DllCall($ghGDIpDLL, "int", "GdipDisposeImageAttributes", "ptr", $pImageAttributes)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0],0,$aResult[0]=0)
EndFunc
ClonePicRight
Spoiler anzeigen
#include <GDIplus.au3>
#Include <ScreenCapture.au3>
_ClonePicRight(@DesktopDir&"\Bild2Druck.JPG", @DesktopDir&"\test.jpg")
[/autoit] [autoit][/autoit] [autoit]Func _ClonePicRight($PfadZuBild,$PfadNeuerName)
; Greek
_GDIPlus_Startup()
$hImg1 = _GDIPlus_ImageLoadFromFile($PfadZuBild)
$H=_GDIPlus_ImageGetHeight($hImg1)
$W=_GDIPlus_ImageGetWidth($hImg1)
$hGDIBitmap = _ScreenCapture_Capture("",0,0,$W*2,$H)
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hGDIBitmap)
_WinAPI_DeleteObject($hGDIBitmap)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap)
$ImageAttributes = _GDIPlus_ImageAttributesCreate()
_GDIPlus_GraphicsDrawImageRectRectAttr($hGraphic, $hImg1, 0, 0, $W, $H, 0, 0, $W, $H, 2, $ImageAttributes)
_GDIPlus_GraphicsDrawImageRectRectAttr($hGraphic, $hImg1, 0, 0, $W, $H, $W, 0, $W, $H, 2, $ImageAttributes)
_GDIPlus_ImageSaveToFile($hBitmap, $PfadNeuerName)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_ImageDispose($hImg1)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_ImageAttributesDispose($ImageAttributes)
_GDIPlus_Shutdown()
EndFunc
Func _GDIPlus_GraphicsDrawImageRectRectAttr($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight, $iUnit = 2, $pImageAttributes=0)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "ptr", $hGraphics, "ptr", $hImage, "int", $iDstX, "int", _
$iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
$iSrcHeight, "int", $iUnit, "ptr", $pImageAttributes, "ptr", 0, "ptr", 0)
If @error Then Return SetError(@error, @extended, False)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectAttr
Func _GDIPlus_ImageAttributesCreate()
; Prog@ndy
Local $aResult = DllCall($ghGDIpDLL, "int", "GdipCreateImageAttributes", "ptr*", 0)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0],0,$aResult[1])
EndFunc
Func _GDIPlus_ImageAttributesDispose($pImageAttributes)
; Prog@ndy
Local $aResult = DllCall($ghGDIpDLL, "int", "GdipDisposeImageAttributes", "ptr", $pImageAttributes)
If @error Then Return SetError(1,@error,0)
Return SetError($aResult[0],0,$aResult[0]=0)
EndFunc
Hab besonders drauf geachtet sie zu schnell wie möglich zu machen.
Hoffe kann einer brauchen