Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
41
Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-1.ahk
Normal file
41
Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-1.ahk
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
SetBatchLines, -1
|
||||
CoordMode, Mouse
|
||||
CoordMode, Pixel
|
||||
CapsLock::
|
||||
KeyWait, CapsLock
|
||||
MouseGetPos, X, Y
|
||||
PixelGetColor, color, X, Y
|
||||
FloodFill(x, y, color, 0x000000, 1, "CapsLock")
|
||||
MsgBox Done!
|
||||
Return
|
||||
FloodFill(x, y, target, replacement, mode=1, key="")
|
||||
{
|
||||
If GetKeyState(key, "P")
|
||||
Return
|
||||
PixelGetColor, color, x, y
|
||||
If (color <> target || color = replacement || target = replacement)
|
||||
Return
|
||||
VarSetCapacity(Rect, 16, 0)
|
||||
NumPut(x, Rect, 0)
|
||||
NumPut(y, Rect, 4)
|
||||
NumPut(x+1, Rect, 8)
|
||||
NumPut(y+1, Rect, 12)
|
||||
hDC := DllCall("GetDC", UInt, 0)
|
||||
hBrush := DllCall("CreateSolidBrush", UInt, replacement)
|
||||
DllCall("FillRect", UInt, hDC, Str, Rect, UInt, hBrush)
|
||||
DllCall("ReleaseDC", UInt, 0, UInt, hDC)
|
||||
DllCall("DeleteObject", UInt, hBrush)
|
||||
FloodFill(x+1, y, target, replacement, mode, key)
|
||||
FloodFill(x-1, y, target, replacement, mode, key)
|
||||
FloodFill(x, y+1, target, replacement, mode, key)
|
||||
FloodFill(x, y-1, target, replacement, mode, key)
|
||||
If (mode = 2 || mode = 4)
|
||||
FloodFill(x, y, target, replacement, mode, key)
|
||||
If (Mode = 3 || mode = 4)
|
||||
{
|
||||
FloodFill(x+1, y+1, target, replacement, key)
|
||||
FloodFill(x-1, y+1, target, replacement, key)
|
||||
FloodFill(x+1, y-1, target, replacement, key)
|
||||
FloodFill(x-1, y-1, target, replacement, key)
|
||||
}
|
||||
}
|
||||
55
Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-2.ahk
Normal file
55
Task/Bitmap-Flood-fill/AutoHotkey/bitmap-flood-fill-2.ahk
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#NoEnv
|
||||
#SingleInstance, Force
|
||||
|
||||
SetBatchLines, -1
|
||||
CoordMode, Mouse
|
||||
CoordMode, Pixel
|
||||
return
|
||||
|
||||
CapsLock::
|
||||
KeyWait, CapsLock
|
||||
MouseGetPos, X, Y
|
||||
PixelGetColor, color, X, Y
|
||||
FloodFill(x, y, color, 0x000000, 1, "Esc")
|
||||
MsgBox Done!
|
||||
Return
|
||||
|
||||
FloodFill( 0x, 0y, target, replacement, mode=1, key="" )
|
||||
{
|
||||
VarSetCapacity(Rect, 16, 0)
|
||||
hDC := DllCall("GetDC", UInt, 0)
|
||||
hBrush := DllCall("CreateSolidBrush", UInt, replacement)
|
||||
|
||||
l := 0
|
||||
while l >= 0
|
||||
{
|
||||
if getkeystate(key, "P")
|
||||
return
|
||||
x := %l%x, y := %l%y
|
||||
%l%p++
|
||||
p := %l%p
|
||||
PixelGetColor, color, x, y
|
||||
if (color = target)
|
||||
{
|
||||
NumPut(x, Rect, 0)
|
||||
NumPut(y, Rect, 4)
|
||||
NumPut(x+1, Rect, 8)
|
||||
NumPut(y+1, Rect, 12)
|
||||
DllCall("FillRect", UInt, hDC, Str, Rect, UInt, hBrush)
|
||||
}
|
||||
else if (p = 1)
|
||||
{
|
||||
%l%x := %l%y := %l%p := "", l--
|
||||
continue
|
||||
}
|
||||
if (p < 5)
|
||||
ol := l++
|
||||
, %l%x := %ol%x + (p = 1 ? 1 : p = 2 ? -1 : 0)
|
||||
, %l%y := %ol%y + (p = 3 ? 1 : p = 4 ? -1 : 0)
|
||||
else
|
||||
%l%x := %l%y := %l%p := "", l--
|
||||
}
|
||||
|
||||
DllCall("ReleaseDC", UInt, 0, UInt, hDC)
|
||||
DllCall("DeleteObject", UInt, hBrush)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue