Jump to content
Sign in to follow this  
UEZ

[Solved] GdipSetLineColors() code

Recommended Posts

UEZ

Does somebody know the code behind GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2)?

GDIPlus_CreateLineBrush() is shown here: http://www.autoitscript.com/forum/index.php?showtopic=75792 (Malkey).

I found on MSDN some information about it but not the source code behind to translate it to AutoIt! :D

Thanks,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Malkey

Does somebody know the code behind GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2)?

GDIPlus_CreateLineBrush() is shown here: http://www.autoitscript.com/forum/index.php?showtopic=75792 (Malkey).

I found on MSDN some information about it but not the source code behind to translate it to AutoIt! :unsure:

Thanks,

UEZ

This example of using GdipSetLineColors function from gdiplus.dll file works.

Use Ctrl+Alt+C to change the two colours of the linear gradient brush randomly.

The random colours are set to the brush using the GdipSetLineColors wrapper.

Or you could just use

DllCall($ghGDIPDll, "int", "GdipSetLineColors", "hwnd", $hBrush, "int", $iArgb1, "int", $iArgb2)

Note: Because $ghGDIPDll is used, _GDIPlus_Startup() needs to called before using.

$ghGDIPDll is declared within _GDIPlus_Startup() which is found in the include file, GDIPlus.au3.

#include <GDIPlus.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>

HotKeySet(("^!c"), "ToggleDisplay"); Ctrl+Alt+C  Change display

Global $hGraphic, $hBrushLin, $hBrushLin1, $hBrushLin2
Global $iX = 20, $iY = 20, $iWidth = 440, $iHeight = 120
Global $GuiSizeX = 480, $GuiSizeY = 440

$hGui = GUICreate("Ctrl+Alt+C  to Change Random Colours with _GDIPlus_SetLineColors()", $GuiSizeX, $GuiSizeY)

_GDIPlus_Startup()

$hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hGui)
$hBMPBuff = _GDIPlus_BitmapCreateFromGraphics($GuiSizeX, $GuiSizeY, $hGraphicGUI)
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMPBuff)

_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFB0) ; set background color

$hBrushLin = GDIPlus_CreateLineBrush($iX, $iY, $iWidth + $iX, $iY, 0xFF000000, 0xFFFFFFFF, 0) ;Black, White

_GDIPlus_GraphicsFillRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hBrushLin)


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
GUISetState()

Do
    Sleep(25)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_GDIPlus_BrushDispose($hBrushLin)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()

;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)
EndFunc   ;==>MY_PAINT

; Description:  Creates a LinearGradientBrush object from a set of boundary points and boundary colors.
; Parameters:
; $iPoint1X, $iPoint1Y -  [in] x,y co-ordinates of a PointF object that specifies the starting point
;                             of the gradient.  The starting boundary line passes through the starting point.
; $iPoint2X, $iPoint2Y -  [in] x,y co-ordinates of a  PointF object that specifies the ending point of the
;                             gradient.  The ending boundary line passes through the ending point.
; $iArgb1              -  [in] ARGB color that specifies the color at the starting boundary line of this
;                              linear gradient brush.
; $iArgb2              -  [in] ARGB color object that specifies the color at the ending boundary line of
;                              this linear gradient brush.
; $WrapMode            -  [in] A member of the WrapMode enumeration that specifies how areas filled with
;                              the brush are tiled.
; $aRet[6] is the lineGradient [out] Pointer to a variable that receives a pointer (Handle)to the new
;                                   created LinearGradientBrush object.
; GdipCreateLineBrush(GDIPCONST GpPointF* point1, GDIPCONST GpPointF* point2, ARGB color1, ARGB color2,
;                                                  GpWrapMode wrapMode, GpLineGradient **lineGradient)
; Reference:  http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx
Func GDIPlus_CreateLineBrush($iPoint1X, $iPoint1Y, $iPoint2X, $iPoint2Y, $iArgb1 = 0xFF0000FF, _
        $iArgb2 = 0xFFFF0000, $WrapMode = 0)

    Local $tPoint1, $pPoint1, $tPoint2, $pPoint2, $aRet, $res

    If $iArgb1 = "" Then $iArgb1 = 0xFF0000FF
    If $iArgb2 = "" Then $iArgb2 = 0xFFFF0000
    If $WrapMode = -1 Then $WrapMode = 0

    $tPoint1 = DllStructCreate("float X;float Y")
    $pPoint1 = DllStructGetPtr($tPoint1)
    DllStructSetData($tPoint1, "X", $iPoint1X)
    DllStructSetData($tPoint1, "Y", $iPoint1Y)

    $tPoint2 = DllStructCreate("float X;float Y")
    $pPoint2 = DllStructGetPtr($tPoint2)
    DllStructSetData($tPoint2, "X", $iPoint2X)
    DllStructSetData($tPoint2, "Y", $iPoint2Y)
    ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined
    $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrush", "ptr", $pPoint1, "ptr", $pPoint2, _ 
                        "int", $iArgb1, "int", $iArgb2, "int", $WrapMode, "int*", 0)
    ;$res = "GdipCreateLineBrush " & @CRLF
    ;for $x = 0 to 6
    ;$res &= $x & "  " & $aRet[$x] & @CRLF
    ;Next
    ;ConsoleWrite($res & @CRLF)
    Return $aRet[6]
EndFunc   ;==>GDIPlus_CreateLineBrush

Func ToggleDisplay()
    Local $col1 = "0xFF" & Hex(Random(0x10, 0xFF, 1), 2) & Hex(Random(0x10, 0xFF, 1), 2) & Hex(Random(0x10, 0xFF, 1), 2)
    Local $col2 = "0xFF" & Hex(Random(0x80, 0xFF, 1), 2) & Hex(Random(0x80, 0xFF, 1), 2) & Hex(Random(0x80, 0xFF, 1), 2)
    _GDIPlus_SetLineColors($hBrushLin, $col1, $col2)
    _GDIPlus_GraphicsFillRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hBrushLin)
    _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0)
EndFunc   ;==>ToggleDisplay

; Description - Sets the starting color and ending color of this linear gradient brush.
; $hBrush     - Handle of existing LineBrush
; $iArgb1,  $iArgb2 are the colours to change to in 0xAARRGGBB hex colour format.
Func _GDIPlus_SetLineColors($hBrush, $iArgb1, $iArgb2)
    Local $hStatus
    $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineColors", "hwnd", $hBrush, "int", $iArgb1, "int", $iArgb2)
    Return
EndFunc   ;==>_GDIPlus_SetLineColors

Share this post


Link to post
Share on other sites
UEZ

Thanks Malkey!

From where did you get these code information? On the web site there are just generic information.

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
UEZ

Thanks for the information monoceres.

Do you know whether there is a non LinearGradientBrush? I want to make the balls in "Rotating Cube" more looking 3D. Currently there are rather flat!

A bright point which becomes darker circularly. I'm searching for something like this descripted in "Creating a Path Gradient"!

HHHmmmm, I think Malkey has already implement it here.

Creating a Path Gradient:

// Create a path that consists of a single ellipse.
     GraphicsPath path;
     path.AddEllipse(0, 0, 200, 100);
     
     // Create a path gradient brush based on the elliptical path.
     PathGradientBrush pthGrBrush(&path);
     pthGrBrush.SetGammaCorrection(TRUE);
     
     // Set the color along the entire boundary to blue.
     Color color(Color(255, 0, 0, 255));
     INT num = 1;
     pthGrBrush.SetSurroundColors(&color, &num);
     
     // Set the center color to aqua.
     pthGrBrush.SetCenterColor(Color(255, 0, 255, 255));
      
     // Use the path gradient brush to fill the ellipse. 
     graphics.FillPath(&pthGrBrush, &path);
     
     // Set the focus scales for the path gradient brush.
     pthGrBrush.SetFocusScales(0.3f, 0.8f);
     
     // Use the path gradient brush to fill the ellipse again.
     // Show this filled ellipse to the right of the first filled ellipse.
     graphics.TranslateTransform(220.0f, 0.0f);
     graphics.FillPath(&pthGrBrush, &path);

My try:

[autoit]#include <GDIPlus.au3>

#include <WindowsConstants.au3>

#include <Array.au3>

Opt("GUIOnEventMode", 1)

Global Const $Width = 800

Global Const $Height = 800

Global $hwnd = GUICreate("Test", $Width, $Height)

GUISetOnEvent(-3, "Close")

GUISetState()

_GDIPlus_Startup()

Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)

Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $graphics)

Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsClear($backbuffer)

_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)

$pen = _GDIPlus_PenCreate(0, 1)

_GDIPlus_PenSetColor($pen, 0xFFAAAAAF)

_GDIPlus_GraphicsClear($backbuffer, 0xFF777777)

Global $hPath = _GDIPlus_CreatePath()

Global $hBrushGrad = _GDIPlus_CreatePathGradientFromPath($hPath)

_GDIPlus_SetLineGammaCorrection($hBrushGrad, True)

_GDIPlus_SetPathGradientSurroundColorsWithCount($hBrushGrad, "0xFFFFFF00")

_GDIPlus_SetPathGradientCenterColor($hBrushGrad, "0xFFFF0000")

_GDIPlus_FillPath($backbuffer, $hBrushGrad, $hPath)

_GDIPlus_ClosePathFigure($hPath)

_GDIPlus_GraphicsFillEllipse($backbuffer, $Width / 2 - 200, $Height / 2 - 200, 400, 400, $hBrushGrad)

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $Width, $Height)

Do

Until Not Sleep(30)

Func _GDIPlus_CreatePath()

Local $hPath, $res

$hPath = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0)

Local $res = "GdipCreatePath " & Hex($hPath[2]) & @CRLF

Return $hPath[2]

EndFunc ;==>GDIPlus_CreatePath

Func _GDIPlus_CreatePathGradientFromPath($hPath)

Local $hBrushGrad

$hBrushGrad = DllCall($ghGDIPDll, "int", "GdipCreatePathGradientFromPath", "hwnd", $hPath, "int*", 0)

Return $hBrushGrad[2]

EndFunc ;==>GDIPlus_CreatePathGradientFromPath

Func _GDIPlus_SetLineGammaCorrection($hBrush, $useGammaCorrection = True)

Local $aResult

$aResult = DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "hwnd", $hBrush, "int", $useGammaCorrection)

Return $aResult[0]

EndFunc ;==>GDIPlus_SetLineGammaCorrection

Func _GDIPlus_SetPathGradientCenterColor($hBrush, $iARGB)

Local $aResult

$aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterColor", "hwnd", $hBrush, "int", $iARGB)

If @error Then Return SetError(@error, @extended, False)

Return $aResult;SetError($aResult[0], 0, $aResult[0] = 0)

EndFunc ;==>GDIPlus_SetPathGradientCenterColor

Func _GDIPlus_FillPath($hGraphic, $hBrushGrad, $hPath)

DllCall($ghGDIPDll, "int", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $hBrushGrad, "hwnd", $hPath)

Return

EndFunc ;==>GDIPlus_FillPath

Func _GDIPlus_SetPathGradientSurroundColorsWithCount($hBrush, $aArgb)

Local $iI, $iCount, $aResult, $res, $x, $pArgb

If IsArray($aArgb) Then

$iCount = UBound($aArgb);_WinAPI_FloatToInt(UBound($aArgb));

$tArgb = DllStructCreate("int[" & $iCount & "]")

$pArgb = DllStructGetPtr($tArgb)

For $iI = 0 To $iCount - 1

;DllStructSetData($tArgb, 1,dec('FF0000FF'),$iI + 1)

DllStructSetData($tArgb, 1, $aArgb[$iI], $iI + 1)

Next

Else

$iCount = 1

$tArgb = DllStructCreate("int")

$pArgb = DllStructGetPtr($tArgb)

DllStructSetData($tArgb, 1, $aArgb, 1)

EndIf

$aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "hwnd", $hBrush, _

"int", $pArgb, "int*", $iCount)

If @error Then Return SetError(@error, @extended, 0)

Return $aResult;SetError($aResult[0], 0, $aResult[2])

EndFunc ;==>GDIPlus_SetPathGradientSurroundColorsWithCount

Func _GDIPlus_ClosePathFigure($hPath)

$aResult1 = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "hwnd", $hPath)

Return

EndFunc ;==>GDIPlus_ClosePathFigure

Func Close()

_GDIPlus_PenDispose($pen)

_GDIPlus_BrushDispose($hBrushGrad)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>Close

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Malkey

Thanks Malkey!

From where did you get these code information? On the web site there are just generic information.

UEZ

I would not called the information at

http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx

generic. It is specifically informative about the particular dll function required.

Looking at the GdipSetLineColors function from the gdiplus.dll, we have:-

GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2)

from the msdn site.

This is a C/C++ wrapper which enables a call to a function in the gdiplus,dll.

Notice there are three parameter needed, in that specific order, to be entered into a DllCall for use in AutoIt scripts..

Looking at DllCall() in help file, there needs to be three "type", params to be entered.

DllCall($ghGDIPDll, "int", "GdipSetLineColors", "hwnd", $hBrush, "int", $iArgb1, "int", $iArgb2 )

"GpLineGradient *brush" can be read as a pointer to a line gradient brush. Mentally, I said, it is a pointer to a brush handle so I used "type" hwnd. To be more conventionally correct "ptr" should be used, I believe. Either works.

The GDIPlus.au3 and WinAPI.au3 include files have many examples of DllCalls that show correct usage for a lot of the parameters that appear on the msdn sites.. Also, a forum search on the dll function name can be beneficial.

This site seems to always come up from a Google search on a gdiplus dll function name.

http://www.com.it-berater.org/gdiplus/nofr...h_functions.htm

I am far from being an expert on this, and I am happy to be corrected where wrong.

Share this post


Link to post
Share on other sites
UEZ

I would not called the information at

http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx

generic. It is specifically informative about the particular dll function required.

Looking at the GdipSetLineColors function from the gdiplus.dll, we have:-

GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2)

from the msdn site.

This is a C/C++ wrapper which enables a call to a function in the gdiplus,dll.

Notice there are three parameter needed, in that specific order, to be entered into a DllCall for use in AutoIt scripts..

Looking at DllCall() in help file, there needs to be three "type", params to be entered.

DllCall($ghGDIPDll, "int", "GdipSetLineColors", "hwnd", $hBrush, "int", $iArgb1, "int", $iArgb2 )

"GpLineGradient *brush" can be read as a pointer to a line gradient brush. Mentally, I said, it is a pointer to a brush handle so I used "type" hwnd. To be more conventionally correct "ptr" should be used, I believe. Either works.

The GDIPlus.au3 and WinAPI.au3 include files have many examples of DllCalls that show correct usage for a lot of the parameters that appear on the msdn sites.. Also, a forum search on the dll function name can be beneficial.

This site seems to always come up from a Google search on a gdiplus dll function name.

http://www.com.it-berater.org/gdiplus/nofr...h_functions.htm

I am far from being an expert on this, and I am happy to be corrected where wrong.

Thanks for the information Malkey!

I have currently one problem: C/C++ :D

I will start to learn it soon otherwise it will be always a big handicap...

Any idea what I made wrong in my previous post (my try)?

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Malkey

Thanks for the information Malkey!

I have currently one problem: C/C++ :mad:

I will start to learn it soon otherwise it will be always a big handicap...

Any idea what I made wrong in my previous post (my try)?

UEZ

You needed _GDIPlus_AddPathEllipse().

This works.

#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt("GUIOnEventMode", 1)

Global Const $Width = 800
Global Const $Height = 800

Global $hwnd = GUICreate("Test", $Width, $Height)
GUISetOnEvent(-3, "Close")
GUISetState()

GUIRegisterMsg(0xF, "MY_PAINT")
_GDIPlus_Startup()
Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $graphics)
Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsClear($backbuffer)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)


$pen = _GDIPlus_PenCreate(0, 1)
_GDIPlus_PenSetColor($pen, 0xFFAAAAAF)

_GDIPlus_GraphicsClear($backbuffer, 0xFF777777)

Global $hPath = _GDIPlus_CreatePath()
_GDIPlus_AddPathEllipse($hPath, $Width / 2 - 200, $Height / 2 - 200, 400, 400)
Global $hBrushGrad = _GDIPlus_CreatePathGradientFromPath($hPath)
_GDIPlus_SetLineGammaCorrection($hBrushGrad, True)
_GDIPlus_SetPathGradientSurroundColorsWithCount($hBrushGrad, 0xFFFFFF00); Comment out this line to see result
_GDIPlus_SetPathGradientCenterColor($hBrushGrad, "0xFFFF0000")
_GDIPlus_FillPath($backbuffer, $hBrushGrad, $hPath)
_GDIPlus_ClosePathFigure($hPath)

_GDIPlus_GraphicsFillEllipse($backbuffer, $Width / 2 - 200, $Height / 2 - 200, 400, 400, $hBrushGrad)
_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $Width, $Height)


Do

Until Not Sleep(30)

Func _GDIPlus_CreatePath()
    Local $hPath, $res
    $hPath = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0)
    Local $res = "GdipCreatePath  " & Hex($hPath[2]) & @CRLF
    Return $hPath[2]
EndFunc   ;==>_GDIPlus_CreatePath

Func _GDIPlus_AddPathEllipse($hPath, $iX, $iY, $iWidth, $iHeight)
    Local $aResult, $res
    $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathEllipse", "hwnd", $hPath, "int", _WinAPI_FloatToInt($iX), _
            "int", _WinAPI_FloatToInt($iY), "int", _WinAPI_FloatToInt($iWidth), "int", _WinAPI_FloatToInt($iHeight))
EndFunc   ;==>_GDIPlus_AddPathEllipse

Func _GDIPlus_CreatePathGradientFromPath($hPath)
    Local $hBrushGrad
    $hBrushGrad = DllCall($ghGDIPDll, "int", "GdipCreatePathGradientFromPath", "hwnd", $hPath, "int*", 0)
    Return $hBrushGrad[2]
EndFunc   ;==>_GDIPlus_CreatePathGradientFromPath

Func _GDIPlus_SetLineGammaCorrection($hBrush, $useGammaCorrection = True)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "hwnd", $hBrush, "int", $useGammaCorrection)
    Return $aResult[0]
EndFunc   ;==>_GDIPlus_SetLineGammaCorrection

Func _GDIPlus_SetPathGradientCenterColor($hBrush, $iARGB)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterColor", "hwnd", $hBrush, "int", $iARGB)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult;SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc   ;==>_GDIPlus_SetPathGradientCenterColor

Func _GDIPlus_FillPath($hGraphic, $hBrushGrad, $hPath)
    DllCall($ghGDIPDll, "int", "GdipFillPath", "hwnd", $hGraphic, "hwnd", $hBrushGrad, "hwnd", $hPath)
    Return
EndFunc   ;==>_GDIPlus_FillPath

Func _GDIPlus_SetPathGradientSurroundColorsWithCount($hBrush, $aArgb)
    Local $iI, $iCount, $aResult, $res, $x, $pArgb
    If IsArray($aArgb) Then
        $iCount = UBound($aArgb);_WinAPI_FloatToInt(UBound($aArgb));
        $tArgb = DllStructCreate("int[" & $iCount & "]")
        $pArgb = DllStructGetPtr($tArgb)
        For $iI = 0 To $iCount - 1
            ;DllStructSetData($tArgb, 1,dec('FF0000FF'),$iI + 1)
            DllStructSetData($tArgb, 1, $aArgb[$iI], $iI + 1)
        Next
    Else
        $iCount = 1
        $tArgb = DllStructCreate("int")
        $pArgb = DllStructGetPtr($tArgb)
        DllStructSetData($tArgb, 1, $aArgb, 1)
    EndIf
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "hwnd", $hBrush, _
            "int", $pArgb, "int*", $iCount)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult;SetError($aResult[0], 0, $aResult[2])
EndFunc   ;==>_GDIPlus_SetPathGradientSurroundColorsWithCount

Func _GDIPlus_ClosePathFigure($hPath)
    $aResult1 = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "hwnd", $hPath)
    Return
EndFunc   ;==>_GDIPlus_ClosePathFigure

Func Close()
    _GDIPlus_PenDispose($pen)
    _GDIPlus_BrushDispose($hBrushGrad)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    DllCall($ghGDIPDll, "int", "GdipDeletePath", "ptr", $hPath)
    _GDIPlus_Shutdown()
    Exit
EndFunc   ;==>Close

Func MY_PAINT($hwnd, $Msg, $wParam, $lParam)
    ; Check, if the GUI with the Graphic should be repainted
    If $hwnd = $hwnd Then
        _GDIPlus_GraphicsFillEllipse($backbuffer, $Width / 2 - 200, $Height / 2 - 200, 400, 400, $hBrushGrad)
        _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $Width, $Height)
    EndIf
EndFunc   ;==>MY_PAINT
;

Share this post


Link to post
Share on other sites
UEZ

THANK YOU VERY MUCH MALKEY! :o

Last thing: if you can help me with the _GDIPlus_SetCenterPoint() function, I would be very happy!

I don't understand currently the C/C++ syntax :D

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Malkey

THANK YOU VERY MUCH MALKEY! :D

Last thing: if you can help me with the _GDIPlus_SetCenterPoint() function, I would be very happy!

I don't understand currently the C/C++ syntax :mad:

UEZ

UEZ

A search on the forums for "GDIPlus_SetPathGradientCenterPoint" shows it use twice.

http://www.autoitscript.com/forum/index.ph...st&p=552977

The script here has other useful wrapper that might be handy.

I still use this script/utility to get the points of a created polygon shape for other scripts.

http://www.autoitscript.com/forum/index.ph...st&p=549536

This is where ProgAndy solved an insurmountable problem I had with the DllCall for GdipSetPathGradientSurroundColorsWithCount.

You may recognize the graphic in the following post.

Malkey

Share this post


Link to post
Share on other sites
UEZ

Yes, I can remember this thread. Anyway, THANK YOU FOR YOUR HELP AGAIN.

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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  

×