Search the Community
Showing results for tags 'transpose'.
-
I`ve got little problem with my drawing script. When detonating that script in paint it just draw a BMP array but flipped by 90 degrees and "mirror image". I was testing it in winXP mspaint. In other systems just place MouseMove it in diffrent place. 150pix x 150 pix Black&White BMP. Can some one just rebuild my arrays to get normal image? MouseMove(105,76,1) in other place. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.0 Author: polaski Marcin PRzyborowski Script Function: Convert BMP image into Array[x,y]=[Hex colour] https://www.autoitscript.com/forum/topic/112540-is-there-a-function-for-reading-images-into-2d-arrays/?do=findComment&comment=788472 https://www.autoitscript.com/forum/topic/27362-bitmap-library/ script create an 2d Matrix. #ce ---------------------------------------------------------------------------- #include <BMP3.au3> ;https://www.autoitscript.com/forum/topic/27362-bitmap-library/ #include <Array.au3> #include <File.au3> ;;;;;;;;;;;;;;;;;hotkeye;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Press Esc to terminate script, Pause/Break to "pause" Global $g_bPaused = False HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") ;While 1 ; Sleep(100) ;WEnd Func TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func Terminate() Exit EndFunc ;==>Terminate ;;;;;;;;;;;;;;;;;hotkey end;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Global $Paused Local $filename = FileOpenDialog("Select image", @DesktopCommonDir, "All images (*.jpg;*.png;*.gif;*.bmp;)", 1) $bmp = _BMPOpen($filename,1) ;zwraca uchwyt do bitmapy która otworzylismy. Dim $tab3d[$bmp[1]][$bmp[2]] ;tablica o wymiarach bitmapy ;;;pętla zbierająca pixele;;;; For $j = 0 To $bmp[1] - 1 For $i = 0 To $bmp[2] - 1 $tab3d[$j][$i]=_PixelRead($bmp,$j,$i) Next Next ;hójowa tablica 6 na 6 Global $glebokosc = 0 Global $kolor = 0 Global $pamiec = 0 Global $w1 call(start) call (czytaj) func start() If WinExists("[CLASS:MSPaintApp]") Then WinKill("[CLASS:MSPaintApp]", "") ;WinKill("Kolko i Krzyzyk") EndIf Run("mspaint.exe") $hWnd = WinWait("[CLASS:MSPaintApp]", "",2) sleep(2000) WinMove("[CLASS:MSPaintApp]", "", 0, 0, 1000, 1000) Sleep(10000) MouseMove(105,76,1) EndFunc func czytaj() For $j = 0 to $bmp[1] - 1 $w1=MouseGetPos() For $i = 0 To $bmp[2] - 1 $pamiec=$glebokosc ;$kolor=$tab3d[$j][$i] if $tab3d[$j][$i]='000000' Then call(wierc) while $i < $bmp[2]-1 And $tab3d[$j][$i]=$tab3d[$j][$i+1] $i=$i+1 ;if $i=$bmp[2] then ExitLoop ;if $i=$bmp[2]-1 then ExitLoop ;_ArrayDisplay ($tab3d) MouseDown ( "left" ) call(posowaj) WEnd MouseUP ("left") call(wyciagaj) call(posowaj) EndIf if $tab3d[$j][$i]='FFFFFF' Then call(posowaj) EndIf Next call(wroc) Next EndFunc Func wierc() Local $w2=mousegetpos() MouseClick ("left", $w2[0],$w2[1] , 1 , 1 ) ;beep(300,300) EndFunc Func wyciagaj() Local $w2=mousegetpos() ;MouseClick ("right", $w2[0],$w2[1] , 1 , 1 ) ;beep(800,300) EndFunc Func posowaj() Local $w2=mousegetpos() MouseMove ($w2[0]+2,$w2[1] , 0 ) EndFunc func wroc() MouseMove ( $w1[0],$w1[1]+2 , 0 ) EndFunc