【问题标题】:How to crop bitmap in AutoIt?如何在 AutoIt 中裁剪位图?
【发布时间】:2017-10-19 15:30:33
【问题描述】:

我在下面有这段代码来打印位图图像,但我不想打印手柄的全尺寸。打印后是否可以只打印正方形或裁剪位图图像?我正在使用 AutoIt。

这是我第一次发问题,如有错误请见谅。

$hDDC = _WinAPI_GetDC($hWnd)

$hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iWidth, $iHeight)
$hCDC = _WinAPI_CreateCompatibleDC($hDDC)

_WinAPI_SelectObject($hCDC, $hBMP)

DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "hwnd", $hCDC, "int", 0)

_WinAPI_DeleteDC($hCDC)
_WinAPI_ReleaseDC($hWnd, $hDDC)

【问题讨论】:

标签: bitmap crop autoit


【解决方案1】:

您可以使用_GDIPlus_BitmapCloneArea 从位图中获取矩形。

您需要先包含该库:

 #include <GDIPlus.au3>

裁剪:

 $hClone = _GDIPlus_BitmapCloneArea ( $hBitmap, $nLeft, $nTop, $nWidth, $nHeight [, $iFormat = 0x00021808] )

一个稍微有用的例子:
https://www.autoitscript.com/forum/topic/164820-crop-an-image-from-file/

【讨论】:

    猜你喜欢
    • 2015-05-05
    • 2019-05-10
    • 1970-01-01
    • 2013-08-16
    • 1970-01-01
    • 2016-01-11
    • 2015-12-11
    • 2013-03-25
    • 2012-02-29
    相关资源
    最近更新 更多