Jump to content
Sign in to follow this  
InunoTaishou

Image Editor using GDI+

Recommended Posts

Hello again the AutoIt Forums! I've gotten really addicted to the GDIPlus stuff and I'm trying to do more. Trying to create small editor using GDIPlus and I'm a bit lost just getting started.

The main GUI is small, so when I you Snip an area that's larger than the GUI it would only display as large as the GUI (I got around this by setting an event for WM_WINDOWPOSCHANGING but it flickers really badly). I tried doing something by setting the bitmap to a GUICtrlCreatePic control but it still flickered. So essentially I need a way to create a graphics larger than the GUI itself and I don't know how to do something like that. I thought it would have been _GDIPlus_GraphicsCreateFromHDC but it still wasn't create it properly. I did a lot of googling and this topic has a lot of great info in it and I will probably incorporate scrollbars too, later, but UEZ didn't give the secret to resizing! Lol

I've got the source code for vPaint downloaded, and I've started to through some of it (But like the author said, the source code is messy and things are out of order) so it may take a while.

 

#include <GDIPlus.au3>
#include <File.au3>
#include <GUIConstants.au3>
#include <String.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <ScreenCapture.au3>
#include <Color.au3>
#include <Misc.au3>
#include <WinAPISys.au3>
#include <GuiToolbar.au3>
#include <GuiImageList.au3>
#include <Array.au3>

AutoItSetOption("GuiOnEventMode", 1)
AutoItSetOption("MustDeclareVars", 1)

HotKeySet("{Esc}", "ClosePixShop")

Global $frm_pixshop_abscoord[4] = [100, 100, 400, 200]
Global $frmPixShop
Global $tlbPixShopToolbar
Global $hWnd_toolbar_image_list
Global $hWnd_dll = DllOpen("user32.dll")
Global $frm_pixshop_state = @SW_HIDE
Global $hWnd_bitmaps[1]
Global $picBitmaps[1]
Global $abscoord_bitmaps[1][2] = [[0, 0]]
Global $abscoord_graphics[4] = [8, 46, 0, 0]
Global $pixshop_buffer[1]
Global Enum $idToolbarStart = 1000, $idMouse, $idSnip, $idCrop, $idText, $idBrush, $idToolbarEnd
Global $hWnd_pixshop_graphics
Global $hWnd_pixshop_bitmap
Global $hWnd_pixshop_buffer

PixShop()

Func PixShop()
    $frmPixShop = GUICreate("PixShop", $frm_pixshop_abscoord[2], $frm_pixshop_abscoord[3], $frm_pixshop_abscoord[0], $frm_pixshop_abscoord[1], $WS_SIZEBOX, $WS_EX_TOPMOST)
    $tlbPixShopToolbar = _GUICtrlToolbar_Create($frmPixShop, $TBSTYLE_TRANSPARENT)
    GUICtrlCreateLabel("", 0, 36, $frm_pixshop_abscoord[2], $frm_pixshop_abscoord[3], -1, $WS_EX_LAYERED)
    GUICtrlSetBkColor(-1, 0x0D0D0D)
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM)
    GUISetBkColor(0x535353, $frmPixShop)
    $hWnd_toolbar_image_list = _GUIImageList_Create(24, 24, 5, 5)
    _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Mouse.ico")
    _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Snip.ico")
    _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Crop.ico")
    _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Text.ico")
    _GUIImageList_AddIcon($hWnd_toolbar_image_list, @ScriptDir & "\Icons\Brush.ico")
    _GUICtrlToolbar_SetImageList($tlbPixShopToolbar, $hWnd_toolbar_image_list)
    _GUICtrlToolbar_SetIndent($tlbPixShopToolbar, 2)
    _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idMouse, 0)
    _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idSnip, 1)
    _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idCrop, 2)
    _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idText, 3)
    _GUICtrlToolbar_AddButton($tlbPixShopToolbar, $idBrush, 4)
    _GUICtrlToolbar_SetColorScheme($tlbPixShopToolbar, 0x535353, 0x535353)
    _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $idMouse, True)

    GUISetOnEvent($GUI_EVENT_CLOSE, "ClosePixShop")
    ; Register the WM_GETMINMAXINFO function
    GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

    ; Register the WM_NOTIFY function
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING")
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")

    GUISetState(@SW_SHOW, $frmPixShop)

    _GDIPlus_Startup()

    While (True)
        Sleep(100)
    WEnd
EndFunc   ;==>PixShop

Func ClosePixShop()
    _GDIPlus_GraphicsDispose($hWnd_pixshop_graphics)
    _GDIPlus_BitmapDispose($hWnd_pixshop_bitmap)
    For $i = 0 To UBound($hWnd_bitmaps) - 1
        _WinAPI_DeleteObject($hWnd_bitmaps[$i])
    Next
    DllClose($hWnd_dll)
    Exit (0)
EndFunc   ;==>ClosePixShop

Func WM_PAINT($hWndFrom, $iMsg, $wParam, $lParam)
    #forceref $hWndFrom, $iMsg, $wParam, $lParam
    DrawPixShopGraphics()
EndFunc   ;==>WM_PAINT

Func WM_NOTIFY($hWndFrom, $iMsg, $wParam, $lParam)
    #forceref $hWndFrom, $iMsg, $wParam, $lParam
    Local $tNMTOOLBAR = DllStructCreate($tagNMTOOLBAR, $lParam)
    Local $tlbCode = DllStructGetData($tNMTOOLBAR, "Code")
    Local $iItem = DllStructGetData($tNMTOOLBAR, "iItem")
    Local $id_checked_button

    If ($tlbCode = $TBN_BEGINDRAG) Then
        If (Not _GUICtrlToolbar_IsButtonChecked($tlbPixShopToolbar, $iItem)) Then
            For $id = $idToolbarStart + 1 To $idToolbarEnd - 1
                If (_GUICtrlToolbar_IsButtonChecked($tlbPixShopToolbar, $id)) Then
                    $id_checked_button = $id
                    _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $id, False)
                EndIf
            Next

            _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $iItem, True)
        EndIf

        Switch $iItem
            ; Button pressed was the $idColor button
            Case $idSnip
                Local $abscoord_frm_pixshop = WinGetPos($frmPixShop)

                While (_IsPressed("01", $hWnd_dll))
                    Sleep(10)
                WEnd

                GUISetState(@SW_HIDE, $frmPixShop)

                $hWnd_bitmaps[UBound($hWnd_bitmaps) - 1] = SnipArea($abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][0], $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][1])
                $pixshop_buffer[UBound($pixshop_buffer) - 1] = "SnippedImage|" & $hWnd_bitmaps[UBound($hWnd_bitmaps) - 1]
                ReDim $hWnd_bitmaps[UBound($hWnd_bitmaps)]

                ReDim $pixshop_buffer[UBound($pixshop_buffer)]

                If ($abscoord_graphics[2] = 0 And $abscoord_graphics[3] = 0) Then
                    $abscoord_graphics[2] = $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][0]
                    $abscoord_graphics[3] = $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][1]
                    $pixshop_buffer[UBound($pixshop_buffer) - 1] = "ResizeGraphics|0,0-" & $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][0] & ',' & $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1][1]
                    ReDim $pixshop_buffer[UBound($pixshop_buffer)]
                    #cs
                        If (IsArray($abscoord_frm_pixshop)) Then
                        If ($abscoord_frm_pixshop[2] < $abscoord_graphics[2]) Then
                        WinMove($frmPixShop, "", $abscoord_frm_pixshop[0], $abscoord_frm_pixshop[1], $abscoord_graphics[2] + 24, $abscoord_frm_pixshop[3])
                        $abscoord_frm_pixshop[2] = $abscoord_graphics[2] + 24
                        EndIf
                        If ($abscoord_frm_pixshop[3] < $abscoord_graphics[3]) Then
                        WinMove($frmPixShop, "", $abscoord_frm_pixshop[0], $abscoord_frm_pixshop[1], $abscoord_frm_pixshop[2], $abscoord_graphics[3] + 46)
                        $abscoord_frm_pixshop[3] = $abscoord_graphics[3] + 54
                        EndIf
                        EndIf
                    #ce
                EndIf

                ReDim $abscoord_bitmaps[UBound($abscoord_bitmaps, $UBOUND_ROWS)][2]

                GUISetState(@SW_SHOW, $frmPixShop)

                ResizePixShopGraphics()
                DrawPixShopGraphics()

                _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $iItem, False)
                _GUICtrlToolbar_CheckButton($tlbPixShopToolbar, $id_checked_button, True)
            Case $idCrop
                ToolTip("Crop Image")
            Case $idText
                ToolTip("Add Text")
            Case $idBrush
                ToolTip("Brush Image")
        EndSwitch
    EndIf

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func DrawPixShopGraphics()
    Local $hWnd_bitmap = _GDIPlus_BitmapCreateFromHBITMAP($hWnd_bitmaps[0])
    _GDIPlus_GraphicsClear($hWnd_pixshop_buffer, 0x00000000)

    _GDIPlus_GraphicsDrawImageRect($hWnd_pixshop_buffer, $hWnd_bitmap, $abscoord_graphics[0], $abscoord_graphics[1], $abscoord_graphics[2], $abscoord_graphics[3])
    _GDIPlus_ImageDispose($hWnd_bitmap)
    _GDIPlus_GraphicsDrawImage($hWnd_pixshop_graphics, $hWnd_pixshop_bitmap, 0, 0)
EndFunc   ;==>DrawPixShopGraphics

Func SnipArea(ByRef $snipped_image_width, ByRef $snipped_image_height)
    Local $abscoord_mouse
    Local $hMask
    Local $hMaster_Mask
    Local $temp_val
    Local $mouse_x_1
    Local $mouse_y_1
    Local $mouse_x_2
    Local $mouse_y_2

    ToolTip("Left click and drag to select the area", 0, 0)

    Local $frmOverlay = GUICreate("GUI Overlay", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOPMOST)

    WinSetTrans($frmOverlay, "", 1)
    GUISetBkColor(0x000000, $frmOverlay)
    GUISetState(@SW_SHOW, $frmOverlay)
    GUISetCursor(3, 1, $frmOverlay)

    Local $frmSnipArea = GUICreate("GUI Snip", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
    GUISetBkColor(0xFF0000)

    ; Wait until mouse button pressed
    While (Not _IsPressed("01", $hWnd_dll))
        Sleep(10)
    WEnd

    ; Get first mouse position
    $abscoord_mouse = MouseGetPos()
    $mouse_x_1 = $abscoord_mouse[0]
    $mouse_y_1 = $abscoord_mouse[1]

    ; Draw rectangle while mouse button pressed
    While _IsPressed("01", $hWnd_dll)
        $abscoord_mouse = MouseGetPos()

        $hMaster_Mask = _WinAPI_CreateRectRgn(0, 0, 0, 0)
        $hMask = _WinAPI_CreateRectRgn($mouse_x_1, $abscoord_mouse[1], $abscoord_mouse[0], $abscoord_mouse[1] + 1) ; Bottom of rectangle
        _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2)
        _WinAPI_DeleteObject($hMask)
        $hMask = _WinAPI_CreateRectRgn($mouse_x_1, $mouse_y_1, $mouse_x_1 + 1, $abscoord_mouse[1]) ; Left of rectangle
        _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2)
        _WinAPI_DeleteObject($hMask)
        $hMask = _WinAPI_CreateRectRgn($mouse_x_1 + 1, $mouse_y_1 + 1, $abscoord_mouse[0], $mouse_y_1) ; Top of rectangle
        _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2)
        _WinAPI_DeleteObject($hMask)
        $hMask = _WinAPI_CreateRectRgn($abscoord_mouse[0], $mouse_y_1, $abscoord_mouse[0] + 1, $abscoord_mouse[1]) ; Right of rectangle
        _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2)
        _WinAPI_DeleteObject($hMask)
        ; Set overall region
        _WinAPI_SetWindowRgn($frmSnipArea, $hMaster_Mask)

        If WinGetState($frmSnipArea) < 15 Then GUISetState()
        Sleep(10)
    WEnd

    ToolTip("")

    ; Get second mouse position
    $mouse_x_2 = $abscoord_mouse[0]
    $mouse_y_2 = $abscoord_mouse[1]

    ; Set in correct order if required
    If $mouse_x_2 < $mouse_x_1 Then
        $temp_val = $mouse_x_1
        $mouse_x_1 = $mouse_x_2
        $mouse_x_2 = $temp_val
    EndIf

    If $mouse_y_2 < $mouse_y_1 Then
        $temp_val = $mouse_y_1
        $mouse_y_1 = $mouse_y_2
        $mouse_y_2 = $temp_val
    EndIf

    GUIDelete($frmSnipArea)
    GUIDelete($frmOverlay)

    $snipped_image_width = $mouse_x_2 - $mouse_x_1
    $snipped_image_height = $mouse_y_2 - $mouse_y_1

    Return _ScreenCapture_Capture("", $mouse_x_1, $mouse_y_1, $mouse_x_2, $mouse_y_2, False)
EndFunc   ;==>SnipArea

Func ResizePixShopGraphics()
    Local $graphics_width
    Local $graphics_height

    _GDIPlus_GraphicsDispose($hWnd_pixshop_graphics)
    _GDIPlus_BitmapDispose($hWnd_pixshop_bitmap)

    For $i = 0 To UBound($abscoord_bitmaps, $UBOUND_ROWS) - 1
        $graphics_width += $abscoord_bitmaps[$i][0]
        $graphics_height += $abscoord_bitmaps[$i][1]
    Next

    $hWnd_pixshop_graphics = _GDIPlus_GraphicsCreateFromHWND($frmPixShop)
    $hWnd_pixshop_bitmap = _GDIPlus_BitmapCreateFromGraphics($graphics_width, $graphics_height, $hWnd_pixshop_graphics)
    $hWnd_pixshop_buffer = _GDIPlus_ImageGetGraphicsContext($hWnd_pixshop_bitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hWnd_pixshop_buffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    _GDIPlus_GraphicsSetTextRenderingHint($hWnd_pixshop_graphics, $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT)
EndFunc   ;==>ResizePixShopGraphics

Func WM_WINDOWPOSCHANGING($hWndFrom, $iMsg, $wParam, $lParam)
    #forceref $hWndFrom, $iMsg, $wParam, $lParam
    If ($hWndFrom <> $frmPixShop) Then Return $GUI_RUNDEFMSG

    Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam)
    Local $iLeft = DllStructGetData($stWinPos, 3)
    Local $iTop = DllStructGetData($stWinPos, 4)
    Local $iWidth = DllStructGetData($stWinPos, 5)
    Local $iHeight = DllStructGetData($stWinPos, 6)

    ResizePixShopGraphics()
    DrawPixShopGraphics()

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_WINDOWPOSCHANGING

Func WM_GETMINMAXINFO($hWndFrom, $iMsg, $wParam, $lParam)
    #forceref $hWndFrom, $iMsg, $wParam, $lParam
    Local $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)

    DllStructSetData($tagMaxinfo, 7, 300) ; Set MIN width
    DllStructSetData($tagMaxinfo, 8, 200) ; Set MIN height

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_GETMINMAXINFO

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • By UEZ
      AutoIt Windows Screenshooter
      Key Features:
      takes easily a screenshot from any visible window capture any region of the desktop incl. freehand capturing capture GUI controls and GUI menus separately capture a marked area every x seconds for a duration of y seconds create a GIF animation from saved frames (Vista or higher os required) capture to AVI file (without audio!) takes a screenshot from web sites (available only on Win7+ os and when Aero is enabled) put images to clipboard to paste to other applications easily color picker save image in different formats and also to PDF! add timestamp to saved images simple image editing options: greyscale, b&w, invert, rotate +-90° send image to printer and default email client preview of captured screens incl. zoom option multi monitor support display pixel color under mouse ruler basic image editor (paint, highlight, ellipse, rectangle, text and some graphic FX) watermark captured image no 3rd party tools or DLLs used - pure AutoIt! fully portable - no installation is needed multi language feature (Eng, Ger, Tur, Fra and Rus only) To do:
      capture content of scrollable window/control capture cascaded menus Due to DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) limitation some windows cannot be captured properly (GDI+, ProgDVB, etc.) but can take screenshots of hidden windows. One workaround is to use full screen capturing (F11/F12) or "Grab Screen" function! Or try double click with rmb on listview items (beta).
      Download source code (7858 downloads previously): AutoIt Windows Screenshooter v1.82 Build 2019-02-03.7z (version 3.3.12.0+ needed!)
      You are not allowed to sell this code or just parts of it in a commercial project or modify it and distribute it with a different name!
      Download compiled Exe only: 4shared / Media Fire  / Softpedia (1.54mb)
      Distributing copies of the program in compiled format (exe) must be free of any fee!
      -----> click here to Donate!  
       
      (Current donators: 1. Cuong N.) 
      It is designed for Win7+ operating systems with AERO enabled! E.g. on WinXP machines some functions are not working properly and might crash the application!
      AV scanners may have a negative impact the execution of compiled exe and might report any malware. I guarantee that there is no malicious code in the source code / exe!!! 
      Main GUI:

       
       
      About Intro:

       
       
      Basic Image Editor:

       
       
      Watermark:

       
       
      Click link for an enhanced version of Watermark Image.
      Credits:
      main code by UEZ additional code (alphabetical order) by Authenticity, AutoItObject Team, Eemuli, Eukalyptus, funkey, _Kurt, martin, monoceres, ProgAndy, taietel, trancexx, Ward, wolf9228 and Yashied! mesale0077 for turkish translation wakillon for french translation AZJIO for russian translation Keys:
      Main GUI:
      User your mouse to scroll preview window or
      Numpad 8: Scroll preview window up
      Numpad 2: Scroll preview window down
      Numpad 4: Scroll preview window left
      Numpad 6: Scroll preview window right
      Numpad +: zoom in preview window or mouse wheel down
      Numpad -: zoom out preview window or mouse wheel up
      F1: capture again on last position
      F5: refresh Windows Name list
      PRINTSCREEN: take screenshot from whole screen
      ALT+PRINTSCR: take a screenshot from active window
      F10: Undo made changes with Image Editing function
      F11: take screenshot from whole screen incl mouse cursor
      F12: take screenshot from whole screen
      Ctrl+Alt+F9 start "Grab Screen" mode
      Ctrl+Alt+F12: take a screenshot from active window using alternative screenshot functionality (beta)!
      Ctrl+r: call ruler
      Ctrl+s: save current displayed image
      Ctrl+x: exit program
      ctrl+w: call web grab input field (available only when Aero is enabled)
      Ctrl+i: call image editor
      Ctrl+m: call watermark editor
      Ctrl+z: undo
      Only available on Vista+ os: double click with rmb on list items to use alternative screenshot functionality (beta)!
      When 'Grab Screen' is clicked you can hold down the ctrl key to switch to 'grab controls' mode. Control under mouse will be framed red.
      ctrl + shift will take the screenshot of appropriate control. To capture GUI menus you can press rmb which simulates the lmb. When a menu is opened press shift additionally to capture it.
      Press and hold only the shift key to capture any region on the desktop using freehand capturing - release it so capture marked regions!
      Or just mark resize able area which you want to grab. Press CTRL key to grab marked area or right mouse button to capture the marked area every x seconds for a duration of y seconds.
      When saving the image just enter the extension you wish to use (*.jpg;*.png;*.bmp;*.gif;*.tif;*.pdf). Big thanks to taietel for his PDF UDF!
      Image Editor:
      s: save
      c: copy
      n: send
      h: highlighter
      p: pen
      r: rectangle
      e: ellipse
      a: arrow
      o: color
      t: text
      g: text config
      Ctrl+z: undo
      Watermark editor:
      Ctrl+z: undo
       
      To start the app minimized just call it "Windows Screenshooter.exe /min"
      Maybe it is useful for someone...
      Any kind of comment is welcome.
      Br,
      UEZ
      Change log:
       
    • By misioooo
      Hi!
       
      I am writing some GUI and i need to use images as buttons, but with text on them (text is from INI file).
      Part with button looks like this:
      $ankieta1 = GUICtrlCreateButton($txtAnk1, 100,350,765,164) GUICtrlSetFont(-1, 22, 800, -1, "Arial") ;GUICtrlSetColor(-1,0xffffff) $hImageBtn_1 = _GUIImageList_Create(765, 164) _GUIImageList_AddBitmap($hImageBtn_1, "c:\path\to\ankieta_clean.bmp") _GUICtrlButton_SetImageList($ankieta1, $hImageBtn_1, 4) GUICtrlSetOnEvent(-1, "On_Ankieta1") The problem - if i uncomment GUICtrlSetColor, color of text changes, but button is just plain gray (no image). How i can change text color not touching image on a button here?
    • By Xandy
      NOTE: TOPIC HAS BEEN MERGED TO HERE: MapIt Quest
       
      Special thanks: AdmiralAlkex, Melba23, MrCrearoR, Dragon Warrior 3, SDL
      MapIt is a tile world editor.  MapIt was built around the concept of reversing Dragon Warrior map images.  MapIt can take image input and produce a tile and world array.  
      Changing and replacing tile / world data is easy.  B/c tile world editor.

      CTRL+R in image above to signal replace tile action and I use "G" to Get the tile under mouse.
      A full list of hotkeys can be assigned in the: Help Menu\Hotkeys
       
      MapParser is a C++ project that scans images for unique tiles. 
      MapIt can be downloaded without MapParser. MapParser can be toggled off in the Scan_Image dialog. Without MapParser, MapIt will use the Scan_Tiles() function written in AutoIt ; which is 100 * slower Idk. If MapParser.exe will not run for you:      Installing Visual C++ Redistributable for Visual Studio 2015 should fix it: https://www.microsoft.com/en-us/download/details.aspx?id=48145   
      You can start with example world and tiles.
      Example world was made following these steps:
      Started with a tile map image of DragonWarrior3 town of: Reeve From MapIt World Menu \ New \ Scan_Image dialog, I set the area to exclude the key legend to the far right of image. After scanning the map image to world and tile array.  I removed a few of the map artifacts.  More work could be done on this world; removing unwanted tiles, but it is fine for now. I saved my world to disk.  This creates folder: Worldname: Containing folder of Tiles and a Worldname.txt. Using The Gimp, I edited some tiles to have a transparent color: Stairs, Trees, Desk Tables, Chest-of-drawers, Chairs, Signs, Doors, Beds. I changed the world layers to 2: World Menu \ Properties. F9 Finds all selected tile on current layer and changes to a new selected tile on new layer. I used F9 to change all Trees on layer: 0 to Trees on layer: 1. Then I used F9 to change all Trees on layer: 0 to Grass on layer: 0  
      In this video you can see how I used the Tile Menu \ Replace From Disk option to remap tile images to my custom tiles.  Conveniently my tiles already have a transparent pixel.
      See video for how that was done:
      To use the example world:
      First unzip the world save file: http://songersoft.com/programming/mapit/worlds/Reeve_Swapped.zip From the World Menu: choose \Load Navigate to the Reeve_Swapped.txt located in the extracted zip. Or you can scan any image.
      The map images I used are here: http://www.realmofdarkness.net/dq/games/nes/dw3/maps/world
      For download, videos, and example of created world file data; please visit the MapIt webpage: http://songersoft.com/programming/mapit/mapit_about.phtml
    • By dejhost
      Happy New Year everyone!
      I would like to extract the color values of certain pixels in an image.  This is how I picture the workflow: 
      User opens an image of his choice. Image is shown on the screen. User draws a line into the image. This happens by marking the startpixel and the endpixel of the line The line is drawn, so the user can check visually if he is happy with the line.  The following pixel based properties belonging to the line are stored in Excel: X-Coordinate Y-Coordinate Color Value Additional operations: Extracting for max- and min. color values; Statistical operations.   Browsing through the helpfile of AutoIt I find plenty of functions for treating images (e.g. GDIPlus), but I am completely unsure if Autoit will get me there. Should I read the entire image into an array? Should I rather attempt to script an external image software (e.g. IrfanView, Gimp)?
      I would be very thankful if someone could give some recommendations and maybe list a couple of the most important commands to use.
      Thank you very much.
      Dejhost
       
       
    • By Miliardsto
      hello Im wondering if it is possible to process image in autoit like this
      1. firstly there is colorfull wallpaper
      2. Fill all colors (exception rose color) - with white
      3. Fill rose color with black color
      I see Gdi functions have things to manipulate images
      https://imgur.com/a/lFdY26g
×
×
  • Create New...