Jump to content
Sign in to follow this  
Sidley

GDI+ Gauges

Recommended Posts

Hello folks, I've been working on a couple of GDI+ gauges, they need a bit of polish here and there I'd appreciate it if you guys/girls could play around and give me some suggestions. Cheers.

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Gauges With Sliders.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <GDIplus.au3>
#include <ColorConstants.au3>
#include <Array.au3>

Global Const $width = @DesktopWidth * 3 / 4
Global Const $height = @DesktopHeight
Global $title = "GDI+"

; Build your GUI here
Opt("GUIOnEventMode", 1)
Global $hwnd = GUICreate($title, @DesktopWidth, @DesktopHeight, -1, -1, $WS_SIZEBOX)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
GUISetState()


#Region Sliders

Global $VariableMaxValue = 100
Global $SecondaryMaxValue = 100
Global $VariableMinValue = 0
Global $HexLabel = GUICtrlCreateLabel("Hex Value: ", @DesktopWidth - 300, 50, 150, 20)
GUICtrlSetColor($HexLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSliderThick = GUICtrlCreateSlider(@DesktopWidth - 300, 100, 250, 20)
GUICtrlSetLimit(-1, 240, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $ThickLabel = GUICtrlCreateLabel("Thickness Value: " & GUICtrlRead($idSliderThick), @DesktopWidth - 300, 120, 150, 20)
GUICtrlSetColor($ThickLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSliderVal = GUICtrlCreateSlider(@DesktopWidth - 300, 150, 250, 20)
GUICtrlSetLimit(-1, $VariableMaxValue, $VariableMinValue) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $ValLabel = GUICtrlCreateLabel("Variable Value: " & GUICtrlRead($idSliderVal), @DesktopWidth - 300, 170, 150, 20)
GUICtrlSetColor($ValLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSliderScale = GUICtrlCreateSlider(@DesktopWidth - 300, 200, 250, 20)
GUICtrlSetLimit(-1, 20, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $ScaleLabel = GUICtrlCreateLabel("Scale Value: " & (GUICtrlRead($idSliderScale) * .1), @DesktopWidth - 300, 220, 150, 20)
GUICtrlSetColor($ScaleLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idStartAngleScale = GUICtrlCreateSlider(@DesktopWidth - 300, 250, 250, 20)
GUICtrlSetLimit(-1, 360, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $StartAngleLabel = GUICtrlCreateLabel("Angle Value: " & GUICtrlRead($idStartAngleScale), @DesktopWidth - 300, 270, 150, 20)
GUICtrlSetColor($StartAngleLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSweepScale = GUICtrlCreateSlider(@DesktopWidth - 300, 300, 250, 20)
GUICtrlSetLimit(-1, 360, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $SweepLabel = GUICtrlCreateLabel("Sweep Value: " & GUICtrlRead($idSweepScale), @DesktopWidth - 300, 320, 150, 20)
GUICtrlSetColor($SweepLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idCheckmarksScale = GUICtrlCreateSlider(@DesktopWidth - 300, 350, 250, 20)
GUICtrlSetLimit(-1, 20, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $CheckmarkLabel = GUICtrlCreateLabel("No. of Checkmarks: " & GUICtrlRead($idCheckmarksScale), @DesktopWidth - 300, 370, 150, 20)
GUICtrlSetColor($CheckmarkLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idVarMin = GUICtrlCreateSlider(@DesktopWidth - 300, 450, 250, 20)
GUICtrlSetLimit(-1, 0, -50) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $MinLabel = GUICtrlCreateLabel("Min Value: " & GUICtrlRead($idVarMin), @DesktopWidth - 300, 470, 150, 20)
GUICtrlSetColor($MinLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $RadioGroup1 = GUICtrlCreateGroup("", @DesktopWidth - 300, 500, 200, 50)
Global $clockwiseCtrl = GUICtrlCreateRadio("Clockwise", @DesktopWidth - 280, 520, 80, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $antiClockwiseCtrl = GUICtrlCreateRadio("Anti-clockwise", @DesktopWidth - 200, 520, 85, 20)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $RadioGroup2 = GUICtrlCreateGroup("", @DesktopWidth - 300, 550, 200, 50)
Global $RadialCtrl = GUICtrlCreateRadio("Radial", @DesktopWidth - 280, 570, 80, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $SquareCtrl = GUICtrlCreateRadio("Linear", @DesktopWidth - 200, 570, 85, 20)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
GUICtrlSetData($idSliderThick, 35)
GUICtrlSetData($idSliderScale, 10)
GUICtrlSetData($idStartAngleScale, 180)
GUICtrlSetData($idSweepScale, 180)
GUICtrlSetData($idCheckmarksScale, 10)
#EndRegion Sliders

GUISetBkColor(0x303030)
Global $aWindowSize = WinGetClientSize($hwnd)


; Load your GDI+ resources here:
_GDIPlus_Startup()
Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)


While 1
    _GDIPlus_GraphicsClear($backbuffer, 0xFF303030)
    Sleep(50)

    #Region Test Variables
    Global $Thickness = GUICtrlRead($idSliderThick)
    Global $Variable = GUICtrlRead($idSliderVal)
    Global $tValue = 0xFF000000
    Global $rValue = 0x00FF0000
    Global $gValue = BitShift((255 - (($Variable / $VariableMaxValue) * 255)), -8)
    Global $bValue = 0x00
    Global $ScalingFactor = GUICtrlRead($idSliderScale) / 10
    GUICtrlSetData($HexLabel, "Hex Value: " & HEX(BitOR($tValue, $rValue, $gValue, $bValue)))
    Global $PenColour = ("0x" & HEX(BitOR($tValue, $rValue, $gValue, $bValue)))
    GUICtrlSetData($ValLabel, "Variable Value: " & GUICtrlRead($idSliderVal))
    GUICtrlSetData($ThickLabel, "Thickness Value: " & GUICtrlRead($idSliderThick))
    GUICtrlSetData($ScaleLabel, "Scale Value: " & (GUICtrlRead($idSliderScale) * .1))
    GUICtrlSetData($StartAngleLabel, "Angle Value: " & GUICtrlRead($idStartAngleScale))
    GUICtrlSetData($SweepLabel, "Sweep Value: " & GUICtrlRead($idSweepScale))
    GUICtrlSetData($CheckmarkLabel, "No. Of Checkmarks: " & GUICtrlRead($idCheckmarksScale))
    GUICtrlSetData($MinLabel, "Min Value: " & GUICtrlRead($idVarMin))
    GUICtrlSetLimit($idSliderVal, $VariableMaxValue, $VariableMinValue)
    Local $Radius = 300
    If GUICtrlRead($clockwiseCtrl) = $GUI_CHECKED Then
        Local $Clockwise = True
    Else
        Local $Clockwise = False
    EndIf
    Local $StartAngle = GUICtrlRead($idStartAngleScale)
    Local $SweepAngle = GUICtrlRead($idSweepScale)
    Local $CentrePointX = 500
    Local $CentrePointY = 500
    Local $NoOfCheckmarks = GUICtrlRead($idCheckmarksScale)
    Local $CheckLength = 15
    Local $AllowedLimit = 75
    Local $VariableLimit = True
    Local $VariableMinValue = GUICtrlRead($idVarMin)
    #EndRegion Test Variables

    #Region Function Call
    If GUICtrlRead($RadialCtrl) = $GUI_CHECKED Then
        _GDIPlus_GraphicsDrawPath($backbuffer, _Gauges_DrawRadialGauge($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, $VariableLimit, $AllowedLimit, $VariableMinValue))
        GUICtrlSetState($idSliderThick, $GUI_SHOW)
        GUICtrlSetState($ThickLabel, $GUI_SHOW)
        GUICtrlSetState($idStartAngleScale, $GUI_SHOW)
        GUICtrlSetState($StartAngleLabel, $GUI_SHOW)
        GUICtrlSetState($idSweepScale, $GUI_SHOW)
        GUICtrlSetState($SweepLabel, $GUI_SHOW)
        GUICtrlSetState($RadioGroup1, $GUI_SHOW)
        GUICtrlSetState($clockwiseCtrl, $GUI_SHOW)
        GUICtrlSetState($antiClockwiseCtrl, $GUI_SHOW)
    Else
        _GDIPlus_GraphicsDrawPath($backbuffer, _Gauges_DrawLinearGauge($backbuffer, $CentrePointX, $CentrePointY, 600, 100, $Variable, $ScalingFactor, $NoOfCheckmarks, $CheckLength, $VariableMaxValue, $VariableLimit, $AllowedLimit, $VariableMinValue))
        GUICtrlSetState($idSliderThick, $GUI_HIDE)
        GUICtrlSetState($ThickLabel, $GUI_HIDE)
        GUICtrlSetState($idStartAngleScale, $GUI_HIDE)
        GUICtrlSetState($StartAngleLabel, $GUI_HIDE)
        GUICtrlSetState($idSweepScale, $GUI_HIDE)
        GUICtrlSetState($SweepLabel, $GUI_HIDE)
        GUICtrlSetState($RadioGroup1, $GUI_HIDE)
        GUICtrlSetState($clockwiseCtrl, $GUI_HIDE)
        GUICtrlSetState($antiClockwiseCtrl, $GUI_HIDE)
    EndIf
    #EndRegion Function Call

    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
WEnd

Func close()
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_Shutdown()
    Exit
EndFunc   ;==>close


#Region Functions

#Region Draw Linear Gauge
; #FUNCTION# ====================================================================================================================
; Name...........: _Gauges_DrawLinearGauge
; Description ...: Creates a horizontal or vertical gauge in the graphics backbuffer
; Syntax.........: _Gauges_DrawLinearGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $Variable, [$ScalingFactor = 1, [$NoOfCheckmarks = 6, [$CheckLength = 20,
;                   + [$VariableMaxValue = 256, [$VariableLimit = False, [$AllowedLimit = 0,  [$VariableMinValue = 0]]]]]]] )
; Parameters ....:  $backbuffer             - [byref] The graphics object to draw the gauge to.
;                           $CentrePointX           - The horizontal coordinate of the centre of the gauge.
;                           $CentrePointY           - The vertical coordinate of the centre of the gauge.
;                           $GaugeWidth             - The width of the gauge (Duh).
;                           $GaugeHeight        - The height of the gauge.
;                           $Variable               - The variable used to change the gauge.
;                           $ScalingFactor          - [optional] Scales the gauge by this factor. Default is 1, i.e. no scaling.
;                           $NoOfCheckmarks - [optional] The number of dashes indicating a scale around the gauge. Default is 6.
;                           $CheckLength            - [optional] The length of the checkmarks in pixels. Default is 20.
;                           $VariableMaxValue   - [optional] The maximum value of the variable. Default is 256.
;                           $VariableLimit          - [optional] Boolean, if TRUE, displays a red limit indicator on the scale. Default is FALSE.
;                           $AllowedLimit           -[optional] The value of the above limit if it is drawn. Default is 0.
;                           $VariableMinValue   -[optional] The minimum value of the variable. Only used if negative numbers are required. Default is 0.
; Author ........: Simon Renardson (Sidley)
; Modified.......:
; Remarks .......:  There is a more comprehensive function available, but I deemed it overkill for the majority of people.
; Related .......:  _GDIPlus_
; Example .......: Yes
; ===============================================================================================================================
;Draw a Linear gauge to the screen
Func _Gauges_DrawLinearGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $Variable, $ScalingFactor = 1, $NoOfCheckmarks = 6, $CheckLength = 20, $VariableMaxValue = 256, $VariableLimit = False, $AllowedLimit = 0,  $VariableMinValue = 0)
If $Variable >= 0 Then
        Local $BrushColour = ("0xFF4BF221")
    Else
        Local $BrushColour = ("0xFFFF0000")
    EndIf
    If $GaugeWidth >= $GaugeHeight Then
        Local $GaugeBrush = _GDIPlus_HatchBrushCreate(1, 0x00000000, $BrushColour) ;Set to vertical hatch if the gauge is horizontal
    Else
        Local $GaugeBrush = _GDIPlus_HatchBrushCreate(0, 0x00000000, $BrushColour) ;Set to horizontal hatch if the gauge is vertical
    EndIf
    Local $TextBrush = _GDIPlus_BrushCreateSolid($BrushColour)
    Local $Path = _GDIPlus_PathCreate()
    Local $hPen = _GDIPlus_PenCreate("0xFF96A29F", 2 * $ScalingFactor) ; Off-white pen for outlines
    Local $AllowedPen = _GDIPlus_PenCreate("0xFFFF0000", 8 * $ScalingFactor) ;Red pen for allowed speed indicators

    If $GaugeWidth >= $GaugeHeight Then ;If the gauge is to be length wise
        _GDIPlus_PathAddLine($Path, $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor), ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor), $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor) + ($Variable * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor))
        _GDIPlus_PathAddLine($Path, $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor) + ($Variable * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), ($CentrePointY - ($GaugeHeight / 2) * $ScalingFactor), $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor), ($CentrePointY - ($GaugeHeight / 2) * $ScalingFactor))
        _GDIPlus_PathCloseFigure($Path)
    Else ;If the gauge is to be height wise
        _GDIPlus_PathAddLine($Path, ($CentrePointX + ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), ($CentrePointX + ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor) - $Variable * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor)
        _GDIPlus_PathAddLine($Path, ($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor) - $Variable * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor, ($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor))
        _GDIPlus_PathCloseFigure($Path)
    EndIf
    _GDIPlus_GraphicsFillPath($backbuffer, $Path, $GaugeBrush) ;Draw the gauge

    _DrawBar($backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $VariableMaxValue, $VariableMinValue, $hPen, $ScalingFactor) ;Draw the outline for the gauge
    _DrawLinearGaugeCheckMarks($backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, $hPen) ;Draw the checkmarks for the gauge
    If $VariableLimit Then
        _DrawLinearAllowedSpeed($backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $VariableMaxValue, $AllowedLimit, $AllowedPen, $ScalingFactor, $VariableLimit) ;Draw the allowed speed indicator(s) for the gauge
    EndIf
    _LinearGaugeText($backbuffer, $Variable, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, $TextBrush) ;Put the gauge text above the gauge

    _GDIPlus_PathDispose($Path) ;Tidy up
    _GDIPlus_BrushDispose($GaugeBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PenDispose($AllowedPen)
    _GDIPlus_BrushDispose($TextBrush)
EndFunc   ;==>_DrawLinearGauge

;Draw the text for the main gauge
Func _LinearGaugeText(ByRef $backbuffer, $Variable, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, ByRef $TextBrush)
    Local $FontSize = 80 * $ScalingFactor ;Linear gauge font size
    Local $Path = _GDIPlus_PathCreate()
    Local $Format = _GDIPlus_StringFormatCreate()
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB") ;Centre text font
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize, 2)
    _GDIPlus_StringFormatSetAlign($Format, 2) ;Right align
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2) ;Change smoothing mode for text
    If $GaugeWidth >= $GaugeHeight Then
        Local $Layout = _GDIPlus_RectFCreate($CentrePointX - ($FontSize * $ScalingFactor / 2), $CentrePointY - ($GaugeHeight / 2 * $ScalingFactor) - $FontSize * 1.5 * $ScalingFactor) ;Set text position for inner text
    Else
        Local $Layout = _GDIPlus_RectFCreate($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor - $FontSize * 2, ($CentrePointY - $FontSize * $ScalingFactor / 2)) ;Set text positionfor inner text
    EndIf
    _GDIPlus_PathAddString($Path, $Variable, $Layout, $Family, 0, $FontSize * $ScalingFactor)

    _GDIPlus_GraphicsFillPath($backbuffer, $Path, $TextBrush)

    $Layout = 0
    _GDIPlus_PathDispose($Path)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_LinearGaugeText

;Draw the outline of the gauge
Func _DrawBar(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $VariableMaxValue, $VariableMinValue, ByRef $hPen, $ScalingFactor = 1)
    Local $Path = _GDIPlus_PathCreate()

    _GDIPlus_PathAddLine($Path, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX + ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor)
    _GDIPlus_PathAddLine($Path, $CentrePointX + ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor)
    _GDIPlus_PathCloseFigure($Path)
    If $GaugeWidth >= $GaugeHeight Then
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $hPen)
    Else
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), $CentrePointX + ($GaugeWidth / 2 * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), $hPen)
    EndIf
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $hPen) ;Draw the outline

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawBar

;Draw the checkmarks
Func _DrawLinearGaugeCheckMarks(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, ByRef $hPen)
    Local $TextBrush = _GDIPlus_BrushCreateSolid("0xFFFFFFFF") ;Solid white brush for the checkmarks
    Local $aPoints[$NoOfCheckmarks][2] ;Two cartesian coordinates for each checkmark
    Local $aMarkText[$NoOfCheckmarks] ; The text for each checkmark
    ;Create the font for the checkmarks
    Local $FontSize = 15 * $ScalingFactor ;The font size (Scaled)
    Local $Format = _GDIPlus_StringFormatCreate()
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB")
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize, 2)
    For $i = 0 to($NoOfCheckmarks - 1)
        $aMarkText[$i] = Round($VariableMinValue + (($VariableMaxValue - $VariableMinValue) / ($NoOfCheckmarks - 1)) * $i)
    Next

    If $GaugeWidth >= $GaugeHeight Then
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2 + 10) * $ScalingFactor, $CentrePointX + ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2 + 10) * $ScalingFactor, $hPen)
        For $i = 0 to($NoOfCheckmarks - 1) ;Set the coordinates of each checkmark
            $aPoints[$i][0] = ($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor) + ($GaugeWidth * $ScalingFactor / ($NoOfCheckmarks - 1)) * $i ;Set x position depending on the number of checkmarks and the length of the gauge
            $aPoints[$i][1] = $CentrePointY - ($GaugeHeight / 2 + 10) * $ScalingFactor ;Height remains uniform
        Next
        For $i = 0 to($NoOfCheckmarks - 1)
            _GDIPlus_GraphicsDrawLine($backbuffer, $aPoints[$i][0], $aPoints[$i][1], $aPoints[$i][0], ($aPoints[$i][1] - $CheckLength * $ScalingFactor), $hPen) ;Draw a line $Checklength long
            $Layout = _GDIPlus_RectFCreate(($aPoints[$i][0] - $FontSize), ($aPoints[$i][1] - $CheckLength * $ScalingFactor - ($FontSize * 1.5) * $ScalingFactor), 0, 0)
            _GDIPlus_GraphicsDrawStringEx($backbuffer, $aMarkText[$i], $Font, $Layout, $Format, $TextBrush) ;Draw the sext for the checkmark
        Next
    Else
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - 10 * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - 10 * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor, $hPen)
        For $i = 0 to($NoOfCheckmarks - 1)
            $aPoints[$i][0] = $CentrePointX - ($GaugeWidth / 2 + 10) * $ScalingFactor
            $aPoints[$i][1] = ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor) - ($GaugeHeight * $ScalingFactor / ($NoOfCheckmarks - 1)) * $i
        Next
        For $i = 0 to($NoOfCheckmarks - 1)
            _GDIPlus_GraphicsDrawLine($backbuffer, $aPoints[$i][0], $aPoints[$i][1], $aPoints[$i][0] - $CheckLength * $ScalingFactor, $aPoints[$i][1], $hPen)
            $Layout = _GDIPlus_RectFCreate(($aPoints[$i][0] - $CheckLength * $ScalingFactor - $FontSize * 2.5), $aPoints[$i][1] - $FontSize / 1.5, 0, 0)
            _GDIPlus_GraphicsDrawStringEx($backbuffer, $aMarkText[$i], $Font, $Layout, $Format, $TextBrush)
        Next
    EndIf

    $Layout = 0
    _GDIPlus_BrushDispose($TextBrush)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_DrawLinearGaugeCheckMarks

Func _DrawLinearAllowedSpeed(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $MaxValue, $AllowedLimit, ByRef $AllowedPen, $ScalingFactor, $PrimaryAllowedSpeed)
    Local $Path = _GDIPlus_PathCreate()

    If $PrimaryAllowedSpeed Then
        If $GaugeWidth >= $GaugeHeight Then
            _GDIPlus_PathAddLine($Path, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2 + 15) * $ScalingFactor + 3 * $ScalingFactor, ($CentrePointX - (($GaugeWidth / 2) * $ScalingFactor)) + ($GaugeWidth * $AllowedLimit / 100 * $ScalingFactor), $CentrePointY - ($GaugeHeight / 2 + 15) * $ScalingFactor + 3 * $ScalingFactor)
        Else
            _GDIPlus_PathAddLine($Path, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor - 10 * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor - 10 * $ScalingFactor, ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor) - ($GaugeHeight * $AllowedLimit / 100 * $ScalingFactor))
        EndIf
    EndIf

    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $AllowedPen)

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawLinearAllowedSpeed
#EndRegion Draw Linear Gauge

#Region Draw Radial Gauge
; #FUNCTION# ====================================================================================================================
; Name...........: _Gauges_DrawRadialGauge
; Description ...: Creates a radial gauge in the graphics backbuffer
; Syntax.........: _Gauges_DrawRadialGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, $ScalingFactor = 1, $Clockwise = True, $StartAngle = 0,
;                   + $SweepAngle = 180, $NoOfCheckmarks = 6, $CheckLength = 20, $VariableMaxValue = 256, $VariableLimit = True, $AllowedLimit = 0, $VariableMinValue = 0)
; Parameters ....:  $backbuffer             - [byref] The graphics object to draw the gauge to.
;                           $CentrePointX           - The horizontal coordinate of the centre of the gauge.
;                           $CentrePointY           - The vertical coordinate of the centre of the gauge.
;                           $Radius                     - The radius of the outer edge of the gauge.
;                           $Thickness              - The thickness of the gauge in pixels.
;                           $Variable               - The variable used to change the gauge.
;                           $ScalingFactor          - [optional] Scales the gauge by this factor. Default is 1, i.e. no scaling.
;                           $Clockwise              - [optional] Boolean, determines whether the gauge fills clockwise or anti-clockwise. Default is TRUE, i.e. clockwise.
;                           $StartAngle             - [optional] The starting angle of the gauge. Default is 0 (East).
;                           $SweepAngle         - [optional] The sweep angle of the gauge (How many degrees it rotates through). The default is 180.
;                           $NoOfCheckmarks - [optional] The number of dashes indicating a scale around the gauge. Default is 6.
;                           $CheckLength            - [optional] The length of the checkmarks in pixels. Default is 20.
;                           $VariableMaxValue   - [optional] The maximum value of the variable. Default is 256.
;                           $VariableLimit          - [optional] Boolean, if TRUE, displays a red limit indicator on the scale. Default is FALSE.
;                           $AllowedLimit           -[optional] The value of the above limit if it is drawn. Default is 0.
;                           $VariableMinValue   -[optional] The minimum value of the variable. Only used if negative numbers are required. Default is 0.
; Author ........: Simon Renardson (Sidley)
; Modified.......:
; Remarks .......:  There is a more comprehensive function available, but I deemed it overkill for the majority of people.
; Related .......:  _GDIPlus_
; Example .......: Yes
; ===============================================================================================================================
;Draw Gauge (Speed/Load Level)
;Creates Completed Radial Gauge
;~ _DrawRadialGauge($CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, [$ScalingFactor = 1, [$Clockwise = True, [$StartAngle = 0, [$SweepAngle = 180, [$MaxValue = 256, [$NoOfCheckmarks = 10, [$CheckLength = 20]]]]]]])
Func _Gauges_DrawRadialGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, $ScalingFactor = 1, $Clockwise = True, $StartAngle = 0, $SweepAngle = 180, $NoOfCheckmarks = 6, $CheckLength = 20, $VariableMaxValue = 256, $VariableLimit = True, $AllowedLimit = 0, $VariableMinValue = 0)
Local $BrushColour = ("0x" & HEX(BitOR(0xFFFF0000, BitShift((255 - (($Variable / $VariableMaxValue) * 255)), -8))))
    Local $GaugeBrush = _GDIPlus_HatchBrushCreate(39, 0xFF000000, $BrushColour)
    Local $TextBrush = _GDIPlus_BrushCreateSolid($BrushColour)
    Local $Path = _GDIPlus_PathCreate()
    Local $hPen = _GDIPlus_PenCreate("0xFF96A29F", 2 * $ScalingFactor) ;Pen colour
    Local $AllowedPen = _GDIPlus_PenCreate("0xFFFF0000", 10 * $ScalingFactor)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2) ;TODO may need to be removed

    If $Clockwise Then ;If clockwise rotation
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)), $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)) ;Add outer arc of gauge
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arc by the thickness of the gauge
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)) + ($Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)), (-1 * $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue))) ;Add inner arc of Gauge
    Else ;If anti-clockwise rotation
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)), (-1 * $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue))) ;Add outer arc of gauge
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arcby the thickness of the gauge
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)) - ($Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)), $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)) ;Add inner arc of Gauge
    EndIf
    $Radius += ($Thickness * $ScalingFactor) ;Return radius to original size
    _GDIPlus_PathCloseFigure($Path) ;Close the two arcs
    _GDIPlus_GraphicsFillPath($backbuffer, $Path, $GaugeBrush) ;Fill the gauge and centre text with colour
    _DrawRadialGaugeText($backbuffer, $Variable, $CentrePointX, $CentrePointY, $Clockwise, $Radius, $ScalingFactor, $TextBrush) ;Draw the centre text
    _DrawGaugeOutline($backbuffer, $CentrePointX, $CentrePointY, $Radius, $VariableMaxValue, $VariableMinValue, $Thickness, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle, $hPen) ;Draw the gauge outline
    _DrawIndicators($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, $hPen, True) ;Draw scale arc
    _DrawCheckMarks($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, $StartAngle, $SweepAngle, $hPen, True) ;Draw scale checkmarks
    If $VariableLimit Then
        _DrawRadialAllowedSpeed($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, $AllowedLimit, $AllowedPen, True) ;Draw allowed speed limits
    EndIf

    _GDIPlus_PathDispose($Path) ;Tidy up
    _GDIPlus_BrushDispose($GaugeBrush)
    _GDIPlus_BrushDispose($TextBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PenDispose($AllowedPen)
EndFunc   ;==>_DrawRadialGauge

;Draw Variable Value (Text, Load/Speed Value)
;Creates The Centre Text of the Radial Gauge
;~ Func _DrawRadialGaugeText($ValueText, $CentrePointX, $CentrePointY, $Clockwise, $Radius, $ScalingFactor)
Func _DrawRadialGaugeText(ByRef $backbuffer, $ValueText, $CentrePointX, $CentrePointY, $Clockwise, $Radius, $ScalingFactor, ByRef $TextBrush)
    Local $FontSize = 180 * $ScalingFactor ;Default font size (Scaled)
    Local $Text = _GDIPlus_PathCreate()
    Local $Format = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($Format, 2) ;Align right (Doesn't seem to make a difference)
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB") ;Centre text font
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize, 2)
    Local $Layout = _GDIPlus_RectFCreate($CentrePointX - ($FontSize / 1.3) * $ScalingFactor, $CentrePointY - $FontSize * $ScalingFactor / 2) ;Set position (Top left)
    _GDIPlus_PathAddString($Text, Round($ValueText, 1), $Layout, $Family, 0, $FontSize * $ScalingFactor) ;Add value to path (To 1 decimal place)
    _GDIPlus_GraphicsFillPath($backbuffer, $Text, $TextBrush)

    $Layout = 0 ;Tidy up
    _GDIPlus_PathDispose($Text)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_DrawRadialGaugeText

;Draw Gauge Outline
;Creates the Outline of the Radial Gauge
;~ Func _DrawGaugeOutline($CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle)
Func _DrawGaugeOutline(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $VariableMaxValue, $VariableMinValue, $Thickness, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle, ByRef $hPen)
    Local $Path = _GDIPlus_PathCreate()
    Local Const $PI = 3.141592653589793


    $Radius += 2 ;Put the outline 2 px outside the gauge
    If $Clockwise Then ;If the gauge is to be filled clockwise
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, $SweepAngle)
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX + ($Radius * $ScalingFactor * Cos(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointY + ($Radius * $ScalingFactor * Sin(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointX + (($Radius - ($Thickness * $ScalingFactor) - (4 * $ScalingFactor)) * Cos(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)))) * $ScalingFactor), $CentrePointY + (($Radius - ($Thickness * $ScalingFactor) - 4) * $ScalingFactor * Sin(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $hPen)
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arc
        $Radius -= 4
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), ($StartAngle + $SweepAngle), -$SweepAngle)
    Else
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, -$SweepAngle)
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX + ($Radius * $ScalingFactor * Cos(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointY + ($Radius * $ScalingFactor * Sin(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointX + (($Radius - ($Thickness * $ScalingFactor) - (4 * $ScalingFactor)) * Cos(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)))) * $ScalingFactor), $CentrePointY + (($Radius - ($Thickness * $ScalingFactor) - 4) * $ScalingFactor * Sin(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $hPen)
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arc
        $Radius -= 4
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle - $SweepAngle, $SweepAngle)
    EndIf
    _GDIPlus_PathCloseFigure($Path) ;Close the path
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $hPen) ;Draw the path
    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawGaugeOutline

;Draw Scale(s)
;Creates a number of indicative markings around the centre of the radial gauge
;~ Func _DrawIndicators($CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle)
Func _DrawIndicators(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, ByRef $hPen, $Inside)
    Local $Path = _GDIPlus_PathCreate()
    $Radius -= ($Thickness + 20) * $ScalingFactor
    If $Clockwise Then
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, $SweepAngle)
    Else ;Doesn't make much difference, but it will be 180 degrees out
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, -$SweepAngle)
    EndIf
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $hPen)

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawIndicators

;Draw the allowed speed marker
Func _DrawRadialAllowedSpeed(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, _
        $AllowedLimit, ByRef $AllowedPen, $Inside)
    Local $Path = _GDIPlus_PathCreate()
    $Radius -= ($Thickness + 24) * $ScalingFactor
    If $Clockwise Then ;Display in a clockwise direction
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, $SweepAngle * $AllowedLimit / 100)
    ElseIf NOT $Clockwise Then ;Display in an anti-clockwise direction
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, -$SweepAngle * $AllowedLimit / 100)
    EndIf
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $AllowedPen) ;Draw with the red pen ($AllowedPen)

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawRadialAllowedSpeed

;DrawCheckmarks (Checkmarks)
;Creates the checkmarks and text around the indicator gauge
;~ Func _DrawCheckMarks($CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $MaxValue, $NoOfCheckmarks, $CheckLength, $StartAngle, $SweepAngle, $hPen)
Func _DrawCheckMarks(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, $StartAngle, _
        $SweepAngle, ByRef $hPen, $Inside)
    Local Const $PI = 3.141592653589793
    Local $TextBrush = _GDIPlus_BrushCreateSolid("0xFFFFFFFF")
    Local $aPoints[$NoOfCheckmarks][4] ;Creates an array of four points for each check line
    Local $aMarkText[$NoOfCheckmarks] ;Creates the text for the checkmarks

    $Radius -= ($Thickness + 20) * $ScalingFactor
    For $i = 0 to ($NoOfCheckmarks-1)
        $aMarkText[$i] = Round((($VariableMaxValue - $VariableMinValue) / ($NoOfCheckmarks - 1)) * $i) + $VariableMinValue ;Round checkmark values to one decimal place
    Next

    Local $aAngles[$NoOfCheckmarks] = [] ;Create an array to hold the angles at which the checkmarks should be
    If $Clockwise Then
        For $i = 0 to($NoOfCheckmarks - 1)
            $aAngles[$i] = $StartAngle + (($SweepAngle / ($NoOfCheckmarks - 1)) * $i) ;Spread out checkmarks evenly over the gauge
        Next
    Else ;For anticlockwise filling gauge
        For $i = 0 to($NoOfCheckmarks - 1)
            $aAngles[$i] = $StartAngle - (($SweepAngle / ($NoOfCheckmarks - 1)) * $i) ;Spread out checkmarks evenly over the gauge
        Next
    EndIf

    For $i = 0 to($NoOfCheckmarks - 1)
        $aAngles[$i] = $aAngles[$i] * $PI / 180 ;Convert degrees to radians
        $aPoints[$i][0] = $CentrePointX + ($Radius * Cos($aAngles[$i]) * $ScalingFactor) ;Create cartesian coordinates for the check lines from polar coordinates (Radius, angle)
        $aPoints[$i][1] = $CentrePointY + ($Radius * Sin($aAngles[$i]) * $ScalingFactor)
        $aPoints[$i][2] = $CentrePointX + (($Radius - ($CheckLength * $ScalingFactor)) * Cos($aAngles[$i]) * $ScalingFactor)
        $aPoints[$i][3] = $CentrePointY + (($Radius - ($CheckLength * $ScalingFactor)) * Sin($aAngles[$i]) * $ScalingFactor)
    Next
    ;Font data for checkmark text
    Local $Format = _GDIPlus_StringFormatCreate()
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB")
    Local $FontSize = 15
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize * $ScalingFactor, 2)
    For $i = 0 to($NoOfCheckmarks - 1) ;For each checkmark
        _GDIPlus_GraphicsDrawLine($backbuffer, $aPoints[$i][0], $aPoints[$i][1], $aPoints[$i][2], $aPoints[$i][3], $hPen) ;Draw the lines
        $Layout = _GDIPlus_RectFCreate($aPoints[$i][2] - ($FontSize * Cos($aAngles[$i])) - (18 * $ScalingFactor), $aPoints[$i][3] - ($FontSize * Sin($aAngles[$i]) + 10), 0, 0)
        _GDIPlus_GraphicsDrawStringEx($backbuffer, $aMarkText[$i], $Font, $Layout, $Format, $TextBrush)
    Next

    $Layout = 0
    _GDIPlus_BrushDispose($TextBrush)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_DrawCheckMarks
#EndRegion Draw Radial Gauge

#EndRegion Functions

 

Share this post


Link to post
Share on other sites

The code above has an error in the parameter order. Sorry about that, this should make it look less like an acid trip 😀

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=Gauges With Sliders.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <GDIplus.au3>
#include <ColorConstants.au3>
#include <Array.au3>

Global Const $width = @DesktopWidth * 3 / 4
Global Const $height = @DesktopHeight
Global $title = "GDI+"

; Build your GUI here
Opt("GUIOnEventMode", 1)
Global $hwnd = GUICreate($title, @DesktopWidth, @DesktopHeight, -1, -1, $WS_SIZEBOX)
GUISetOnEvent($GUI_EVENT_CLOSE, "close")
GUISetState()


#Region Sliders

Global $VariableMaxValue = 100
Global $SecondaryMaxValue = 100
Global $VariableMinValue = 0
Global $HexLabel = GUICtrlCreateLabel("Hex Value: ", @DesktopWidth - 300, 50, 150, 20)
GUICtrlSetColor($HexLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSliderThick = GUICtrlCreateSlider(@DesktopWidth - 300, 100, 250, 20)
GUICtrlSetLimit(-1, 240, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $ThickLabel = GUICtrlCreateLabel("Thickness Value: " & GUICtrlRead($idSliderThick), @DesktopWidth - 300, 120, 150, 20)
GUICtrlSetColor($ThickLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSliderVal = GUICtrlCreateSlider(@DesktopWidth - 300, 150, 250, 20)
GUICtrlSetLimit(-1, $VariableMaxValue, $VariableMinValue) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $ValLabel = GUICtrlCreateLabel("Variable Value: " & GUICtrlRead($idSliderVal), @DesktopWidth - 300, 170, 150, 20)
GUICtrlSetColor($ValLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSliderScale = GUICtrlCreateSlider(@DesktopWidth - 300, 200, 250, 20)
GUICtrlSetLimit(-1, 20, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $ScaleLabel = GUICtrlCreateLabel("Scale Value: " & (GUICtrlRead($idSliderScale) * .1), @DesktopWidth - 300, 220, 150, 20)
GUICtrlSetColor($ScaleLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idStartAngleScale = GUICtrlCreateSlider(@DesktopWidth - 300, 250, 250, 20)
GUICtrlSetLimit(-1, 360, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $StartAngleLabel = GUICtrlCreateLabel("Angle Value: " & GUICtrlRead($idStartAngleScale), @DesktopWidth - 300, 270, 150, 20)
GUICtrlSetColor($StartAngleLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idSweepScale = GUICtrlCreateSlider(@DesktopWidth - 300, 300, 250, 20)
GUICtrlSetLimit(-1, 360, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $SweepLabel = GUICtrlCreateLabel("Sweep Value: " & GUICtrlRead($idSweepScale), @DesktopWidth - 300, 320, 150, 20)
GUICtrlSetColor($SweepLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idCheckmarksScale = GUICtrlCreateSlider(@DesktopWidth - 300, 350, 250, 20)
GUICtrlSetLimit(-1, 20, 0) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $CheckmarkLabel = GUICtrlCreateLabel("No. of Checkmarks: " & GUICtrlRead($idCheckmarksScale), @DesktopWidth - 300, 370, 150, 20)
GUICtrlSetColor($CheckmarkLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $idVarMin = GUICtrlCreateSlider(@DesktopWidth - 300, 450, 250, 20)
GUICtrlSetLimit(-1, 0, -50) ; change min/max value
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $MinLabel = GUICtrlCreateLabel("Min Value: " & GUICtrlRead($idVarMin), @DesktopWidth - 300, 470, 150, 20)
GUICtrlSetColor($MinLabel, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $RadioGroup1 = GUICtrlCreateGroup("", @DesktopWidth - 300, 500, 200, 50)
Global $clockwiseCtrl = GUICtrlCreateRadio("Clockwise", @DesktopWidth - 280, 520, 80, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $antiClockwiseCtrl = GUICtrlCreateRadio("Anti-clockwise", @DesktopWidth - 200, 520, 85, 20)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $RadioGroup2 = GUICtrlCreateGroup("", @DesktopWidth - 300, 550, 200, 50)
Global $RadialCtrl = GUICtrlCreateRadio("Radial", @DesktopWidth - 280, 570, 80, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
Global $SquareCtrl = GUICtrlCreateRadio("Linear", @DesktopWidth - 200, 570, 85, 20)
GUICtrlSetColor(-1, $COLOR_WHITE)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKVCENTER)
GUICtrlSetData($idSliderThick, 35)
GUICtrlSetData($idSliderScale, 10)
GUICtrlSetData($idStartAngleScale, 180)
GUICtrlSetData($idSweepScale, 180)
GUICtrlSetData($idCheckmarksScale, 10)
#EndRegion Sliders

GUISetBkColor(0x303030)
Global $aWindowSize = WinGetClientSize($hwnd)


; Load your GDI+ resources here:
_GDIPlus_Startup()
Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)


While 1
    _GDIPlus_GraphicsClear($backbuffer, 0xFF303030)
    Sleep(50)

    #Region Test Variables
    Global $Thickness = GUICtrlRead($idSliderThick)
    Global $Variable = GUICtrlRead($idSliderVal)
    Global $tValue = 0xFF000000
    Global $rValue = 0x00FF0000
    Global $gValue = BitShift((255 - (($Variable / $VariableMaxValue) * 255)), -8)
    Global $bValue = 0x00
    Global $ScalingFactor = GUICtrlRead($idSliderScale) / 10
    GUICtrlSetData($HexLabel, "Hex Value: " & HEX(BitOR($tValue, $rValue, $gValue, $bValue)))
    Global $PenColour = ("0x" & HEX(BitOR($tValue, $rValue, $gValue, $bValue)))
    GUICtrlSetData($ValLabel, "Variable Value: " & GUICtrlRead($idSliderVal))
    GUICtrlSetData($ThickLabel, "Thickness Value: " & GUICtrlRead($idSliderThick))
    GUICtrlSetData($ScaleLabel, "Scale Value: " & (GUICtrlRead($idSliderScale) * .1))
    GUICtrlSetData($StartAngleLabel, "Angle Value: " & GUICtrlRead($idStartAngleScale))
    GUICtrlSetData($SweepLabel, "Sweep Value: " & GUICtrlRead($idSweepScale))
    GUICtrlSetData($CheckmarkLabel, "No. Of Checkmarks: " & GUICtrlRead($idCheckmarksScale))
    GUICtrlSetData($MinLabel, "Min Value: " & GUICtrlRead($idVarMin))
    GUICtrlSetLimit($idSliderVal, $VariableMaxValue, $VariableMinValue)
    Local $Radius = 300
    If GUICtrlRead($clockwiseCtrl) = $GUI_CHECKED Then
        Local $Clockwise = True
    Else
        Local $Clockwise = False
    EndIf
    Local $StartAngle = GUICtrlRead($idStartAngleScale)
    Local $SweepAngle = GUICtrlRead($idSweepScale)
    Local $CentrePointX = 500
    Local $CentrePointY = 500
    Local $NoOfCheckmarks = GUICtrlRead($idCheckmarksScale)
    Local $CheckLength = 15
    Local $AllowedLimit = 75
    Local $VariableLimit = True
    Local $VariableMinValue = GUICtrlRead($idVarMin)
    #EndRegion Test Variables

    #Region Function Call
    If GUICtrlRead($RadialCtrl) = $GUI_CHECKED Then
        _GDIPlus_GraphicsDrawPath($backbuffer, _Gauges_DrawRadialGauge($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle, $NoOfCheckmarks, $CheckLength, $VariableMaxValue, $VariableLimit, $AllowedLimit, $VariableMinValue))
        GUICtrlSetState($idSliderThick, $GUI_SHOW)
        GUICtrlSetState($ThickLabel, $GUI_SHOW)
        GUICtrlSetState($idStartAngleScale, $GUI_SHOW)
        GUICtrlSetState($StartAngleLabel, $GUI_SHOW)
        GUICtrlSetState($idSweepScale, $GUI_SHOW)
        GUICtrlSetState($SweepLabel, $GUI_SHOW)
        GUICtrlSetState($RadioGroup1, $GUI_SHOW)
        GUICtrlSetState($clockwiseCtrl, $GUI_SHOW)
        GUICtrlSetState($antiClockwiseCtrl, $GUI_SHOW)
    Else
        _GDIPlus_GraphicsDrawPath($backbuffer, _Gauges_DrawLinearGauge($backbuffer, $CentrePointX, $CentrePointY, 600, 100, $Variable, $ScalingFactor, $NoOfCheckmarks, $CheckLength, $VariableMaxValue, $VariableLimit, $AllowedLimit, $VariableMinValue))
        GUICtrlSetState($idSliderThick, $GUI_HIDE)
        GUICtrlSetState($ThickLabel, $GUI_HIDE)
        GUICtrlSetState($idStartAngleScale, $GUI_HIDE)
        GUICtrlSetState($StartAngleLabel, $GUI_HIDE)
        GUICtrlSetState($idSweepScale, $GUI_HIDE)
        GUICtrlSetState($SweepLabel, $GUI_HIDE)
        GUICtrlSetState($RadioGroup1, $GUI_HIDE)
        GUICtrlSetState($clockwiseCtrl, $GUI_HIDE)
        GUICtrlSetState($antiClockwiseCtrl, $GUI_HIDE)
    EndIf
    #EndRegion Function Call

    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
WEnd

Func close()
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_Shutdown()
    Exit
EndFunc   ;==>close


#Region Functions

#Region Draw Linear Gauge
; #FUNCTION# ====================================================================================================================
; Name...........: _Gauges_DrawLinearGauge
; Description ...: Creates a horizontal or vertical gauge in the graphics backbuffer
; Syntax.........: _Gauges_DrawLinearGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $Variable, [$ScalingFactor = 1, [$NoOfCheckmarks = 6, [$CheckLength = 20,
;                   + [$VariableMaxValue = 256, [$VariableLimit = False, [$AllowedLimit = 0,  [$VariableMinValue = 0]]]]]]] )
; Parameters ....:  $backbuffer             - [byref] The graphics object to draw the gauge to.
;                           $CentrePointX           - The horizontal coordinate of the centre of the gauge.
;                           $CentrePointY           - The vertical coordinate of the centre of the gauge.
;                           $GaugeWidth             - The width of the gauge (Duh).
;                           $GaugeHeight        - The height of the gauge.
;                           $Variable               - The variable used to change the gauge.
;                           $ScalingFactor          - [optional] Scales the gauge by this factor. Default is 1, i.e. no scaling.
;                           $NoOfCheckmarks - [optional] The number of dashes indicating a scale around the gauge. Default is 6.
;                           $CheckLength            - [optional] The length of the checkmarks in pixels. Default is 20.
;                           $VariableMaxValue   - [optional] The maximum value of the variable. Default is 256.
;                           $VariableLimit          - [optional] Boolean, if TRUE, displays a red limit indicator on the scale. Default is FALSE.
;                           $AllowedLimit           -[optional] The value of the above limit if it is drawn. Default is 0.
;                           $VariableMinValue   -[optional] The minimum value of the variable. Only used if negative numbers are required. Default is 0.
; Author ........: Simon Renardson (Sidley)
; Modified.......:
; Remarks .......:  There is a more comprehensive function available, but I deemed it overkill for the majority of people.
; Related .......:  _GDIPlus_
; Example .......: Yes
; ===============================================================================================================================
;Draw a Linear gauge to the screen
Func _Gauges_DrawLinearGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $Variable, $ScalingFactor = 1, $NoOfCheckmarks = 6, $CheckLength = 20, $VariableMaxValue = 256, $VariableLimit = False, $AllowedLimit = 0,  $VariableMinValue = 0)
If $Variable >= 0 Then
        Local $BrushColour = ("0xFF4BF221")
    Else
        Local $BrushColour = ("0xFFFF0000")
    EndIf
    If $GaugeWidth >= $GaugeHeight Then
        Local $GaugeBrush = _GDIPlus_HatchBrushCreate(1, 0x00000000, $BrushColour) ;Set to vertical hatch if the gauge is horizontal
    Else
        Local $GaugeBrush = _GDIPlus_HatchBrushCreate(0, 0x00000000, $BrushColour) ;Set to horizontal hatch if the gauge is vertical
    EndIf
    Local $TextBrush = _GDIPlus_BrushCreateSolid($BrushColour)
    Local $Path = _GDIPlus_PathCreate()
    Local $hPen = _GDIPlus_PenCreate("0xFF96A29F", 2 * $ScalingFactor) ; Off-white pen for outlines
    Local $AllowedPen = _GDIPlus_PenCreate("0xFFFF0000", 8 * $ScalingFactor) ;Red pen for allowed speed indicators

    If $GaugeWidth >= $GaugeHeight Then ;If the gauge is to be length wise
        _GDIPlus_PathAddLine($Path, $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor), ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor), $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor) + ($Variable * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor))
        _GDIPlus_PathAddLine($Path, $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor) + ($Variable * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), ($CentrePointY - ($GaugeHeight / 2) * $ScalingFactor), $CentrePointX - ((($GaugeWidth / 2) + $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue))) * $ScalingFactor), ($CentrePointY - ($GaugeHeight / 2) * $ScalingFactor))
        _GDIPlus_PathCloseFigure($Path)
    Else ;If the gauge is to be height wise
        _GDIPlus_PathAddLine($Path, ($CentrePointX + ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), ($CentrePointX + ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor) - $Variable * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor)
        _GDIPlus_PathAddLine($Path, ($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor) - $Variable * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor, ($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor))
        _GDIPlus_PathCloseFigure($Path)
    EndIf
    _GDIPlus_GraphicsFillPath($backbuffer, $Path, $GaugeBrush) ;Draw the gauge

    _DrawBar($backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $VariableMaxValue, $VariableMinValue, $hPen, $ScalingFactor) ;Draw the outline for the gauge
    _DrawLinearGaugeCheckMarks($backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, $hPen) ;Draw the checkmarks for the gauge
    If $VariableLimit Then
        _DrawLinearAllowedSpeed($backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $VariableMaxValue, $AllowedLimit, $AllowedPen, $ScalingFactor, $VariableLimit) ;Draw the allowed speed indicator(s) for the gauge
    EndIf
    _LinearGaugeText($backbuffer, $Variable, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, $TextBrush) ;Put the gauge text above the gauge

    _GDIPlus_PathDispose($Path) ;Tidy up
    _GDIPlus_BrushDispose($GaugeBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PenDispose($AllowedPen)
    _GDIPlus_BrushDispose($TextBrush)
EndFunc   ;==>_DrawLinearGauge

;Draw the text for the main gauge
Func _LinearGaugeText(ByRef $backbuffer, $Variable, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, ByRef $TextBrush)
    Local $FontSize = 80 * $ScalingFactor ;Linear gauge font size
    Local $Path = _GDIPlus_PathCreate()
    Local $Format = _GDIPlus_StringFormatCreate()
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB") ;Centre text font
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize, 2)
    _GDIPlus_StringFormatSetAlign($Format, 2) ;Right align
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2) ;Change smoothing mode for text
    If $GaugeWidth >= $GaugeHeight Then
        Local $Layout = _GDIPlus_RectFCreate($CentrePointX - ($FontSize * $ScalingFactor / 2), $CentrePointY - ($GaugeHeight / 2 * $ScalingFactor) - $FontSize * 1.5 * $ScalingFactor) ;Set text position for inner text
    Else
        Local $Layout = _GDIPlus_RectFCreate($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor - $FontSize * 2, ($CentrePointY - $FontSize * $ScalingFactor / 2)) ;Set text positionfor inner text
    EndIf
    _GDIPlus_PathAddString($Path, $Variable, $Layout, $Family, 0, $FontSize * $ScalingFactor)

    _GDIPlus_GraphicsFillPath($backbuffer, $Path, $TextBrush)

    $Layout = 0
    _GDIPlus_PathDispose($Path)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_LinearGaugeText

;Draw the outline of the gauge
Func _DrawBar(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $VariableMaxValue, $VariableMinValue, ByRef $hPen, $ScalingFactor = 1)
    Local $Path = _GDIPlus_PathCreate()

    _GDIPlus_PathAddLine($Path, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX + ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor)
    _GDIPlus_PathAddLine($Path, $CentrePointX + ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor)
    _GDIPlus_PathCloseFigure($Path)
    If $GaugeWidth >= $GaugeHeight Then
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - $VariableMinValue * ($GaugeWidth / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $hPen)
    Else
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), $CentrePointX + ($GaugeWidth / 2 * $ScalingFactor), ($CentrePointY + (($GaugeHeight / 2) * $ScalingFactor)) + ($VariableMinValue * ($GaugeHeight / ($VariableMaxValue - $VariableMinValue)) * $ScalingFactor), $hPen)
    EndIf
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $hPen) ;Draw the outline

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawBar

;Draw the checkmarks
Func _DrawLinearGaugeCheckMarks(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, ByRef $hPen)
    Local $TextBrush = _GDIPlus_BrushCreateSolid("0xFFFFFFFF") ;Solid white brush for the checkmarks
    Local $aPoints[$NoOfCheckmarks][2] ;Two cartesian coordinates for each checkmark
    Local $aMarkText[$NoOfCheckmarks] ; The text for each checkmark
    ;Create the font for the checkmarks
    Local $FontSize = 15 * $ScalingFactor ;The font size (Scaled)
    Local $Format = _GDIPlus_StringFormatCreate()
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB")
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize, 2)
    For $i = 0 to($NoOfCheckmarks - 1)
        $aMarkText[$i] = Round($VariableMinValue + (($VariableMaxValue - $VariableMinValue) / ($NoOfCheckmarks - 1)) * $i)
    Next

    If $GaugeWidth >= $GaugeHeight Then
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2 + 10) * $ScalingFactor, $CentrePointX + ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2 + 10) * $ScalingFactor, $hPen)
        For $i = 0 to($NoOfCheckmarks - 1) ;Set the coordinates of each checkmark
            $aPoints[$i][0] = ($CentrePointX - ($GaugeWidth / 2) * $ScalingFactor) + ($GaugeWidth * $ScalingFactor / ($NoOfCheckmarks - 1)) * $i ;Set x position depending on the number of checkmarks and the length of the gauge
            $aPoints[$i][1] = $CentrePointY - ($GaugeHeight / 2 + 10) * $ScalingFactor ;Height remains uniform
        Next
        For $i = 0 to($NoOfCheckmarks - 1)
            _GDIPlus_GraphicsDrawLine($backbuffer, $aPoints[$i][0], $aPoints[$i][1], $aPoints[$i][0], ($aPoints[$i][1] - $CheckLength * $ScalingFactor), $hPen) ;Draw a line $Checklength long
            $Layout = _GDIPlus_RectFCreate(($aPoints[$i][0] - $FontSize), ($aPoints[$i][1] - $CheckLength * $ScalingFactor - ($FontSize * 1.5) * $ScalingFactor), 0, 0)
            _GDIPlus_GraphicsDrawStringEx($backbuffer, $aMarkText[$i], $Font, $Layout, $Format, $TextBrush) ;Draw the sext for the checkmark
        Next
    Else
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - 10 * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2 * $ScalingFactor) - 10 * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2) * $ScalingFactor, $hPen)
        For $i = 0 to($NoOfCheckmarks - 1)
            $aPoints[$i][0] = $CentrePointX - ($GaugeWidth / 2 + 10) * $ScalingFactor
            $aPoints[$i][1] = ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor) - ($GaugeHeight * $ScalingFactor / ($NoOfCheckmarks - 1)) * $i
        Next
        For $i = 0 to($NoOfCheckmarks - 1)
            _GDIPlus_GraphicsDrawLine($backbuffer, $aPoints[$i][0], $aPoints[$i][1], $aPoints[$i][0] - $CheckLength * $ScalingFactor, $aPoints[$i][1], $hPen)
            $Layout = _GDIPlus_RectFCreate(($aPoints[$i][0] - $CheckLength * $ScalingFactor - $FontSize * 2.5), $aPoints[$i][1] - $FontSize / 1.5, 0, 0)
            _GDIPlus_GraphicsDrawStringEx($backbuffer, $aMarkText[$i], $Font, $Layout, $Format, $TextBrush)
        Next
    EndIf

    $Layout = 0
    _GDIPlus_BrushDispose($TextBrush)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_DrawLinearGaugeCheckMarks

Func _DrawLinearAllowedSpeed(ByRef $backbuffer, $CentrePointX, $CentrePointY, $GaugeWidth, $GaugeHeight, $MaxValue, $AllowedLimit, ByRef $AllowedPen, $ScalingFactor, $PrimaryAllowedSpeed)
    Local $Path = _GDIPlus_PathCreate()

    If $PrimaryAllowedSpeed Then
        If $GaugeWidth >= $GaugeHeight Then
            _GDIPlus_PathAddLine($Path, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor, $CentrePointY - ($GaugeHeight / 2 + 15) * $ScalingFactor + 3 * $ScalingFactor, ($CentrePointX - (($GaugeWidth / 2) * $ScalingFactor)) + ($GaugeWidth * $AllowedLimit / 100 * $ScalingFactor), $CentrePointY - ($GaugeHeight / 2 + 15) * $ScalingFactor + 3 * $ScalingFactor)
        Else
            _GDIPlus_PathAddLine($Path, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor - 10 * $ScalingFactor, $CentrePointY + ($GaugeHeight / 2) * $ScalingFactor, $CentrePointX - ($GaugeWidth / 2) * $ScalingFactor - 10 * $ScalingFactor, ($CentrePointY + ($GaugeHeight / 2) * $ScalingFactor) - ($GaugeHeight * $AllowedLimit / 100 * $ScalingFactor))
        EndIf
    EndIf

    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $AllowedPen)

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawLinearAllowedSpeed
#EndRegion Draw Linear Gauge

#Region Draw Radial Gauge
; #FUNCTION# ====================================================================================================================
; Name...........: _Gauges_DrawRadialGauge
; Description ...: Creates a radial gauge in the graphics backbuffer
; Syntax.........: _Gauges_DrawRadialGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, $ScalingFactor = 1, $Clockwise = True, $StartAngle = 0,
;                   + $SweepAngle = 180, $NoOfCheckmarks = 6, $CheckLength = 20, $VariableMaxValue = 256, $VariableLimit = True, $AllowedLimit = 0, $VariableMinValue = 0)
; Parameters ....:  $backbuffer             - [byref] The graphics object to draw the gauge to.
;                           $CentrePointX           - The horizontal coordinate of the centre of the gauge.
;                           $CentrePointY           - The vertical coordinate of the centre of the gauge.
;                           $Radius                     - The radius of the outer edge of the gauge.
;                           $Thickness              - The thickness of the gauge in pixels.
;                           $Variable               - The variable used to change the gauge.
;                           $ScalingFactor          - [optional] Scales the gauge by this factor. Default is 1, i.e. no scaling.
;                           $Clockwise              - [optional] Boolean, determines whether the gauge fills clockwise or anti-clockwise. Default is TRUE, i.e. clockwise.
;                           $StartAngle             - [optional] The starting angle of the gauge. Default is 0 (East).
;                           $SweepAngle         - [optional] The sweep angle of the gauge (How many degrees it rotates through). The default is 180.
;                           $NoOfCheckmarks - [optional] The number of dashes indicating a scale around the gauge. Default is 6.
;                           $CheckLength            - [optional] The length of the checkmarks in pixels. Default is 20.
;                           $VariableMaxValue   - [optional] The maximum value of the variable. Default is 256.
;                           $VariableLimit          - [optional] Boolean, if TRUE, displays a red limit indicator on the scale. Default is FALSE.
;                           $AllowedLimit           -[optional] The value of the above limit if it is drawn. Default is 0.
;                           $VariableMinValue   -[optional] The minimum value of the variable. Only used if negative numbers are required. Default is 0.
; Author ........: Simon Renardson (Sidley)
; Modified.......:
; Remarks .......:  There is a more comprehensive function available, but I deemed it overkill for the majority of people.
; Related .......:  _GDIPlus_
; Example .......: Yes
; ===============================================================================================================================
;Draw Gauge (Speed/Load Level)
;Creates Completed Radial Gauge
;~ _DrawRadialGauge($CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, [$ScalingFactor = 1, [$Clockwise = True, [$StartAngle = 0, [$SweepAngle = 180, [$MaxValue = 256, [$NoOfCheckmarks = 10, [$CheckLength = 20]]]]]]])
Func _Gauges_DrawRadialGauge(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Variable, $ScalingFactor = 1, $Clockwise = True, $StartAngle = 0, $SweepAngle = 180, $NoOfCheckmarks = 6, $CheckLength = 20, $VariableMaxValue = 256, $VariableLimit = True, $AllowedLimit = 0, $VariableMinValue = 0)
Local $BrushColour = ("0x" & HEX(BitOR(0xFFFF0000, BitShift((255 - (($Variable / $VariableMaxValue) * 255)), -8))))
    Local $GaugeBrush = _GDIPlus_HatchBrushCreate(39, 0xFF000000, $BrushColour)
    Local $TextBrush = _GDIPlus_BrushCreateSolid($BrushColour)
    Local $Path = _GDIPlus_PathCreate()
    Local $hPen = _GDIPlus_PenCreate("0xFF96A29F", 2 * $ScalingFactor) ;Pen colour
    Local $AllowedPen = _GDIPlus_PenCreate("0xFFFF0000", 10 * $ScalingFactor)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2) ;TODO may need to be removed

    If $Clockwise Then ;If clockwise rotation
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)), $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)) ;Add outer arc of gauge
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arc by the thickness of the gauge
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)) + ($Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)), (-1 * $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue))) ;Add inner arc of Gauge
    Else ;If anti-clockwise rotation
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)), (-1 * $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue))) ;Add outer arc of gauge
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arcby the thickness of the gauge
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)) - ($Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)), $Variable * $SweepAngle / ($VariableMaxValue - $VariableMinValue)) ;Add inner arc of Gauge
    EndIf
    $Radius += ($Thickness * $ScalingFactor) ;Return radius to original size
    _GDIPlus_PathCloseFigure($Path) ;Close the two arcs
    _GDIPlus_GraphicsFillPath($backbuffer, $Path, $GaugeBrush) ;Fill the gauge and centre text with colour
    _DrawRadialGaugeText($backbuffer, $Variable, $CentrePointX, $CentrePointY, $Clockwise, $Radius, $ScalingFactor, $TextBrush) ;Draw the centre text
    _DrawGaugeOutline($backbuffer, $CentrePointX, $CentrePointY, $Radius, $VariableMaxValue, $VariableMinValue, $Thickness, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle, $hPen) ;Draw the gauge outline
    _DrawIndicators($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, $hPen, True) ;Draw scale arc
    _DrawCheckMarks($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, $StartAngle, $SweepAngle, $hPen, True) ;Draw scale checkmarks
    If $VariableLimit Then
        _DrawRadialAllowedSpeed($backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, $AllowedLimit, $AllowedPen, True) ;Draw allowed speed limits
    EndIf

    _GDIPlus_PathDispose($Path) ;Tidy up
    _GDIPlus_BrushDispose($GaugeBrush)
    _GDIPlus_BrushDispose($TextBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_PenDispose($AllowedPen)
EndFunc   ;==>_DrawRadialGauge

;Draw Variable Value (Text, Load/Speed Value)
;Creates The Centre Text of the Radial Gauge
;~ Func _DrawRadialGaugeText($ValueText, $CentrePointX, $CentrePointY, $Clockwise, $Radius, $ScalingFactor)
Func _DrawRadialGaugeText(ByRef $backbuffer, $ValueText, $CentrePointX, $CentrePointY, $Clockwise, $Radius, $ScalingFactor, ByRef $TextBrush)
    Local $FontSize = 180 * $ScalingFactor ;Default font size (Scaled)
    Local $Text = _GDIPlus_PathCreate()
    Local $Format = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($Format, 2) ;Align right (Doesn't seem to make a difference)
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB") ;Centre text font
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize, 2)
    Local $Layout = _GDIPlus_RectFCreate($CentrePointX - ($FontSize / 1.3) * $ScalingFactor, $CentrePointY - $FontSize * $ScalingFactor / 2) ;Set position (Top left)
    _GDIPlus_PathAddString($Text, Round($ValueText, 1), $Layout, $Family, 0, $FontSize * $ScalingFactor) ;Add value to path (To 1 decimal place)
    _GDIPlus_GraphicsFillPath($backbuffer, $Text, $TextBrush)

    $Layout = 0 ;Tidy up
    _GDIPlus_PathDispose($Text)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_DrawRadialGaugeText

;Draw Gauge Outline
;Creates the Outline of the Radial Gauge
;~ Func _DrawGaugeOutline($CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle)
Func _DrawGaugeOutline(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $VariableMaxValue, $VariableMinValue, $Thickness, $ScalingFactor, $Clockwise, $StartAngle, $SweepAngle, ByRef $hPen)
    Local $Path = _GDIPlus_PathCreate()
    Local Const $PI = 3.141592653589793


    $Radius += 2 ;Put the outline 2 px outside the gauge
    If $Clockwise Then ;If the gauge is to be filled clockwise
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, $SweepAngle)
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX + ($Radius * $ScalingFactor * Cos(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointY + ($Radius * $ScalingFactor * Sin(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointX + (($Radius - ($Thickness * $ScalingFactor) - (4 * $ScalingFactor)) * Cos(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)))) * $ScalingFactor), $CentrePointY + (($Radius - ($Thickness * $ScalingFactor) - 4) * $ScalingFactor * Sin(($PI / 180) * ($StartAngle - $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $hPen)
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arc
        $Radius -= 4
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), ($StartAngle + $SweepAngle), -$SweepAngle)
    Else
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, -$SweepAngle)
        _GDIPlus_GraphicsDrawLine($backbuffer, $CentrePointX + ($Radius * $ScalingFactor * Cos(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointY + ($Radius * $ScalingFactor * Sin(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $CentrePointX + (($Radius - ($Thickness * $ScalingFactor) - (4 * $ScalingFactor)) * Cos(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue)))) * $ScalingFactor), $CentrePointY + (($Radius - ($Thickness * $ScalingFactor) - 4) * $ScalingFactor * Sin(($PI / 180) * ($StartAngle + $VariableMinValue * ($SweepAngle / ($VariableMaxValue - $VariableMinValue))))), $hPen)
        $Radius -= ($Thickness * $ScalingFactor) ;Reduce radius for inner arc
        $Radius -= 4
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle - $SweepAngle, $SweepAngle)
    EndIf
    _GDIPlus_PathCloseFigure($Path) ;Close the path
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $hPen) ;Draw the path
    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawGaugeOutline

;Draw Scale(s)
;Creates a number of indicative markings around the centre of the radial gauge
;~ Func _DrawIndicators($CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle)
Func _DrawIndicators(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, ByRef $hPen, $Inside)
    Local $Path = _GDIPlus_PathCreate()
    $Radius -= ($Thickness + 20) * $ScalingFactor
    If $Clockwise Then
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, $SweepAngle)
    Else ;Doesn't make much difference, but it will be 180 degrees out
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, -$SweepAngle)
    EndIf
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $hPen)

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawIndicators

;Draw the allowed speed marker
Func _DrawRadialAllowedSpeed(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $Clockwise, $ScalingFactor, $StartAngle, $SweepAngle, _
        $AllowedLimit, ByRef $AllowedPen, $Inside)
    Local $Path = _GDIPlus_PathCreate()
    $Radius -= ($Thickness + 24) * $ScalingFactor
    If $Clockwise Then ;Display in a clockwise direction
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, $SweepAngle * $AllowedLimit / 100)
    ElseIf NOT $Clockwise Then ;Display in an anti-clockwise direction
        _GDIPlus_PathAddArc($Path, ($CentrePointX - ($Radius * $ScalingFactor)), ($CentrePointY - ($Radius * $ScalingFactor)), ($Radius * $ScalingFactor * 2), ($Radius * $ScalingFactor * 2), $StartAngle, -$SweepAngle * $AllowedLimit / 100)
    EndIf
    _GDIPlus_GraphicsDrawPath($backbuffer, $Path, $AllowedPen) ;Draw with the red pen ($AllowedPen)

    _GDIPlus_PathDispose($Path)
EndFunc   ;==>_DrawRadialAllowedSpeed

;DrawCheckmarks (Checkmarks)
;Creates the checkmarks and text around the indicator gauge
;~ Func _DrawCheckMarks($CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $MaxValue, $NoOfCheckmarks, $CheckLength, $StartAngle, $SweepAngle, $hPen)
Func _DrawCheckMarks(ByRef $backbuffer, $CentrePointX, $CentrePointY, $Radius, $Thickness, $ScalingFactor, $VariableMaxValue, $NoOfCheckmarks, $CheckLength, $StartAngle, _
        $SweepAngle, ByRef $hPen, $Inside)
    Local Const $PI = 3.141592653589793
    Local $TextBrush = _GDIPlus_BrushCreateSolid("0xFFFFFFFF")
    Local $aPoints[$NoOfCheckmarks][4] ;Creates an array of four points for each check line
    Local $aMarkText[$NoOfCheckmarks] ;Creates the text for the checkmarks

    $Radius -= ($Thickness + 20) * $ScalingFactor
    For $i = 0 to ($NoOfCheckmarks-1)
        $aMarkText[$i] = Round((($VariableMaxValue - $VariableMinValue) / ($NoOfCheckmarks - 1)) * $i) + $VariableMinValue ;Round checkmark values to one decimal place
    Next

    Local $aAngles[$NoOfCheckmarks] = [] ;Create an array to hold the angles at which the checkmarks should be
    If $Clockwise Then
        For $i = 0 to($NoOfCheckmarks - 1)
            $aAngles[$i] = $StartAngle + (($SweepAngle / ($NoOfCheckmarks - 1)) * $i) ;Spread out checkmarks evenly over the gauge
        Next
    Else ;For anticlockwise filling gauge
        For $i = 0 to($NoOfCheckmarks - 1)
            $aAngles[$i] = $StartAngle - (($SweepAngle / ($NoOfCheckmarks - 1)) * $i) ;Spread out checkmarks evenly over the gauge
        Next
    EndIf

    For $i = 0 to($NoOfCheckmarks - 1)
        $aAngles[$i] = $aAngles[$i] * $PI / 180 ;Convert degrees to radians
        $aPoints[$i][0] = $CentrePointX + ($Radius * Cos($aAngles[$i]) * $ScalingFactor) ;Create cartesian coordinates for the check lines from polar coordinates (Radius, angle)
        $aPoints[$i][1] = $CentrePointY + ($Radius * Sin($aAngles[$i]) * $ScalingFactor)
        $aPoints[$i][2] = $CentrePointX + (($Radius - ($CheckLength * $ScalingFactor)) * Cos($aAngles[$i]) * $ScalingFactor)
        $aPoints[$i][3] = $CentrePointY + (($Radius - ($CheckLength * $ScalingFactor)) * Sin($aAngles[$i]) * $ScalingFactor)
    Next
    ;Font data for checkmark text
    Local $Format = _GDIPlus_StringFormatCreate()
    Local $Family = _GDIPlus_FontFamilyCreate("Agency FB")
    Local $FontSize = 15
    Local $Font = _GDIPlus_FontCreate($Family, $FontSize * $ScalingFactor, 2)
    For $i = 0 to($NoOfCheckmarks - 1) ;For each checkmark
        _GDIPlus_GraphicsDrawLine($backbuffer, $aPoints[$i][0], $aPoints[$i][1], $aPoints[$i][2], $aPoints[$i][3], $hPen) ;Draw the lines
        $Layout = _GDIPlus_RectFCreate($aPoints[$i][2] - ($FontSize * Cos($aAngles[$i])) - (18 * $ScalingFactor), $aPoints[$i][3] - ($FontSize * Sin($aAngles[$i]) + 10), 0, 0)
        _GDIPlus_GraphicsDrawStringEx($backbuffer, $aMarkText[$i], $Font, $Layout, $Format, $TextBrush)
    Next

    $Layout = 0
    _GDIPlus_BrushDispose($TextBrush)
    _GDIPlus_FontDispose($Font)
    _GDIPlus_StringFormatDispose($Format)
    _GDIPlus_FontFamilyDispose($Family)
EndFunc   ;==>_DrawCheckMarks
#EndRegion Draw Radial Gauge

#EndRegion Functions

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By UEZ
      This project has been discontinued!
       
      Here a small tool I wrote to update my Sysinternal tools collection without the need to download always the whole package or visiting the site to check for updates. I know that there are several tools available (also some tools written in AutoIt) but here another one for the collection. It was good exercise for me to code it.
       
       
        
       
       
      Some files from cannot be downloaded although they are visible on the web site!
       
      Here the download link of the source code only: AutoIt Sysinternal Tools Synchronizer v0.99.5 build 2020-07-04 beta.7z  (1509 downloads previously)
      -=> Requires AutoIt version 3.3.13.20 or higher / tested on Win8.1 real machine and some VMs: Win7 / Vista / Win10
       
      Compiled exe only: @MediaFire
       
      Just select the Sysinternal Tools folder or create one and press the synchronize button to download the selected items. Click on AutoIt label (near to left upper corner) to open menu.
       
      Special thanks to LarsJ, Melba23 and mesale0077 for their help. 
       
      I've still some ideas to implement which are more gimmick related, so it is not finished yet...
      If you want to add your language please check out #Region Language. Thanks. 
       
      Please report any bug or if you have any suggestions.
       
      The language of the tool tip from each of the executable in the left list view were automatically created using Google translator and weren't checked for correctness.
       
      Br,
      UEZ
    • By ripdad
      This is a project that I have been working on for several months off and on.
      It's a simple "What You Hear" MP3 @ 320Kbps and WAV audio recorder.
      Features:
      - LoudMax, a Gain Controller and Look-Ahead Limiter
      - Auto Shut-Off after one minute of silence
      - Side-by-Side Simulated LED Meter
      - Running Time Counter
      It started off being a large project, but I eventually stripped it down to its
      bare essentials because I came to realize that it would be very difficult to
      deal with every sound card and every way a PC is set up for audio. It would
      have been a nightmare that I was not willing to go through.
      This project contains the most up-to-date BASS.dll v.2.4.15.0 - December 17, 2019.
      All BASS Dll's are 32bit. Those and the needed UDF's are included in the zip file.
      I will try to explain how it works in the next post.

      Download:
      BASS VST Recorder v1.1.zip
       
    • By Bilgus
      This is an update or derivative work of Beege 's Scrolling Line Graph UDF
      https://www.autoitscript.com/forum/topic/109599-scrolling-line-graph-udf
       
      I noticed a few issues for my use case with the UDF one being that adding a sample required updating the waveform
      High CPU usage went hand in hand with that requirement
      Another issue was just how long updating took to complete
      I've hopefully rectified that with this version
       
      There are a few changes (only 1 line per graph for instance)
      The addition of a function AddSample (uses graphics paths to speed up drawing samples on update) Gridlines are only generated once A sample finished line can be added UpdateGraph allows you to compress the discarded portion of the graph (it looks kinda cool but uses more CPU) Lower Cpu usage Uses real Control Ids - it is a label control underneath so you get click events and can display text when control is disabled Example (Waveform.au3)
       
      Example 2 (peak.au3)
      UDF
      Updated:
      Previous Downloads [38 / 38/ 0]
      SSLG.au3 waveform.au3 Peak.au3
    • By UEZ
      I was inspired by a CSS example to create a procedural graphic without any shader or ray tracing technique.
      Here the result using GDI+ only:

       
      Blue Orb.au3
      ;Inspired from https://codepen.io/bradleytaunt/details/VwvzKyb ;Coded by UEZ build 2020-05-07 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If @OSBuild < 7600 Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "ERROR", "This demo requires GDIPlus v1.1", 10) _GDIPlus_Startup() Global Const $iW = 1200, $iH = 700, $iSize_globe = 450 Global Const $hGUI = GUICreate("GDI+ Procedural Gfx / Blue Orb v1.20 by UEZ", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) ;~ _GDIPlus_GraphicsSetCompositingQuality($hGfx, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) _GDIPlus_GraphicsSetInterpolationMode($hGfx, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HALF) ;draw background Global Const $hBrush_bg = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xFF1E88E5, 0xFF1565C0, 2) _GDIPlus_LineBrushSetSigmaBlend ($hBrush_bg, 0.95, 1) ;create blurry edge _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iW, $iH, $hBrush_bg) ;draw blurred text Global Const $hImage_text = _GDIPlus_BitmapCreateFromScan0($iW, $iH / 2) Global Const $hGfx_text = _GDIPlus_ImageGetGraphicsContext($hImage_text) Global Const $hPath_text = _GDIPlus_PathCreate() Global Const $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global Const $hStringFormat = _GDIPlus_StringFormatCreate() Global Const $hBrush_txt = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xE0FFFFFF, 0xA01A237E) ;_GDIPlus_BrushCreateSolid(0xF02E86FB) _GDIPlus_LineBrushSetSigmaBlend($hBrush_txt, 0.66, 1) Global Const $hPen_txt = _GDIPlus_PenCreate(0x801A237E, 1) _GDIPlus_StringFormatSetAlign($hStringFormat, 1) _GDIPlus_StringFormatSetLineAlign($hStringFormat, 1) _GDIPlus_GraphicsSetSmoothingMode($hGfx_text, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) _GDIPlus_GraphicsSetTextRenderingHint($hGfx_text, $GDIP_TextRenderingHintAntialias) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx_text, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsSetCompositingQuality($hGfx_text, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) Global $tLayout = _GDIPlus_RectFCreate() $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = -$iH * 0.05 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt) _GDIPlus_GraphicsDrawPath($hGfx_text, $hPath_text, $hPen_txt) Global Const $hEffect_blur_text = _GDIPlus_EffectCreateBlur(20) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, 0, $iW, $iH / 2) ;draw shadow of the text Global Const $hBrush_txt_shadow = _GDIPlus_BrushCreateSolid(0x40000000) _GDIPlus_GraphicsClear($hGfx_text, 0) _GDIPlus_PathReset($hPath_text) $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = 0 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt_shadow) Global Const $hEffect_blur_text_shadow = _GDIPlus_EffectCreateBlur(60) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, $iH * 0.55, $iW, $iH / 8) ;draw shadow Global Const $iW_shadow1 = $iSize_globe * 0.85, $iH_shadow1 = $iSize_globe * 0.1, $iW_shadow2 = $iSize_globe * 0.60, _ $iW_shadow_Img = $iW_shadow1 * 2, $iH_shadowImg = $iH_shadow1 * 4 Global Const $hImage_shadow = _GDIPlus_BitmapCreateFromScan0($iW_shadow_Img, $iH_shadowImg) Global Const $hGfx_shadow = _GDIPlus_ImageGetGraphicsContext($hImage_shadow) _GDIPlus_GraphicsSetSmoothingMode($hGfx_shadow, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) Global Const $hBrush_shadow = _GDIPlus_BrushCreateSolid(0x66000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow1) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow1, $iH_shadow1, $hBrush_shadow) _GDIPlus_BrushSetSolidColor($hBrush_shadow, 0xB3000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow2) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow2, $iH_shadow1, $hBrush_shadow) Global Const $hEffect_blur_shadow = _GDIPlus_EffectCreateBlur(32) _GDIPlus_BitmapApplyEffect($hImage_shadow, $hEffect_blur_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_shadow, ($iW - $iW_shadow_Img) / 2, $iH / 2 + $iH_shadow1 * 2.20, $iW_shadow_Img, $iH_shadowImg) ;draw globe Global Const $hPath_globe = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath_globe, ($iW - $iSize_globe) / 2, ($iH - $iSize_globe) / 2, $iSize_globe, $iSize_globe) Global Const $hLBrush_globe1 = _GDIPlus_LineBrushCreate($iW / 2, ($iH - $iSize_globe) / 2, $iW / 2, ($iH + $iSize_globe) / 2, 0, 0, 1) Global $aInterpolations[5][2] $aInterpolations[0][0] = 4 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFFEEEEEE $aInterpolations[2][1] = 0.10 $aInterpolations[3][0] = 0xFF2E86FB $aInterpolations[3][1] = 0.50 $aInterpolations[4][0] = 0xFF1A237E $aInterpolations[4][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe1, $aInterpolations) _GDIPlus_GraphicsFillPath($hGfx, $hPath_globe, $hLBrush_globe1) Global Const $iSize_globe2 = $iSize_globe * 0.85, $iSize_globe2_Img = $iSize_globe2 * 1.5 Global Const $hImage_globe2 = _GDIPlus_BitmapCreateFromScan0($iSize_globe2_Img, $iSize_globe2_Img) Global Const $hGfx_globe2 = _GDIPlus_ImageGetGraphicsContext($hImage_globe2) Global Const $hBrush_globe2 = _GDIPlus_BrushCreateSolid(0x7F000000) ;draw shadow and blur it Global Const $px = ($iSize_globe2_Img - $iSize_globe2) / 2, $py = ($iSize_globe2_Img - $iSize_globe2) / 2 _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py + ($iSize_globe - $iSize_globe2) * 0.25, $iSize_globe2, $iSize_globe2, $hBrush_globe2) Global Const $hEffect_blur_shadow2 = _GDIPlus_EffectCreateBlur(15) _GDIPlus_BitmapApplyEffect($hImage_globe2, $hEffect_blur_shadow2) ;draw 2nd smaller globe and blur it, too Global Const $hLBrush_globe2 = _GDIPlus_LineBrushCreate($iW / 2, $py, $iW / 2, $py + $iSize_globe2, 0, 0) Dim $aInterpolations[4][2] $aInterpolations[0][0] = 3 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFF2E86FB $aInterpolations[2][1] = 0.60 $aInterpolations[3][0] = 0xFF283593 $aInterpolations[3][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe2, $aInterpolations) _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py, $iSize_globe2, $iSize_globe2, $hLBrush_globe2) Global Const $hImage_globe2_blur = _Blur($hImage_globe2, $iSize_globe, $iSize_globe) ;windows gdi+ blur doesn't work properly _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_globe2_blur, ($iW - $iSize_globe2_Img) / 2 - ($iSize_globe - $iSize_globe2) / 8, ($iH - $iSize_globe2_Img) / 2, $iSize_globe2_Img, $iSize_globe2_Img) GUISetState() _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $iW, $iH) ;~ _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Blue Orb v1.20.png") ;clean-up ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_EffectDispose($hEffect_blur_text) _GDIPlus_EffectDispose($hEffect_blur_text_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow2) _GDIPlus_PathDispose($hPath_text) _GDIPlus_PathDispose($hPath_globe) _GDIPlus_PenDispose($hPen_txt) _GDIPlus_BrushDispose($hBrush_txt) _GDIPlus_BrushDispose($hBrush_txt_shadow) _GDIPlus_BrushDispose($hBrush_bg) _GDIPlus_BrushDispose($hLBrush_globe1) _GDIPlus_BrushDispose($hLBrush_globe2) _GDIPlus_BrushDispose($hBrush_globe2) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_text) _GDIPlus_ImageDispose($hImage_shadow) _GDIPlus_ImageDispose($hImage_globe2) _GDIPlus_ImageDispose($hImage_globe2_blur) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_GraphicsDispose($hGfx_text) _GDIPlus_GraphicsDispose($hGfx_shadow) _GDIPlus_GraphicsDispose($hGfx_globe2) _GDIPlus_Shutdown() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit Func _Blur($hBitmap, $iW, $iH, $fScale = 0.0525, $dx1 = 0, $dy1 = 0, $dx2 = 0, $dy2 = 0, $qual = 6) ; by eukalyptus Local $hBmpSmall = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxSmall, $GDIP_PIXELOFFSETMODE_HALF) Local $hBmpBig = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxBig, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual) _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, $dx1, $iW, $iH + $dy1) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, $dx2, $iW, $iH + $dy2) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) Return $hBmpBig EndFunc ;==>_Blur  
      I hope you like it.
       
      Feel free to post your examples here, too. 
    • By ripdad
      I have been working on audio graphical scripts these last several months.
      This is my last script on this subject for now. On to other projects.
      Credits: UEZ, Eukalyptus, BrettF, Prog@ndy, Authenticity and the AutoIt Community.
      Thanks to all that made these scripts possible!
      Please let me know if you have any problems with it.

      Download:
      LIVE Stereo Audio Waveform v2.zip
       

×
×
  • Create New...