Malkey Posted July 22, 2008 Posted July 22, 2008 A Hatch BrushSimilar usage to the Gradient Line Brushes athttp://www.autoitscript.com/forum/index.ph...st&p=549415This is a little utility for customizing and picking a hatch style for use as a hatch brush. The fore ground color and the back ground color are in he ARGB color format. ARGB stands for Alpha, Red, Green, Blue.The "Fore Ground Color" and "Back Ground Color" buttons on the GUI ( window) of the hatch brush script, change the R,G, and B channels of the two colors.The slider changes the Alpha channel. Example - The hexi-decimal color:-0x00FFFFFF would be a completely invisibe white color. (This would be transparent regardless of RGB);0xFFFF0000 would be a completely visibe red color;and,0x800000FF would be a partly visible blue color.0xAARRGGBB is the format of the color number parameters.Note: The currently selected color is on the button. Both colors are in the input box at bottom. The input box is there only to copy the HatchBrush command into a script. A HatchStyle number has to replace the two question marks. expandcollapse popup#include <GDIPlus.au3> #include <GuiConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> ;#include <WinAPI.au3> Global $hGraphicGUI, $hBMPBuff, $aLables Global $hGraphic, $hBrushHatch, $hGui, $ButExit, $ButForeCol, $ButBkGndCol Global $iX = 10, $iY = 10, $iWidth = 50, $iHeight = 50 Global $GuiSizeX = 560, $GuiSizeY = 560, $ColorBack = 0xFFFFFFFF, $colorFore = 0xFF000000 Global $aHatchStyle[53] = ["HathStyleHorizontal = 0x00000000", _ "HathStyleVertical = 0x00000001", _ "HathStyleForwardDiagonal = 0x00000002", _ "HathStyleBackwardDiagonal = 0x00000003", _ "HathStyleCross / HathStyleLargeGrid = 0x00000004", _ "HathStyleDiagonalCross = 0x00000005", _ "HathStyle05Percent = 0x00000006", _ "HathStyle10Percent = 0x00000007", _ "HathStyle20Percent = 0x00000008", _ "HathStyle25Percent = 0x00000009", _ "HathStyle30Percent = 0x0000000A", _ "HathStyle40Percent = 0x0000000B", _ "HathStyle50Percent = 0x0000000C", _ "HathStyle60Percent = 0x0000000D", _ "HathStyle70Percent = 0x0000000E", _ "HathStyle75Percent = 0x0000000F", _ "HathStyle80Percent = 0x00000010", _ "HathStyle90Percent = 0x00000011", _ "HathStyleLightDownwardDiagonal = 0x00000012", _ "HathStyleLightUpwardDiagonal = 0x00000013", _ "HathStyleDarkDownwardDiagonal = 0x00000014", _ "HathStyleDarkUpwardDiagonal = 0x00000015", _ "HathStyleWideDownwardDiagonal = 0x00000016", _ "HathStyleWideUpwardDiagonal = 0x00000017", _ "HathStyleLightVertical = 0x00000018", _ "HathStyleLightHorizontal = 0x00000019", _ "HathStyleNarrowVertical = 0x0000001A", _ "HathStyleNarrowHorizontal = 0x0000001B", _ "HathStyleDarkVertical = 0x0000001C", _ "HathStyleDarkHorizontal = 0x0000001D", _ "HathStyleDashedDownwardDiagonal = 0x0000001E", _ "HathStyleDashedUpwardDiagonal = 0x0000001F", _ "HathStyleDashedHorizontal = 0x00000020", _ "HathStyleDashedVertical = 0x00000021", _ "HathStyleSmallConfetti = 0x00000022", _ "HathStyleLargeConfetti = 0x00000023", _ "HathStyleZigZag = 0x00000024", _ "HathStyleWave = 0x00000025", _ "HathStyleDiagonalBrick = 0x00000026", _ "HathStyleHorizontalBrick = 0x00000027", _ "HathStyleWeave = 0x00000028", _ "HathStylePlaid = 0x00000029", _ "HathStyleDivot = 0x0000002A", _ "HathStyleDottedGrid = 0x0000002B", _ "HathStyleDottedDiamond = 0x0000002C", _ "HathStyleShingle = 0x0000002D", _ "HathStyleTrellis = 0x0000002E", _ "HathStyleSphere = 0x0000002F", _ "HathStyleSmallGrid = 0x00000030", _ "HathStyleSmallCheckerBoard = 0x00000031", _ "HathStyleLargeCheckerBoard = 0x00000032", _ "HathStyleOutlinedDiamond = 0x00000033", _ "HathStyleSolidDiamond = 0x00000034"] Local $col $hGui = GUICreate("Hatch Brushes", $GuiSizeX, $GuiSizeY) $SliderForeAlpha = GUICtrlCreateSlider( 10, $GuiSizeY-112, 230, 18) GUICtrlSetLimit(-1, 255, 0) GUICtrlSetData ($SliderForeAlpha,BitAND(BitShift($colorFore,24),0x000000FF)) GUICtrlCreateLabel("Fore Ground Color Alpha Channel Adjust",20,$GuiSizeY-90) $SliderBackAlpha = GUICtrlCreateSlider( 245, $GuiSizeY-112, 230, 18) GUICtrlSetLimit(-1, 255, 0) GUICtrlSetData ($SliderBackAlpha,BitAND(BitShift($ColorBack,24),0x000000FF)) GUICtrlCreateLabel("Back Ground Color Alpha Channel Adjust",255,$GuiSizeY-90) $ButForeCol = GUICtrlCreateButton("Fore Ground Color" & @CRLF & " 0x" & Hex($colorFore), 70, $GuiSizeY - 70, 100, 40, 0x2000) $ButBkGndCol = GUICtrlCreateButton("Back Ground Color" & @CRLF & " 0x" & Hex($ColorBack), 310, $GuiSizeY - 70, 100, 40, 0x2000) $ButExit = GUICtrlCreateButton("Exit", $GuiSizeX - 60, $GuiSizeY - 70, 50, 30) $Input = GUICtrlCreateInput ("GDIPlus_CreateHatchBrush(0x??," & "0x" & Hex($colorFore) & "," & "0x" & Hex($ColorBack) & ")", 120,$GuiSizeY - 25,300,20) GUISetState() _GDIPlus_Startup() Draw() ; Create Double Buffer, so the doesn't need to be repainted on PAINT-Event GUIRegisterMsg(0xF, "MY_PAINT"); Register PAINT-Event 0x000F = $WM_PAINT (WindowsConstants.au3) _WinAPI_RedrawWindow($hGui, 0, 0, 2) ;PAINT the window Flag $RDW_INTERNALPAINT = 0x0002 ;End Double Buffer add-in 2 of 3 While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $ButExit CleanUp() ExitLoop Case $ButForeCol $col = _ChooseColor(2, "0x" & Hex(BitAND($colorFore,0x00FFFFFF),6 ),2) If $col <> -1 Then $colorFore = "0x" & Hex(BitOR(BitAND($colorFore, 0xFF000000), BitAND($col, 0x00FFFFFF))) ;_GDIPlus_GraphicsClear($hGraphic, 0x00000000) GUICtrlSetData($ButForeCol, "Fore Ground Color" & @CRLF & " 0x" & Hex($colorFore)) GUICtrlSetData ($Input,"GDIPlus_CreateHatchBrush(0x??," & "0x" & Hex($colorFore) & "," & "0x" & Hex($ColorBack) & ")") CleanUp() Draw() EndIf Case $ButBkGndCol $col = _ChooseColor(2, "0x" & Hex(BitAND($ColorBack,0x00FFFFFF),6 ),2) If $col <> -1 Then $ColorBack = "0x" & Hex(BitOR(BitAND($ColorBack, 0xFF000000), BitAND($col, 0x00FFFFFF))) ;ConsoleWrite("$col " & $col & " $ButBkGndCol " & $ButBkGndCol & @CRLF) ;_GDIPlus_GraphicsClear($hGraphic, 0x00000000) GUICtrlSetData($ButBkGndCol, "Back Ground Color" & @CRLF & " 0x" & Hex($ColorBack)) GUICtrlSetData ($Input,"GDIPlus_CreateHatchBrush(0x??," & "0x" & Hex($colorFore) & "," & "0x" & Hex($ColorBack) & ")") CleanUp() Draw() EndIf Case $SliderForeAlpha $colorFore = "0x" & Hex(BitOR(BitShift(GUICtrlRead($SliderForeAlpha), -24), BitAND($colorFore, 0x00FFFFFF))) ;_GDIPlus_GraphicsClear($hGraphic, 0x00000000) GUICtrlSetData($ButForeCol, "Fore Ground Color" & @CRLF & " 0x" & Hex($colorFore)) GUICtrlSetData ($Input,"GDIPlus_CreateHatchBrush(0x??," & "0x" & Hex($colorFore) & "," & "0x" & Hex($ColorBack) & ")") CleanUp() Draw() WinSetState ("Hatch Brushes","", @SW_HIDE ) WinSetState ("Hatch Brushes","", @SW_SHOW ) Case $SliderBackAlpha $ColorBack = "0x" & Hex(BitOR(BitShift(GUICtrlRead($SliderBackAlpha), -24), BitAND($ColorBack, 0x00FFFFFF))) ;_GDIPlus_GraphicsClear($hGraphic, 0x00000000) GUICtrlSetData($ButBkGndCol, "Back Ground Color" & @CRLF & " 0x" & Hex($ColorBack)) GUICtrlSetData ($Input,"GDIPlus_CreateHatchBrush(0x??," & "0x" & Hex($colorFore) & "," & "0x" & Hex($ColorBack) & ")") CleanUp() Draw() WinSetState ("Hatch Brushes","", @SW_HIDE ) WinSetState ("Hatch Brushes","", @SW_SHOW ) EndSwitch $msg = "" Sleep(10) WEnd _GDIPlus_Shutdown() ;====================> The End ============ ; Func Draw() dim $aLables[UBound($aHatchStyle)] dim $aTip[UBound($aHatchStyle)] ; Create Double Buffer, so the doesn't need to be repainted on PAINT-Event $hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hGui) $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics($GuiSizeX, $GuiSizeY - 112, $hGraphicGUI) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) ;End Double Buffer add-in 1 of 3 ;_GDIPlus_GraphicsClear($hGraphic, 0x80FFFF80) $hBrushHatch = GDIPlus_CreateHatchBrush(Hex(0), $colorFore, $ColorBack) _GDIPlus_GraphicsFillRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hBrushHatch) $aLables[0] = GUICtrlCreateLabel("No. 0x" & Hex(0, 2), $iX, $iY + 53) $aTip[0] = GUICtrlSetTip(-1, $aHatchStyle[0]) _GDIPlus_BrushDispose($hBrushHatch) For $x = 1 To UBound($aHatchStyle) - 1 step 0x01 If Mod($x, 9) = 0 Then ; 15 squares per row $iX = 10 ; New row start x coordinate at $iY += 73 ; New row drop y coordinate by this amount Else $iX += 60 ; Increase x coordinate along row EndIf $hBrushHatch = GDIPlus_CreateHatchBrush("0x" & Hex($x,2), $colorFore, $ColorBack) _GDIPlus_GraphicsFillRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hBrushHatch) $aLables[$x] = GUICtrlCreateLabel("No. 0x" & Hex($x, 2), $iX, $iY + 53) $aTip[$x] = GUICtrlSetTip(-1, $aHatchStyle[$x]) _GDIPlus_BrushDispose($hBrushHatch) Next $iX = 10 $iY = 10 $iWidth = 50 $iHeight = 50 Return EndFunc ;==>Draw Func CleanUp() _GDIPlus_GraphicsDispose($hGraphicGUI) _WinAPI_DeleteObject($hBMPBuff) _GDIPlus_BrushDispose($hBrushHatch) _GDIPlus_GraphicsDispose($hGraphic) EndFunc ;==>CleanUp ;Func to redraw the BMP on PAINT MSG Func MY_PAINT($hWnd, $msg, $wParam, $lParam) ; Check, if the GUI with the Graphic should be repainted If $hWnd = $hGui Then _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) EndIf EndFunc ;==>MY_PAINT ;=============================================================== ; Parameters ; $iHatchStyle - A hexi-decimal number, 0xnn, representing a Hatch Style (see ref), ; $iArgbFore - A hexi-decimal number, 0xAARRGGBB, being the fore ground color, ; $iArgbBack - A hexi-decimal number, 0xAARRGGBB, being the back ground color. ;GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush) ;Ref HatchBrush Functions: http://msdn.microsoft.com/en-us/library/ms534040(VS.85).aspx ;Ref HatchStyle : http://msdn.microsoft.com/en-us/library/bb401620.aspx ; Func GDIPlus_CreateHatchBrush($iHatchStyle, $iArgbFore = 0xFF000000, $iArgbBack = 0xFFFFFFFF) Local $aRet, $res If $iArgbFore = -1 Then $iArgbFore = 0xFF000000 If $iArgbBack = -1 Then $iArgbBack = 0xFFFFFFFF ;Note: Within _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateHatchBrush", "int", $iHatchStyle, "int", $iArgbFore, _ "int", $iArgbBack, "int*", 0) ;$res = "GdipCreateHatchBrush " & @CRLF ; for $x = 0 to 4 ;$res &= $x & " " & $aRet[$x] & @CRLF ; Next ;ConsoleWrite($res & @CRLF) Return $aRet[4] EndFunc ;==>GDIPlus_CreateHatchBrushIf you can think of a better way of doing this or improvements, do it and post it. I just wanted something to make selecting a Hatch Style and using the Hatch Brush easier, if the need arose.I hope this does the job until something better comes along.
Andreik Posted July 22, 2008 Posted July 22, 2008 Very nice Malkey. (I see that you like GDI) I write a simple hatch viewer based on your script. expandcollapse popup#include <GDIPlus.au3> Global $aHatchStyle[53] = ["HathStyleHorizontal = 0x00000000", _ "HathStyleVertical = 0x00000001", _ "HathStyleForwardDiagonal = 0x00000002", _ "HathStyleBackwardDiagonal = 0x00000003", _ "HathStyleCross / HathStyleLargeGrid = 0x00000004", _ "HathStyleDiagonalCross = 0x00000005", _ "HathStyle05Percent = 0x00000006", _ "HathStyle10Percent = 0x00000007", _ "HathStyle20Percent = 0x00000008", _ "HathStyle25Percent = 0x00000009", _ "HathStyle30Percent = 0x0000000A", _ "HathStyle40Percent = 0x0000000B", _ "HathStyle50Percent = 0x0000000C", _ "HathStyle60Percent = 0x0000000D", _ "HathStyle70Percent = 0x0000000E", _ "HathStyle75Percent = 0x0000000F", _ "HathStyle80Percent = 0x00000010", _ "HathStyle90Percent = 0x00000011", _ "HathStyleLightDownwardDiagonal = 0x00000012", _ "HathStyleLightUpwardDiagonal = 0x00000013", _ "HathStyleDarkDownwardDiagonal = 0x00000014", _ "HathStyleDarkUpwardDiagonal = 0x00000015", _ "HathStyleWideDownwardDiagonal = 0x00000016", _ "HathStyleWideUpwardDiagonal = 0x00000017", _ "HathStyleLightVertical = 0x00000018", _ "HathStyleLightHorizontal = 0x00000019", _ "HathStyleNarrowVertical = 0x0000001A", _ "HathStyleNarrowHorizontal = 0x0000001B", _ "HathStyleDarkVertical = 0x0000001C", _ "HathStyleDarkHorizontal = 0x0000001D", _ "HathStyleDashedDownwardDiagonal = 0x0000001E", _ "HathStyleDashedUpwardDiagonal = 0x0000001F", _ "HathStyleDashedHorizontal = 0x00000020", _ "HathStyleDashedVertical = 0x00000021", _ "HathStyleSmallConfetti = 0x00000022", _ "HathStyleLargeConfetti = 0x00000023", _ "HathStyleZigZag = 0x00000024", _ "HathStyleWave = 0x00000025", _ "HathStyleDiagonalBrick = 0x00000026", _ "HathStyleHorizontalBrick = 0x00000027", _ "HathStyleWeave = 0x00000028", _ "HathStylePlaid = 0x00000029", _ "HathStyleDivot = 0x0000002A", _ "HathStyleDottedGrid = 0x0000002B", _ "HathStyleDottedDiamond = 0x0000002C", _ "HathStyleShingle = 0x0000002D", _ "HathStyleTrellis = 0x0000002E", _ "HathStyleSphere = 0x0000002F", _ "HathStyleSmallGrid = 0x00000030", _ "HathStyleSmallCheckerBoard = 0x00000031", _ "HathStyleLargeCheckerBoard = 0x00000032", _ "HathStyleOutlinedDiamond = 0x00000033", _ "HathStyleSolidDiamond = 0x00000034"] _GDIPlus_Startup() $GUI = GUICreate("HATCH VIEW",400,440,-1,-1,0x16C80000) $STYLE = GUICtrlCreateInput("0x00",10,410,50,20,0x01) $FGRND = GUICtrlCreateInput("0xFF000000",70,410,100,20,0x01) $BGRND = GUICtrlCreateInput("0xFFFFFFFF",180,410,100,20,0x01) $APPLY = GUICtrlCreateButton("APPLY",300,410,50,20) $GRAPHIC = _GDIPlus_GraphicsCreateFromHWND($GUI) GUISetState() While 1 $MSG = GUIGetMsg() Switch $MSG Case $APPLY $BRUSH = GDIPlus_CreateHatchBrush(GUICtrlRead($STYLE),GUICtrlRead($FGRND),GUICtrlRead($BGRND)) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,400,400,$BRUSH) Case -3 _GDIPlus_GraphicsDispose($GRAPHIC) _GDIPlus_Shutdown() Exit EndSwitch Sleep(15) WEnd ;=============================================================== ; Parameters ; $iHatchStyle - A hexi-decimal number, 0xnn, representing a Hatch Style (see ref), ; $iArgbFore - A hexi-decimal number, 0xAARRGGBB, being the fore ground color, ; $iArgbBack - A hexi-decimal number, 0xAARRGGBB, being the back ground color. ;GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush) ;Ref HatchBrush Functions: http://msdn.microsoft.com/en-us/library/ms534040(VS.85).aspx ;Ref HatchStyle : http://msdn.microsoft.com/en-us/library/bb401620.aspx ; Func GDIPlus_CreateHatchBrush($iHatchStyle, $iArgbFore = 0xFF000000, $iArgbBack = 0xFFFFFFFF) Local $aRet, $res If $iArgbFore = -1 Then $iArgbFore = 0xFF000000 If $iArgbBack = -1 Then $iArgbBack = 0xFFFFFFFF ;Note: Within _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateHatchBrush", "int", $iHatchStyle, "int", $iArgbFore, _ "int", $iArgbBack, "int*", 0) ;$res = "GdipCreateHatchBrush " & @CRLF ; for $x = 0 to 4 ;$res &= $x & " " & $aRet[$x] & @CRLF ; Next ;ConsoleWrite($res & @CRLF) Return $aRet[4] EndFunc ;==>GDIPlus_CreateHatchBrush
Malkey Posted July 22, 2008 Author Posted July 22, 2008 I write a simple hatch viewer based on your script.Try 0x27 0xD1C0C0C0 0xFFD28926 If you use these three numbers for your input and "Apply", I think your GUI looks pretty solid.
Andreik Posted July 22, 2008 Posted July 22, 2008 Try 0x27 0xD1C0C0C0 0xFFD28926 If you use these three numbers for your input and "Apply", I think your GUI looks pretty solid.Yes, I like it. muttley
Andreik Posted July 22, 2008 Posted July 22, 2008 You can write another useful functions like GdipGetHatchForegroundColor GdipGetHatchBackgroundColor. muttley
Malkey Posted July 23, 2008 Author Posted July 23, 2008 You can write another useful functions like GdipGetHatchForegroundColor GdipGetHatchBackgroundColor. muttleyHere are the three other Hatch Brush functions from gdiplus.dll, together with the Create Hatch Brush. The functions here are, GDIPlus_CreateHatchBrush ............. uses GdipCreateHatchBrush GDIPlus_GetHatchStyle ................ uses GdipGetHatchStyle GDIPlus_GdipGetHatchForegroundColor .. uses GdipGetHatchForegroundColor GDIPlus_GetHatchBackgroundColor ...... uses GdipGetHatchBackgroundColor I've tested them and they seem to work ok. expandcollapse popup; GDIPlus_CreateHatchBrush ............. uses GdipCreateHatchBrush ; GDIPlus_GetHatchStyle ................ uses GdipGetHatchStyle ; GDIPlus_GdipGetHatchForegroundColor .. uses GdipGetHatchForegroundColor ; GDIPlus_GetHatchBackgroundColor ...... uses GdipGetHatchBackgroundColor ;=============================================================== ;Description - Creates a Hatch Brush for use with GDIPlus type scripts. ; Use _GDIPlus_BrushDispose() when finished with Hatch Brush. ; Parameters ; $iHatchStyle - A hexi-decimal number, 0xnn, representing a Hatch Style (see ref), ; $iArgbFore - A hexi-decimal number, 0xAARRGGBB, being the fore ground color, ; $iArgbBack - A hexi-decimal number, 0xAARRGGBB, being the back ground color. ;GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush) ;Ref HatchBrush Functions: http://msdn.microsoft.com/en-us/library/ms534040(VS.85).aspx ;Ref HatchStyle : http://msdn.microsoft.com/en-us/library/bb401620.aspx ; Func GDIPlus_CreateHatchBrush($iHatchStyle, $iArgbFore = 0xFF000000, $iArgbBack = 0xFFFFFFFF) Local $aRet, $res If $iArgbFore = -1 Then $iArgbFore = 0xFF000000 If $iArgbBack = -1 Then $iArgbBack = 0xFFFFFFFF ;Note: Within _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateHatchBrush", "int", $iHatchStyle, "int", $iArgbFore, _ "int", $iArgbBack, "int*", 0) ;$res = "GdipCreateHatchBrush " & @CRLF ; for $x = 0 to 4 ;$res &= $x & " " & $aRet[$x] & @CRLF ; Next ;ConsoleWrite($res & @CRLF) Return $aRet[4] EndFunc ;==>GDIPlus_CreateHatchBrush ;=============================================================== ; Description - Returns the Hatch Style of the specified Hatch Brush. ; Parameters ; $hBrushHatch - [in] The handle of the Hatch Brush returned from GDIPlus_CreateHatchBrush() ; Returns - [out] A hexi-decimal number, 0xnn, the Hatch Style. ;GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle) ; Func GDIPlus_GetHatchStyle($hBrushHatch) Local $HatchStyle, $tHatchStyle, $pHatchStyle, $res $tHatchStyle = DllStructCreate("int HatchStyle") $pHatchStyle = DllStructGetPtr($tHatchStyle) DllCall($ghGDIPDll, "int", "GdipGetHatchStyle", "int", $hBrushHatch, "ptr", $pHatchStyle) $HatchStyle = DllStructGetData($tHatchStyle, 'HatchStyle') ;$res = "GdipCreateHatchBrush " & @CRLF ;$res &= "func " & $HatchStyle & @CRLF ;ConsoleWrite($res & @CRLF) Return "0x" & Hex($HatchStyle, 2) EndFunc ;==>GDIPlus_GetHatchStyle ;=============================================================== ; Description - Returns the fore ground color of the specified Hatch Brush. ; Parameters ; $hBrushHatch - [in] The handle of the Hatch Brush returned from GDIPlus_CreateHatchBrush() ; Returns - [out] A hexi-decimal number, 0xAARRGGBB, being the fore ground color ;GdipGetHatchForegroundColor(GpHatch *brush, ARGB* forecol) ; Func GDIPlus_GdipGetHatchForegroundColor($hBrushHatch) Local $res, $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipGetHatchForegroundColor", "int", $hBrushHatch, "int*", 0) $res = "GdipCreateHatchBrush " & @CRLF ;for $x = 0 to 2 ; $res &= $x & " " & $aRet[$x] & @CRLF ;Next ;ConsoleWrite($res & @CRLF) Return "0x" & Hex($aRet[2], 8) EndFunc ;==>GDIPlus_GdipGetHatchForegroundColor ;=============================================================== ; Description - Returns the background color of the specified Hatch Brush. ; Parameters ; $hBrushHatch - [in] The handle of the Hatch Brush returned from GDIPlus_CreateHatchBrush() ; Returns - [out] A hexi-decimal number, 0xAARRGGBB, being the back ground color. ;GdipGetHatchBackgroundColor(GpHatch *brush, ARGB* backcol) ; Func GDIPlus_GetHatchBackgroundColor($hBrushHatch) Local $res, $aRet $aRet = DllCall($ghGDIPDll, "int", "GdipGetHatchBackgroundColor", "int", $hBrushHatch, "int*", 0) $res = "GdipCreateHatchBrush " & @CRLF ;for $x = 0 to 2 ; $res &= $x & " " & $aRet[$x] & @CRLF ;Next ;ConsoleWrite($res & @CRLF) Return "0x" & Hex($aRet[2], 8) EndFunc ;==>GDIPlus_GetHatchBackgroundColor
BrettF Posted July 23, 2008 Posted July 23, 2008 Man you should create like a GDI examples library or something, they all rock! muttley Keep up the awesome work! Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Andreik Posted July 23, 2008 Posted July 23, 2008 (edited) Thanks Malkey! Inspired by you I search on MSDN about GdipTexture and I write some functions: expandcollapse popupDim $WrapMode[5] = ["Tile = 0x00000000", _ "TileFlipX = 0x00000001", _ "TileFlipY = 0x00000002", _ "TileFlipXY = 0x00000003", _ "Clamp = 0x00000004"] DIM $MatrixOrder[2] = ["MatrixOrderPrepend = 0","MatrixOrderAppend = 1"] Func GdipCreateTexture($hImg,$WrapMode) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipCreateTexture","int",$hImg,"int",$WrapMode,"int*",0) Return $RESULT[3] EndFunc Func GdipCreateTexture2($hImg,$WrapMode,$X,$Y,$W,$H) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipCreateTexture2","int",$hImg,"int",$WrapMode,"float",$X,"float",$Y,"float",$W,"float",$H,"int*",0) Return $RESULT[7] EndFunc Func GdipSetTextureWrapMode($hBrush,$WrapMode) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipSetTextureWrapMode","int",$hBrush,"int",$WrapMode) Return $RESULT[2] EndFunc Func GdipGetTextureWrapMode($hBrush) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipGetTextureWrapMode","int",$hBrush,"int*",0) Return $RESULT[2] EndFunc Func GdipGetTextureImage($hBrush) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipGetTextureImage","int",$hBrush,"int*",0) Return $RESULT[2] EndFunc Func GdipSetTextureTransform($hBrush,$hMatrix) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipSetTextureTransform","int",$hBrush,"int",$hMatrix) EndFunc Func GdipRotateTextureTransform($hBrush,$Angle,$MatrixOrder) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipRotateTextureTransform","int",$hBrush,"float",$Angle,"int",$MatrixOrder) EndFunc Func GdipScaleTextureTransform($hBrush,$SX,$SY,$MatrixOrder) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipScaleTextureTransform","int",$hBrush,"float",$SX,"float",$SY,"int",$MatrixOrder) EndFunc Func GdipResetTextureTransform($hBrush) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipResetTextureTransform","int",$hBrush) EndFunc Edited July 23, 2008 by Andreik
Cha0sBG Posted July 23, 2008 Posted July 23, 2008 cool script muttley Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now