Jump to content

Search the Community

Showing results for tags '_gdiplus_imagerotateflip'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. #include <APIResConstants.au3> #include <GuiTab.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <FileConstants.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <GDIPlus.au3> _imagelist() Func _imagelist() Global $inimg = @ScriptDir&"\img.ini" Global $idListview, $hImage Local $aArray2 = _FileListToArrayRec("G:\Image", "*.jpg", $FLTAR_FILES, 1, $FLTAR_SORT,$FLTAR_FULLPATH) $fileArray4 = UBound($aArray2) -1 If $fileArray4 > 0 Then $hGUI1 = GUICreate("Image Album List "&$fileArray4, 800, 600) $idListview = GUICtrlCreateListView("", 2, 2, 800, 600, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) ; block resizing of columns ControlDisable($hGUI1, "", HWnd(_GUICtrlListView_GetHeader($idListview))) GUISetState() ; Load images $hImage = _GUIImageList_Create(64, 64,5,3) _GUICtrlListView_SetImageList($idListview, $hImage) ; Add columns _GUICtrlListView_AddColumn($idListview, "Image", 64) _GUICtrlListView_AddColumn($idListview, "Path", 350) _GUICtrlListView_AddColumn($idListview, "Caption",365) ;_GUICtrlListView_HideColumn($idListview, 1) _GDIPlus_Startup() Local $GDIpBmpLarge,$GDIpBmpResized,$GDIbmp For $y = 1 To $fileArray4 ;$ini = IniWrite($inimg,$aArray2[$y],"caption",$aArray2[$y]) ;<<< run only the first time, then put a comment $GDIpBmpLarge = _GDIPlus_ImageLoadFromFile($aArray2[$y]) ;GDI+ image! $GDIpBmpResized = _GDIPlus_ImageResize($GDIpBmpLarge, 64,64) ;GDI+ image $GDIbmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($GDIpBmpResized) ;GDI image! $img = _GUIImageList_Add($hImage, $GDIbmp) _GUICtrlListView_SetImageList($idListview, $hImage, 1) ;Add items _GUICtrlListView_AddItem($idListview, StringRegExp($aArray2[$y], ".*\\(.+)$", 1), $img) ;image _GUICtrlListView_AddSubItem($idListview, $y-1,$aArray2[$y],1) _GUICtrlListView_AddSubItem($idListview, $y-1,IniRead($inimg,$aArray2[$y],"caption",""),2) ;caption ConsoleWrite($y&" "&$aArray2[$y]&@LF) Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ;cleanup resources _GDIPlus_BitmapDispose($GDIpBmpLarge) _GDIPlus_BitmapDispose($GDIpBmpResized) _WinAPI_DeleteObject($GDIbmp) _GDIPlus_Shutdown() GUIDelete() Else MsgBox("","","Images folder are empty") EndIf EndFunc Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndListView = $idListview If Not IsHWnd($idListview) Then $hWndListView = GUICtrlGetHandle($idListview) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) $path = IniRead("cfg.ini","PAGE","sourcedir","") Local $iItemText = _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),2) Local $sValue = InputBox("Edit Image", "Enter your description.", ""," M100",400,150) Local $iIndex = _GUICtrlListView_GetSelectedIndices($idListview) _GUICtrlListView_SetItemText($idListview,$iIndex,$sValue,2) If $sValue <> "" Then IniWrite($inimg,_GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1),"caption",$sValue) Else _GUICtrlListView_SetItemText($idListview,$iIndex,$iItemText,3) EndIf Case $LVN_COLUMNCLICK ; A column was clicked Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) _GUICtrlListView_SortItems($idListview, _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1)) Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam) _GDIPlus_Startup() $image = _GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1) $newimg = StringRegExp(_GUICtrlListView_GetItemText($idListview, DllStructGetData($tInfo, "Index"),1), ".*\\", 1)[0] $tempimg = "_new.jpg" $hImage = _GDIPlus_ImageLoadFromFile($image) $imgX = _GDIPlus_ImageGetWidth($hImage) $imgY = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageRotateFlip($hImage,2) $hGUI = GUICreate($image, 801, 601, -1, -1);create a test gui to display the image GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a graphics object from a window handle $hImage_new2 = _GDIPlus_ImageResize($hImage, 800,600) _GDIPlus_GraphicsDrawImage($hGraphics, $hImage_new2, 0, 0) ;display rotated image _GDIPlus_ImageSaveToFile($hImage,$newimg&$tempimg) ;cleanup resources _GDIPlus_BitmapDispose($hImage) _GDIPlus_BitmapDispose($hImage_new2) _WinAPI_DeleteObject($newimg) _WinAPI_DeleteObject($hGraphics) _WinAPI_DeleteObject($hGUI) _GDIPlus_Shutdown() FileDelete($image) FileMove($newimg&"\"&$tempimg,$image,1) Return 0 ; allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFYI would like to rotate a jpg and then overwrites the same jpg. Why GDIplus keeps locked the file again. THX
×
×
  • Create New...