running-frag
why me?
- Сообщения
- 441
- Репутация
- 60
задача вот какая есть окно с которого получаем данные (скрины), нужно перерисовать заданный участок скрина в GUI, при условии что мы после хотим выбирать опред. участок (уже в GUI) этого скрина
вот часть кода который получилось выудить, но переделать полностью пока не удаётся
Так же хочется что бы отображалось (перерисовывалось) в сетке (пример)
ps: изначально код был из "экранной лупы"
Добавлено:
Покурил немного. Выводить можно так.
Нужна помощь в создании массива который будет пропускаться через цикл "заливая" нужный двадраты нужным цветом.
вот часть кода который получилось выудить, но переделать полностью пока не удаётся
Код:
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
#ce ----------------------------------------------------------------------------
Opt ("MustDeclareVars", 1)
Opt ("MouseCoordMode", 2)
Opt ("PixelCoordMode", 2)
#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>
Local $iX = 300
Local $iY = 300
HotKeySet('{ESC}', '_Quit')
Local $hAction
Local $hGUI = GUICreate ("detector", 300, 300) ; main gui
Local $hExpand = GUICtrlCreateLabel ("", 100, 100) ; zone for rewrite image
Local $hForm = GUICreate ("", 200, 200, -1, -1, BitOR ($WS_DISABLED, $WS_POPUPWINDOW), BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST), $hGUI);old
GUISetState(@SW_SHOW, $hForm)
;GUISetState(@SW_SHOW, $hGUI)
While 1
$hAction = GUIGetMsg ()
_Capture($iX, $iY, 50, 50)
Sleep(1)
WEnd
Func _Capture($iX, $iY, $iWidth, $iHeight)
Local $tRect, $hDC, $hMemDC, $hBitmap, $hScreenshort
$hScreenshort = _ScreenCapture($iX, $iY, $iWidth, $iHeight)
$hBitmap = _WinAPI_ResizeBitmap($hScreenshort, 200, 200)
_WinAPI_DeleteObject($hScreenshort)
$hDC = _WinAPI_GetDC($hForm)
$hMemDC = _WinAPI_CreateCompatibleDC($hDC)
_WinAPI_SelectObject($hMemDC, $hBitmap)
_WinAPI_SelectObject($hMemDC, _WinAPI_GetStockObject($NULL_BRUSH))
_WinAPI_SelectObject($hMemDC, _WinAPI_GetStockObject($DC_PEN))
_WinAPI_SetDCPenColor($hMemDC, 0xA00000)
$tRect = _WinAPI_CreateRect(0, 0, 200, 200)
_WinAPI_Rectangle($hMemDC, $tRect)
_WinAPI_ReleaseDC($hForm, $hDC)
_WinAPI_DeleteDC($hMemDC)
_SetBitmap($hForm, $hBitmap, 255)
_WinAPI_DeleteObject($hBitmap)
EndFunc ;==>_Capture
Func _Quit()
Exit
EndFunc ;==>_Quit
Func _ScreenCapture($iX, $iY, $iWidth, $iHeight)
Local $hWnd, $hDC, $hMemDC, $hBitmap
$hWnd = _WinAPI_GetDesktopWindow()
$hDC = _WinAPI_GetDC($hWnd)
$hMemDC = _WinAPI_CreateCompatibleDC($hDC)
$hBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)
_WinAPI_SelectObject($hMemDC, $hBitmap)
_WinAPI_BitBlt($hMemDC, 0, 0, $iWidth, $iHeight, $hDC, $iX, $iY, $SRCCOPY)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($hMemDC)
Return $hBitmap
EndFunc ;==>_ScreenCapture
Func _SetBitmap($hWnd, $hBitmap, $iOpacity)
Local $hDC, $hMemDC, $hSv, $pBlend, $tBlend, $pSize, $tSize, $pSource, $tSource
$hDC = _WinAPI_GetDC($hWnd)
$hMemDC = _WinAPI_CreateCompatibleDC($hDC)
$hSv = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = _WinAPI_GetBitmapDimension($hBitmap)
$pSize = DllStructGetPtr($tSize)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, 'Alpha', $iOpacity)
DllStructSetData($tBlend, 'Format', 0)
_WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_SelectObject($hMemDC, $hSv)
_WinAPI_DeleteDC($hMemDC)
EndFunc ;==>_SetBitmap
Так же хочется что бы отображалось (перерисовывалось) в сетке (пример)
ps: изначально код был из "экранной лупы"
Добавлено:
Сообщение автоматически объединено:
Покурил немного. Выводить можно так.
Код:
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
Opt ('MustDeclareVars', 1)
Local $iRw = 15 ; cell width
Local $iRh = 15 ; cell height
Local $iCw = 20 ; count cell width
Local $iCh = 9 ; count cell height
Local $sColor
Local $hAction
Local $hGUI = GUICreate ("My Draw")
Local $hTable = GUICtrlCreateGraphic (10, 10, $iCw *($iRw -1), $iCh *($iRh -1), 0)
GUICtrlSetBkColor ($hTable, 0xFFFFFF)
For $y = 0 To $iCh -1
For $x = 0 To $iCw -1
GUICtrlSetGraphic ($hTable, $GUI_GR_RECT, $x *($iRw -1), $y *($iRh -1), $iRw, $iRh)
If $sColor == "color" Then
GUICtrlSetGraphic ($hTable, $GUI_GR_COLOR, 0xFFFFFF)
Else
GUICtrlSetGraphic ($hTable, $GUI_GR_COLOR, 0x000000)
EndIf
Next
Next
GUISetState (@SW_SHOW, $hGUI)
While True
$hAction = GUIGetMsg ()
Select
Case $hAction = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
Нужна помощь в создании массива который будет пропускаться через цикл "заливая" нужный двадраты нужным цветом.