Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/23/2021 in all areas

  1. @suiciderPlease update both the Webdriver and WinHTTP UDFs as indicated above. That won't solve your current issue, but it's movement in the right direction.
    1 point
  2. Why are you using the vertical bar multiple times in your input? The shows output is not triggered by the shown $Test1 input, so very confusing! I assume that was: Local $Test1 = [[1,"|"],[2,"a"],[3,"b"],[4],[5]] The issues is that ArrayAdd() uses "|" as default for the 4th parameter, so change that in the UDF to another character when you need to use the "|" in your input or like shown below forcing single item ! ($ARRAYFILL_FORCE_SINGLEITEM) e.g.: #include <Array.au3> #include <Misc.au3> Func _ArrayCombo($Aoa) Local $y[0] ;Define the Counter Array Local $hld ;Place Holder Local $Ra[0] ;Return Array _ArrayDisplay($Aoa) For $i = 0 To UBound($Aoa, 2) - 1 ;Set Default Vaules of Counter Array to 0 _ArrayAdd($y, 0, 0, "", "", $ARRAYFILL_FORCE_SINGLEITEM) Next Local $Count = 1 ;Set The total Count of the possiblities For $i = 0 To UBound($Aoa, 2) - 1 $Count = $Count * UBound($Aoa, 1) Next For $i = 1 To $Count ; main loop for combinations $hld = "" ; reseting holder variable to "" For $k = 0 To UBound($y) - 1 ; Check if the combination has blank characters(happens with different sized columns) If $Aoa[$y[$k]][$k] = "" Then $hld = $hld & "~" ;Adds a ~ if is blank $hld = $hld & $Aoa[$y[$k]][$k] ;Combines the contents of the main Array into the holder variable Next If StringInStr($hld, "~") = 0 Then ; Checks for a ~ in the holder variable _ArrayAdd($Ra, $hld, 0, "", "", $ARRAYFILL_FORCE_SINGLEITEM) ;Add Result To Return Array EndIf If _IsPressed("1B") Then ExitLoop ; If ESC pressed exits loop $y[UBound($y) - 1] = $y[UBound($y) - 1] + 1 ; Adds 1 to the rightmost index of the counter array For $k = UBound($y) - 1 To 0 Step -1 ; Checks to see if counter array indices are above their max and if they are reset them to 0 while increasing the next index up 1 If $y[$k] > UBound($Aoa, 1) - 1 Then $y[$k] = 0 If $k > 0 Then $y[$k - 1] = $y[$k - 1] + 1 ;Error Handeler for last operation EndIf Next Next Return $Ra EndFunc ;==>_ArrayCombo ;~ Local $Test1 = [[1,"A"],[2,"B"],[3,"C"],[4],[5]] Local $Test1 = [[1, "|"], [2, "a"], [3, "b"], [4], [5]] Local $Test = _ArrayCombo($Test1) _ArrayDisplay($Test) Jos
    1 point
  3. jchd

    Binary to hex

    Another way: $BinIn = "11111110" ConsoleWrite(Hex(_StringToUint($BinIn, 2), 2) & @LF) Func _StringToUint($s, $base) Return DllCall("msvcrt.dll", "uint64:cdecl", "_wcstoui64", "wstr", $s, "ptr*", 0, "int", $base)[0] EndFunc ;==>_StringToUint Func _UintToString($i, $base) Return DllCall("msvcrt.dll", "wstr:cdecl", "_ui64tow", "uint64", $i, "wstr", "", "int", $base)[0] EndFunc ;==>_UintToString You can specify any base in 2...36 and you get the reverse conversion for the same price.
    1 point
  4. Jos

    Binary to hex

    Change the type of $dec to int and then it works: $BinIn = "11111110" BinaryToHex($BinIn) Func BinaryToHex($BinIn) $Bits = StringSplit($BinIn, "") $dec = 0 For $x = $Bits[0] To 1 Step -1 $dec += (2 ^ ($Bits[0] - $x)) * $Bits[$x] Next $hex = Hex(int($dec)) ConsoleWrite("bin:" & $BinIn & " Dec:" & $dec & " Hex:" & $hex & @CRLF) ConsoleWrite("bin:" & $BinIn & " Dec:" & $dec & " " & Hex(254) & @CRLF) EndFunc ;==>BinaryToHex
    1 point
  5. I use https://www.deviantart.com/niivu/art/BIB3-for-Windows-886441919 and it'll do what you'd like to see, just like in Linux ..and the pic above is with the dark theme from "SciTE config for AutoIt3"
    1 point
  6. haijie1223

    Rotate animation

    #NoTrayIcon #RequireAdmin #My QQ No: 29535065 #QQ group: 477266297 #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $iSleepTime = 80 Global $hGUI = GUICreate("GDI+旋转动画", 400, 280) Global $Pic_Animation = GUICtrlCreatePic('', 5, 5, 256, 256) Global $Btn_Type1 = GUICtrlCreateButton('旋转方式一', 275, 35, 100, 30) Global $Btn_Type2 = GUICtrlCreateButton('旋转方式二', 275, 85, 100, 30) Global $Btn_Type3 = GUICtrlCreateButton('旋转方式三', 275, 135, 100, 30) Global $Slider_Time = GUICtrlCreateSlider(275, 185, 100, 45) GUICtrlSetLimit($Slider_Time, 500, 50) GUISetState() GUISetIcon('shell32.dll',322,$hGUI) GUISetOnEvent(-3, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type1, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type2, '_GuiEvent') GUICtrlSetOnEvent($Btn_Type3, '_GuiEvent') GUICtrlSetOnEvent($Slider_Time, '_GuiEvent') _AnimationInit(ControlGetHandle($hGUI, '', $Pic_Animation), 1) _GDIPlus_Startup() ; While 1 Sleep($iSleepTime) _NextFlash() WEnd Func _GuiEvent() Switch @GUI_CtrlId Case -3 _DeleteCache() Exit Case $Btn_Type1 _ResetAniType(1, 2) Case $Btn_Type2 _ResetAniType(2, 0) Case $Btn_Type3 _ResetAniType(3, 0) Case $Slider_Time $iSleepTime=GUICtrlRead($Slider_Time) EndSwitch EndFunc ;==>_GuiEvent Func _AnimationInit($hHwd, $SpaceSec) Global $m_hWnd = $hHwd Global $m_nWidth, $m_nHeight Global $m_AnimationIndex = 0, $m_AnimationType = 0, $m_AnimationCount = 12 Global $m_ItemSize, $m_MarginAngle Global $m_hCacheDC, $m_hCacheBitmap, $m_hCacheOldBitmap Global $m_Rect = DllStructCreate($tagRECT) Global $m_ColorBack = _WinAPI_GetSysColor($COLOR_BTNFACE) Global $m_ColorBasic[2] = [0x808080, 0xC0C0C0] Global $m_ColorFore1 = [0x1FF4FB, 0x07F98C, 0x91A804, 0xCC9302, 0xAF5801, 0x9C426B, 0x9744A7, 0x9841E4, 0x241BEE, 0x2472F5, 0x2190F4, 0x12C2FF] Global $m_ColorFore2 = [0x34F5FF, 0x3CFDA3, 0xA5B833, 0xD8A733, 0xB67636, 0xAD6988, 0xAD68B9, 0xAC66E9, 0x514AEF, 0x4E8DF5, 0x4BA5FA, 0x3ECEFE] Global $m_AnimationArray[$m_AnimationCount] Local $i For $i = 0 To $m_AnimationCount - 1 $m_AnimationArray[$i] = _AnimationItem() DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next _Resize() _ResetAniType($m_AnimationType, $SpaceSec) EndFunc ;==>_AnimationInit Func _RGB2ARGB($RGBColor, $Alpha) Return BitOR(Binary('0x' & Hex($RGBColor, 6)), BitShift($Alpha, -24)) EndFunc ;==>_RGB2ARGB Func _Resize() _DeleteCache() Local $rc = _WinAPI_GetClientRect($m_hWnd) $m_nWidth = DllStructGetData($rc, 3) - DllStructGetData($rc, 1) $m_nHeight = DllStructGetData($rc, 4) - DllStructGetData($rc, 2) If $m_nWidth > $m_nHeight Then DllStructSetData($m_Rect, 3, ($m_nHeight - 10)) Else DllStructSetData($m_Rect, 3, ($m_nWidth - 10)) EndIf ;~ DllStructSetData($m_Rect, 3, ($m_nWidth > $m_nHeight) ? ($m_nHeight - 10) : ($m_nWidth - 10)) DllStructSetData($m_Rect, 4, DllStructGetData($m_Rect, 3)) DllStructSetData($m_Rect, 1, ($m_nWidth - DllStructGetData($m_Rect, 3)) / 2) DllStructSetData($m_Rect, 2, ($m_nHeight - DllStructGetData($m_Rect, 4)) / 2) $m_ItemSize = 20 EndFunc ;==>_Resize Func _ResetAniType($AniType, $SpaceSec = 0) Local $i $m_AnimationIndex = 0 Switch $AniType Case 0 $m_AnimationType = 0 Case 1 $m_AnimationType = 1 Case 2 $m_AnimationType = 2 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case 3 $m_AnimationType = 3 For $i = 0 To $m_AnimationCount - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next Case Else _ResetAniType(0) Return EndSwitch $m_MarginAngle = $SpaceSec If $m_MarginAngle > 10 Then $m_MarginAngle = 10 If $m_MarginAngle < 0 Then $m_MarginAngle = 0 EndFunc ;==>_ResetAniType Func _NextFlash() Local $i Switch $m_AnimationType Case 0 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorFore1[$i], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorFore2[$i], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 1 $m_AnimationIndex = 0 EndIf Case 1 For $i = 0 To $m_AnimationIndex - 1 DllStructSetData($m_AnimationArray[$i], 1, _RGB2ARGB($m_ColorBasic[0], 255)) DllStructSetData($m_AnimationArray[$i], 2, _RGB2ARGB($m_ColorBasic[1], 255)) Next $m_AnimationIndex += 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationType = 0 $m_AnimationIndex = 0 EndIf Case 2 local $item=$m_AnimationArray[11] For $i = 0 To $m_AnimationCount - 2 $m_AnimationArray[$m_AnimationCount - $i - 1] = $m_AnimationArray[$m_AnimationCount - $i - 2] Next $m_AnimationArray[0] = $item Case 3 $m_AnimationIndex = $m_AnimationIndex + 1 If ($m_AnimationIndex > $m_AnimationCount) Then $m_AnimationIndex = 0 EndSwitch _Draw() EndFunc ;==>_NextFlash Func _Draw() Local $hDC = _WinAPI_GetDC($m_hWnd) If $m_hCacheDC = 0 Then $m_hCacheDC = _WinAPI_CreateCompatibleDC($hDC) $m_hCacheBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $m_nWidth, $m_nHeight) $m_hCacheOldBitmap = _WinAPI_SelectObject($m_hCacheDC, $m_hCacheBitmap) EndIf _FillSolidRect($m_hCacheDC, _CRect(0, 0, $m_nWidth, $m_nHeight), $m_ColorBack) _DrawPie($m_hCacheDC) _WinAPI_BitBlt($hDC, 0, 0, $m_nWidth, $m_nHeight, $m_hCacheDC, 0, 0, 0x00CC0020) _WinAPI_ReleaseDC($m_hWnd, $hDC) EndFunc ;==>_Draw Func _CRect($Left, $Top, $Right, $Bottom) Local $Rect = DllStructCreate($tagRECT) DllStructSetData($Rect, 1, $Left) DllStructSetData($Rect, 2, $Top) DllStructSetData($Rect, 3, $Right) DllStructSetData($Rect, 4, $Bottom) Return $Rect EndFunc ;==>_CRect Func _FillSolidRect($hDC, $lpRect, $clr) _WinAPI_SetBkColor($hDC, $clr) _ExtTextOut($hDC, 0, 0, 2, $lpRect, Chr(0), 0, 0) EndFunc ;==>_FillSolidRect Func _DrawPie($hDC) Local $i Local $nStartAngle Local $nSweepAngle Local $pGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC) _GDIPlus_GraphicsSetSmoothingMode($pGraphics, 4) Local $pBrush = _GDIPlus_BrushCreateSolid(_RGB2ARGB(0, 255)) Local $rcOut = DllStructCreate($tagRECT) DllStructSetData($rcOut, 1, DllStructGetData($m_Rect, 1)) DllStructSetData($rcOut, 2, DllStructGetData($m_Rect, 2)) DllStructSetData($rcOut, 3, DllStructGetData($m_Rect, 3)) DllStructSetData($rcOut, 4, DllStructGetData($m_Rect, 4)) Local $rcIn = DllStructCreate($tagRECT) DllStructSetData($rcIn, 1, DllStructGetData($rcOut, 1)) DllStructSetData($rcIn, 2, DllStructGetData($rcOut, 2)) DllStructSetData($rcIn, 3, DllStructGetData($rcOut, 3)) DllStructSetData($rcIn, 4, DllStructGetData($rcOut, 4)) _InflateRectF($rcIn, -1 * $m_ItemSize) $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 1)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next $nSweepAngle = 360 / $m_AnimationCount $nStartAngle = -90 For $i = 0 To $m_AnimationCount - 1 _GDIPlus_BrushSetSolidColor($pBrush, DllStructGetData($m_AnimationArray[$i], 2)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) $nStartAngle += $nSweepAngle Next If ($m_AnimationType = 3) Then If $m_AnimationIndex > 0 Then $nStartAngle = -90 $nStartAngle = $nStartAngle + $m_AnimationIndex * $nSweepAngle _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB(0xFFFFFF, 150)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcOut, 1), DllStructGetData($rcOut, 2), DllStructGetData($rcOut, 3), DllStructGetData($rcOut, 4), _ $nStartAngle, $nSweepAngle - $m_MarginAngle, $pBrush) EndIf EndIf _InflateRectF($rcIn, -1 * $m_ItemSize) _GDIPlus_BrushSetSolidColor($pBrush, _RGB2ARGB($m_ColorBack, 255)) _GDIPlus_GraphicsFillPie($pGraphics, DllStructGetData($rcIn, 1), DllStructGetData($rcIn, 2), DllStructGetData($rcIn, 3), DllStructGetData($rcIn, 4), 0, 360, $pBrush) _GDIPlus_BrushDispose($pBrush) _GDIPlus_GraphicsDispose($pGraphics) EndFunc ;==>_DrawPie Func _InflateRectF($rc, $dx, $dy = 0) If $dy = 0 Then $dy = $dx DllStructSetData($rc, 1, DllStructGetData($rc, 1) - $dx) DllStructSetData($rc, 2, DllStructGetData($rc, 2) - $dy) DllStructSetData($rc, 3, DllStructGetData($rc, 3) + $dx * 2) DllStructSetData($rc, 4, DllStructGetData($rc, 4) + $dy * 2) EndFunc ;==>_InflateRectF Func _DeleteCache() If $m_hCacheDC <> 0 Then _WinAPI_SelectObject($m_hCacheDC, $m_hCacheOldBitmap) _WinAPI_DeleteObject($m_hCacheBitmap) _WinAPI_DeleteDC($m_hCacheDC) _GDIPlus_Shutdown() $m_hCacheDC = 0 $m_hCacheBitmap = 0 $m_hCacheOldBitmap = 0 EndIf EndFunc ;==>_DeleteCache Func _ExtTextOut($hDC, $x, $y, $wOptions, $lpRect, $lpString, $nCount, $lpDx) If Not IsPtr($lpRect) Then $lpRect=DllStructGetPtr($lpRect) Local $Ret = DllCall('GDI32.dll', 'BOOL', 'ExtTextOutW', 'HANDLE', $hDC, 'INT', $x, 'INT', $y, 'UINT', $wOptions, 'PTR', $lpRect, 'WSTR', $lpString, 'UINT', $nCount, 'INT', $lpDx) If @error Then Return SetError(@error, 0, 0) Return $Ret[0] EndFunc ;==>_ExtTextOut Func _AnimationItem() Return DllStructCreate('INT;INT;') EndFunc ;==>_AnimationItem
    1 point
  7. UEZ

    [Request] Invert Color UDF

    Here another example to invert an image: ;coded by UEZ ;thanks to Authenticity for GDIP.au3 and the great examples #include <GDIPlus.au3> #Include <Misc.au3> $file = FileOpenDialog("Select image to load", @ScriptDir, "Images (*.jpg;*.png;*.bmp)") If @error Then Exit _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($file) $scale_factor = 1.0 $iX = _GDIPlus_ImageGetWidth($hImage) * $scale_factor $iY = _GDIPlus_ImageGetHeight($hImage) * $scale_factor $hGUI = GUICreate("GDI+: Image to Negative Example", $iX, $iY) GUISetState() $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global $hImageContext, $hBackImage _Negative() $dll = DllOpen("user32.dll") While 1 Switch GUIGetMsg() Case -3 _GDIPlus_BitmapDispose($hImage) _GDIPlus_GraphicsDispose($hImageContext) _GDIPlus_BitmapDispose($hBackImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) DllClose($dll) Exit EndSwitch If _IsPressed("4E", $dll) Then ;press n to negative image $hImage = _GDIPlus_BitmapCloneArea($hBackImage, 0, 0, $iX, $iY) _Negative() EndIf Sleep(100) WEnd Func _Negative() Local $tNegMatrix, $pNegMatrix If $hImage Then $hBackImage = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iX, $iY) $hImageContext = _GDIPlus_ImageGetGraphicsContext($hBackImage) $tNegMatrix = _GDIPlus_ColorMatrixCreateNegative() $pNegMatrix = DllStructGetPtr($tNegMatrix) $hIA = _GDIPlus_ImageAttributesCreate() _GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $pNegMatrix) _GDIPlus_GraphicsDrawImageRectRectIA($hImageContext, $hImage, 0, 0, $iX, $iY, 0, 0, $iX, $iY, $hIA) _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBackImage, 0, 0, $iX, $iY, 0, 0, $iX, $iY) $tNegMatrix = 0 EndIf EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _GDIPlus_ColorMatrixCreateNegative ; Description ...: Creates and initializes a negative color matrix ; Syntax.........: _GDIPlus_ColorMatrixCreateNegative() ; Parameters ....: None ; Return values .: Success - $tagGDIPCOLORMATRIX structure ; Failure - 0 ; Remarks .......: None ; Related .......: $tagGDIPCOLORMATRIX ; Link ..........; @@MsdnLink@@ ColorMatrix ; Example .......; No ; =============================================================================================================================== Func _GDIPlus_ColorMatrixCreateNegative() Local $iI, $tCM $tCM = _GDIPlus_ColorMatrixCreateScale(-1, -1, -1, 1) For $iI = 1 To 4 DllStructSetData($tCM, "m", 1, 20 + $iI) Next Return $tCM EndFunc ;==>_GDIPlus_ColorMatrixCreateNegative ; #FUNCTION# ==================================================================================================================== ; Name...........: _GDIPlus_ColorMatrixCreateScale ; Description ...: Creates and initializes a scaling color matrix ; Syntax.........: _GDIPlus_ColorMatrixCreateScale($nRed, $nGreen, $nBlue[, $nAlpha = 1]) ; Parameters ....: $nRed - Red component scaling factor ; $nGreen - Green component scaling factor ; $nBlue - Blue component scaling factor ; $nAlpha - Alpha component scaling factor ; Return values .: Success - $tagGDIPCOLORMATRIX structure that contains a scaling color matrix ; Failure - 0 ; Remarks .......: A scaling color matrix is used to multiply components of a color by multiplier factors ; Related .......: $tagGDIPCOLORMATRIX ; Link ..........; @@MsdnLink@@ ColorMatrix ; Example .......; No ; =============================================================================================================================== Func _GDIPlus_ColorMatrixCreateScale($nRed, $nGreen, $nBlue, $nAlpha = 1) Local $tCM Local Const $tagGDIPCOLORMATRIX = "float m[25]" $tCM = DllStructCreate($tagGDIPCOLORMATRIX) DllStructSetData($tCM, "m", $nRed, 1) DllStructSetData($tCM, "m", $nGreen, 7) DllStructSetData($tCM, "m", $nBlue, 13) DllStructSetData($tCM, "m", $nAlpha, 19) DllStructSetData($tCM, "m", 1, 25) Return $tCM EndFunc ;==>_GDIPlus_ColorMatrixCreateScale ; #FUNCTION# ==================================================================================================================== ; Name...........: _GDIPlus_ImageAttributesSetColorMatrix ; Description ...: Sets or clears the color- and grayscale-adjustment matrices for a specified category ; Syntax.........: _GDIPlus_ImageAttributesSetColorMatrix($hImageAttributes[, $iColorAdjustType = 0[, $fEnable = False,[ $pClrMatrix = 0[, $pGrayMatrix = 0[, $iColorMatrixFlags = 0]]]]]) ; Parameters ....: $hImageAttributes - Pointer to an ImageAttribute object ; $iColorAdjustType - The category for which the color- and grayscale-adjustment matrices are set or cleared: ; |0 - Color or grayscale adjustment applies to all categories that do not have adjustment settings of their own ; |1 - Color or grayscale adjustment applies to bitmapped images ; |2 - Color or grayscale adjustment applies to brush operations in metafiles ; |3 - Color or grayscale adjustment applies to pen operations in metafiles ; |4 - Color or grayscale adjustment applies to text drawn in metafiles ; $fEnable - If True, the specified matrices (color, grayscale or both) adjustments for the specified ; +category are applied; otherwise the category is cleared ; $pClrMatrix - Pointer to a $tagGDIPCOLORMATRIX structure that specifies a color-adjustment matrix ; $pGrayMatrix - Pointer to a $tagGDIPCOLORMATRIX structure that specifies a grayscale-adjustment matrix ; $iColorMatrixFlags - Type of image and color that will be affected by the adjustment matrices: ; |0 - All color values (including grays) are adjusted by the same color-adjustment matrix ; |1 - Colors are adjusted but gray shades are not adjusted. ; +A gray shade is any color that has the same value for its red, green, and blue components ; |2 - Colors are adjusted by one matrix and gray shades are adjusted by another matrix ; Return values .: Success - True ; Failure - False and either: ; |@error and @extended are set if DllCall failed ; |$GDIP_STATUS contains a non zero value specifying the error code ; Remarks .......: None ; Related .......: _GDIPlus_ColorMatrixCreate, $tagGDIPCOLORMATRIX ; Link ..........; @@MsdnLink@@ GdipSetImageAttributesColorMatrix ; Example .......; No ; =============================================================================================================================== Func _GDIPlus_ImageAttributesSetColorMatrix($hImageAttributes, $iColorAdjustType = 0, $fEnable = False, $pClrMatrix = 0, $pGrayMatrix = 0, $iColorMatrixFlags = 0) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetImageAttributesColorMatrix", "hwnd", $hImageAttributes, "int", $iColorAdjustType, "int", $fEnable, "ptr", $pClrMatrix, "ptr", $pGrayMatrix, "int", $iColorMatrixFlags) If @error Then Return SetError(@error, @extended, False) $GDIP_STATUS = $aResult[0] Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_ImageAttributesSetColorMatrix ; #FUNCTION# ==================================================================================================================== ; Name...........: _GDIPlus_GraphicsDrawImageRectRectIA ; Description ...: Draws an image ; Syntax.........: _GDIPlus_GraphicsDrawImageRectRectIA($hGraphics, $hImage, $nSrcX, $nSrcY, $nSrcWidth, $nSrcHeight, $nDstX, $nDstY, $nDstWidth, $nDstHeight[, $hImageAttributes = 0[, $iUnit = 2]]) ; Parameters ....: $hGraphics - Pointer to a Graphics object ; $hImage - Pointer to an Image object ; $iSrcX - The X coordinate of the upper left corner of the source image ; $iSrcY - The Y coordinate of the upper left corner of the source image ; $iSrcWidth - Width of the source image ; $iSrcHeight - Height of the source image ; $iDstX - The X coordinate of the upper left corner of the destination image ; $iDstY - The Y coordinate of the upper left corner of the destination image ; $iDstWidth - Width of the destination image ; $iDstHeight - Height of the destination image ; $hImageAttributes - Pointer to an ImageAttributes object that specifies the color and size attributes of the image to be drawn ; $iUnit - Unit of measurement: ; |0 - World coordinates, a nonphysical unit ; |1 - Display units ; |2 - A unit is 1 pixel ; |3 - A unit is 1 point or 1/72 inch ; |4 - A unit is 1 inch ; |5 - A unit is 1/300 inch ; |6 - A unit is 1 millimeter ; Return values .: Success - True ; Failure - False and either: ; |@error and @extended are set if DllCall failed ; |$GDIP_STATUS contains a non zero value specifying the error code ; Remarks .......: None ; Related .......: None ; Link ..........; @@MsdnLink@@ GdipDrawImageRectRect ; Example .......; No ; =============================================================================================================================== Func _GDIPlus_GraphicsDrawImageRectRectIA($hGraphics, $hImage, $nSrcX, $nSrcY, $nSrcWidth, $nSrcHeight, $nDstX, $nDstY, $nDstWidth, $nDstHeight, $hImageAttributes = 0, $iUnit = 2) Local $aResult = DllCall($ghGDIPDll, "int", "GdipDrawImageRectRect", "hwnd", $hGraphics, "hwnd", $hImage, "float", $nDstX, "float", _ $nDstY, "float", $nDstWidth, "float", $nDstHeight, "float", $nSrcX, "float", $nSrcY, "float", $nSrcWidth, "float", _ $nSrcHeight, "int", $iUnit, "hwnd", $hImageAttributes, "int", 0, "int", 0) If @error Then Return SetError(@error, @extended, False) $GDIP_STATUS = $aResult[0] Return $aResult[0] = 0 EndFunc ;==>_GDIPlus_GraphicsDrawImageRectRectIA ; #FUNCTION# ==================================================================================================================== ; Name...........: _GDIPlus_ImageAttributesCreate ; Description ...: Creates an ImageAttributes object ; Syntax.........: _GDIPlus_ImageAttributesCreate() ; Parameters ....: None ; Return values .: Success - Pointer to a new ImageAttribute object ; Failure - 0 and either: ; |@error and @extended are set if DllCall failed ; |$GDIP_STATUS contains a non zero value specifying the error code ; Remarks .......: After you are done with the object, call _GDIPlus_ImageAttributesDispose to release the object resources ; Related .......: _GDIPlus_ImageAttributesDispose ; Link ..........; @@MsdnLink@@ GdipCreateImageAttributes ; Example .......; No ; =============================================================================================================================== Func _GDIPlus_ImageAttributesCreate() Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateImageAttributes", "int*", 0) If @error Then Return SetError(@error, @extended, 0) $GDIP_STATUS = $aResult[0] Return $aResult[1] EndFunc ;==>_GDIPlus_ImageAttributesCreate Br, UEZ
    1 point
×
×
  • Create New...