Jump to content

Recommended Posts

Posted (edited)

Hello,

This is my GdiPlus Canvas script.   (based on the AutoIt's GDIPlus functions)
It should make Graphic or Game Programming with AutoIt easier (at least for the beginners). 

The idea is to open a Canvas (or graphics/screen) to be drawn on. 
This solution is "Include and forget" - you just need to include it and the script will handle the unloading of the images, fonts and other gdi handles when you end  your script.
(p.s. only those created by the script, not the ones you create outside the provided functions)

You can load, save, images, clipboard content and screenshots,  draw lines, circles, Text and other things on them or on the Canvas.

The command set and idea is heavily based on the BlitzBasic3d language, and mimics it's behavior.
When you set a color, all drawings will use that color, until changed.
Drawing on a image instead of the canvas is, as well, possible by setting the image as the active buffer.

Included in the 7zip file are many examples, tests and help files.
Help is available as .txt, pdf, Png, RTF and as autoit script.
Here is the command list available:

Color  RGB  GetColor  PenSize  Plot  Line  Rect  Circle  Ellipse  Pie  Polygon
DrawImage DrawImageSize  DrawImageZoom  DrawAnimImage  SetAnimImage  DrawImageFlip DrawRotate
BlendMode
Flip Cls 
SetBuffer  BackBuffer  ImageBuffer  SaveImage  LoadImage  CreateImage  CloneImage
ScreenShotImage  FreeImage  ImageToClipboard  CanvasToClipboard  ClipboardToImage  
AppTitle
ImageWidth  ImageHeight  AnimWidth  AnimHeight  CanvasWidth  CanvasHeight  CanvasDrawWidth  CanvasDrawHeight
Rand Text
Print              (as in Qbasic/GwBasic text display routine. )
SetFont  FontStyle  LoadFont  FreeFont  FontSize  FontName  
MouseX  MouseY  MouseRX  MouseRY  MouseGX  MouseGY  MouseZ  GetMouseCoords
KeyDown 
Window  Canvas  SetCanvas  SetGuiStyle  SetGuiExStyle  
GuiHWND  Debug
GetSaveNameDialog  GetLoadNameDialog
SetProcessDpiAwareness


Here is an example program using this Include. It is a Pendulum from Rosettacode.org :
 

#include "..\GDIP_Canvas.au3"
#NoTrayIcon

Opt("GUIOnEventMode", 1)

Window("Pendulum from Rosettacode", 640, 400, 0, 30)
GUISetBkColor(0x606060, $hgui)
Canvas(640, 400, 0, 0)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

;https://rosettacode.org/wiki/Animate_a_pendulum
Const $PI = 3.141592920
Global $theta, $g, $l, $accel, $speed, $px, $py, $bx, $by
$theta = $PI/2
$g = 9.81
$l = 1
$speed = 0
$px = 320
$py = 10

$deg=180/$Pi

While 1
    $bx=$px+$l*300*Sin($theta*$deg)
    $by=$py-$l*300*Cos($theta*$deg)
    Cls()
    Line ($px,$py,$bx,$by)
    Ellipse ($bx-12,$by-12,25,25,1)
    $accel=$g*Sin($theta*$deg)/$l/100
    $speed=$speed+$accel/100
    $theta=$theta+$speed
    Print ("Pendulum",0,350)
    Print ("Press ESC key to quit",0,372)
    Flip(30)
WEnd


Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
    EndSelect
EndFunc   ;==>SpecialEvents



Have fun !

 

GDICanvas-release01a.7z

Edited by Dan_555
Bugfix

Some of my script sourcecode  ,  Gdi+ Canvas

  • 3 weeks later...
Posted (edited)

This post is for known bugs:

Compiling programs which use this library in 64 bit breaks the mouse wheel. (Either up or down is not working.) 32bit executable works fine. 

12.10.2026 - This bug has been identified and fixed. The new version is up.

Edited by Dan_555

Some of my script sourcecode  ,  Gdi+ Canvas

Posted (edited)

This is a Moon Calendar using the canvas library. 
screenshot.jpg.abada831a43d1c28dcd054524b595203.jpg

You can use the attached moon picture for a bit nicer display of the moon (the script will draw an alternative white and gray moon if its not present).

#include <GDIP_Canvas.au3>
#include <String.au3>

Opt("GUIOnEventMode", 1)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 3)
Opt("TrayAutoPause", 0)

$te = TrayCreateItem("Exit")
TrayItemSetOnEvent($te, "SpecialEvents")

;converted from (2026 defunct) https://www.codeproject.com/Articles/100174/Calculate-and-Draw-Moon-Phase
;a part of the code is from https://web.archive.org/web/20090218203728/http://home.att.net/~srschmitt/lunarphasecalc.html

Global $Monthname = "JanFebMarAprMayJunJulAugSepOctNovDec"
Global $CurrentDate = @MDAY & " " & StringMid($Monthname, (@MON * 3) + 1, 3) & " " & @YEAR

Window("Moon phase calendar | Today: ( " & $CurrentDate & " )", 640, 400, 0, 30)
GUISetBkColor(0x606060, $hgui)
Canvas(350, 242)
SetCanvas(0, 0, 640, 480)

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

LoadFont(1, "Arial", 8)
LoadFont(2, "Arial", 10)
SetFont(1)

Global $Phase , $Zodiac
Global $OldNR = -1, $MoonImage
Global $MB, $MX, $MY
Global Const $pi=3.14159

$StarsMax = Rand(50, 150)
Dim $Stars[$StarsMax][2]
Dim $CalDay[7]
Dim $DayText[] = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

Global $mday = "312831303130313130313031"

If FileExists("moon.png") Then
    ;Load image
    $MoonImage = LoadImage("moon.png")
    SetAnimImage($MoonImage, 91, 89, 5, 6)
Else
    ;or create image
    $MoonImage = CreateImage(91 * 30, 89)
    $buffr = CreateImage(120, 120)

    For $x = 0 To 29
        SetBuffer(ImageBuffer($buffr))
        cls(0, 0)                   ;This creates a transparent background (alpha value of 0)
        color(0xffffff)
        Ellipse(2, 2, 116, 114, 1)
        Color(0x303030)
        If $x = 0 Then Polygon(1, "75,2;84,7;91,13;99,23;105,37;108,52;108,63;105,77;101,89;94,100;82,111;69,117;57,117;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;43,4;52,1;64,1;71,1")
        If $x = 1 Then Polygon(1, "73,2;82,9;89,20;93,27;98,38;100,52;100,64;99,73;97,83;92,98;82,111;69,117;57,117;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;43,4;52,1;64,1;71,1")
        If $x = 2 Then Polygon(1, "72,3;79,11;84,20;87,28;89,38;90,47;92,63;91,76;89,87;85,96;78,109;67,117;57,117;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;43,4;52,1;64,1;71,1")
        If $x = 3 Then Polygon(1, "67,2;73,9;76,16;80,27;80,33;83,43;84,62;83,73;81,83;78,97;71,111;63,117;57,117;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;43,4;52,1;64,1;60,0;68,2")
        If $x = 4 Then Polygon(1, "67,4;70,12;71,18;72,25;74,30;76,43;75,61;75,72;73,84;71,96;68,110;63,117;57,117;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;43,4;52,1;56,0;61,0;66,3")
        If $x = 5 Then Polygon(1, "60,2;63,7;64,12;66,20;66,29;67,43;67,58;68,65;66,86;65,106;62,111;59,117;57,117;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;38,5;44,3;49,1;56,0;60,1")
        If $x = 6 Then Polygon(1, "59,117;54,116;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;38,5;44,3;49,1;56,0;60,1;59,118")
        If $x = 7 Then Polygon(1, "59,117;54,116;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;38,5;44,3;49,1;56,0;58,0;54,20;54,37;53,66;54,81;55,94;58,114")
        If $x = 8 Then Polygon(1, "59,117;54,116;46,115;34,112;26,107;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;38,5;44,3;49,1;53,0;55,0;52,5;47,23;43,51;45,75;46,90;51,105;55,114")
        If $x = 9 Then Polygon(1, "51,116;43,115;36,113;29,110;21,103;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;38,5;44,3;49,1;53,0;51,3;44,13;40,25;37,44;36,63;37,79;40,90;48,109;53,115")
        If $x = 10 Then Polygon(1, "51,116;43,115;36,113;29,110;21,103;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;38,5;44,3;49,1;48,2;41,8;38,15;33,25;28,45;28,60;29,73;32,89;38,101;45,110;50,115")
        If $x = 11 Then Polygon(1, "51,116;43,115;36,113;29,110;21,103;15,97;6,84;2,73;0,53;4,40;7,32;13,23;24,12;34,7;38,5;44,3;49,1;48,2;36,10;30,19;23,33;20,49;21,66;23,79;26,92;33,103;41,111;50,115")
        If $x = 12 Then Polygon(1, "51,116;43,115;36,113;29,110;21,103;15,97;6,84;2,73;0,53;4,40;7,32;13,23;20,14;27,10;33,6;42,3;28,13;22,21;17,36;13,50;13,67;15,75;18,88;26,101;41,112;53,116")
        If $x = 13 Then Polygon(1, "51,116;43,115;36,113;29,110;21,103;15,97;6,84;2,73;0,53;4,40;7,32;13,23;20,14;25,11;23,14;17,21;11,29;7,39;4,56;4,66;8,81;12,88;21,100;32,108;40,111;51,115")
        If $x = 14 Then Polygon(1, "97,106;113,86;117,77;119,66;119,53;117,40;114,33;106,21;98,13;97,15;103,21;109,30;113,41;114,50;114,60;113,72;113,79;110,85;102,97;96,104")
        If $x = 15 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;82,5;93,15;99,25;105,39;106,58;106,74;100,90;94,100;85,108;73,115")
        If $x = 16 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;82,5;70,0;81,8;86,15;94,27;97,42;99,65;96,83;90,98;83,106;70,116")
        If $x = 17 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;82,5;68,0;74,5;81,16;87,31;91,52;89,76;85,93;79,105;72,113;65,117;71,117")
        If $x = 18 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;66,0;71,7;77,22;82,41;82,67;78,92;75,102;71,110;69,114;65,117;71,117")
        If $x = 19 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;64,0;70,13;73,35;75,61;74,86;71,98;69,106;66,112;65,114;63,117;71,117")
        If $x = 20 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;63,6;66,40;67,57;67,80;64,97;64,106;63,112;61,116;63,117;71,117")
        If $x = 21 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;61,0;60,61;61,117;71,117")
        If $x = 22 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;59,0;54,20;52,32;52,78;55,95;56,109;60,118;71,118")
        If $x = 23 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;59,0;56,0;49,16;45,37;44,72;48,100;56,118;71,118")
        If $x = 24 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;59,0;56,0;43,15;36,40;36,74;39,93;54,117;71,118")
        If $x = 25 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;59,0;56,0;46,4;33,24;28,44;29,77;38,102;47,113;56,118;72,117")
        If $x = 26 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;59,0;56,0;41,5;26,25;20,52;22,82;33,103;47,116;56,118;72,117")
        If $x = 27 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;59,0;56,0;41,5;21,21;13,41;13,65;14,80;26,101;41,113;52,115;69,117")
        If $x = 28 Then Polygon(1, "73,117;84,113;100,102;109,92;115,81;119,69;119,57;117,41;111,28;103,18;93,10;80,3;62,0;59,0;56,0;38,5;23,13;11,31;4,54;6,71;15,94;26,105;37,112;46,115;66,117;72,117")
        If $x = 29 Then Polygon(1, "49,1;39,4;31,7;24,11;13,22;5,33;1,43;1,66;4,78;13,94;20,103;31,109;42,114;59,117;74,116;87,111;99,100;108,89;113,76;116,67;116,54;113,38;104,23;95,14;85,5;69,1;50,1")
        SetBuffer(ImageBuffer($MoonImage))
        DrawImageSize($buffr, $x * 91, 0, 91, 89)
    Next
    FreeImage($buffr)
    SetAnimImage($MoonImage, 91, 89, 30, 1)
    SetBuffer(backbuffer())
    cls(0, 255)                            ;Reset aplha value to 255
EndIf

;stars init

For $x = 0 To $StarsMax - 1
    $Stars[$x][0] = Rand(236, 349)
    $Stars[$x][1] = Rand(0, 200)
Next

Global $DAY = @MDAY
Global $MON = @MON
Global $YEA = @YEAR
Global $MD
Global $SelectedDay, $StartingDay, $btntimer = TimerInit()

$MA = MoonAge($DAY, $MON, $YEA)
Check()

$dayo = $DAY
$mono = $MON
$yeao = $YEA
$currDate = $CurrentDate

;Cls  (0x000080)
Cls(RGB(2, 1, 41))

While 1
    Cls()
    Color(0xffffff)
    ;draw stars and move them
    For $x = 0 To $StarsMax - 1
        $Stars[$x][1] = $Stars[$x][1] + 1
        If $Stars[$x][1] > 200 Then $Stars[$x][1] = 0
        Plot($Stars[$x][0], $Stars[$x][1])
    Next

    $CurrentDate = @MDAY & " " & StringMid($Monthname, (@MON * 3) + 1, 3) & " " & @YEAR

    If $currDate <> $CurrentDate Then
        $currDate = $CurrentDate
        AppTitle("Moon phase calendar | Today: ( " & $CurrentDate & " )")
    EndIf
;~
    $MB = KeyDown("lmouse") + (2 * KeyDown("rmouse"))
    $MX = MouseX()
    $MY = MouseY()

    If TextB(0, 1, "Now", 196, 1, 1) Then
        $DAY = @MDAY
        $MON = @MON
        $YEA = @YEAR
        Check()
    EndIf

    $vadd = 0

    If TextB(0, 1, "<", 80, 1, 1) = 1 Then $vadd = -1
    If TextB(0, 1, "<<", 55, 1, 1) = 1 Then $vadd = -10
    If TextB(0, 1, ">", 142, 1, 1) = 1 Then $vadd = +1
    If TextB(0, 1, ">>", 159, 1, 1) = 1 Then $vadd = +10

    If $vadd <> 0 And TimerDiff($btntimer) > 200 Then
        $YEA = $YEA + $vadd
        If $YEA < 1 Then $YEA = 1
        If $YEA > 2222 Then $YEA = 2222
        Check()
        $btntimer = TimerInit()
    EndIf

    TextB(2, 2, $YEA, 100, 1)
    Line(0, 19, 235, 19)
    Line(0, 37, 235, 37)
    Line(0, 155, 235, 155)
    Line(235, 0, 235, CanvasHeight())

    For $x = 1 To 7
        $cc = $x
        If $cc = 7 Then
            $cc = 0
            Color(0xff0000)
        EndIf
        Print(StringMid($DayText[$cc], 1, 3), 10 + (($x - 1) * (FontSize() * 4)), 21)
    Next

    Color(0xffffff)

    $x = $StartingDay
    If $StartingDay = 0 Then $x = 7
    $y = 40

    For $count = 1 To $MD

        If $x > 7 Then
            $x = 1
            $y = $y + FontSize() + 10
        EndIf
        If TextB($count, $DAY, _StringRepeat(" ", 3 - StringLen($count)) & $count, (($x * (4 * FontSize())) + 6) - 30, $y, 1) = 1 Then $DAY = $count
        $x = $x + 1
    Next

    $y = 160
    $cc = 0
    For $z = 1 To 2
        For $x = 0 To 5
            $tmp = StringMid($Monthname, ($cc * 3) + 1, 3)
            If TextB($MON, $cc + 1, $tmp, 15 + ($x * FontSize() * 4), $y, 1) = 1 Then
                $MON = $cc + 1
                Check()
            EndIf
            $cc = $cc + 1
        Next
        $y = $y + 20
    Next

    $MA = MoonAge($DAY, $MON, $YEA)
    $dayo = $DAY
    $mono = $MON
    $yeao = $YEA
    DrawMoon($MA)
    Print(StringLeft($MA, 5), 5, 2)
    Flip(30, 1)
WEnd

Exit

Func Check()
    $MD = Int(StringMid($mday, (($MON - 1) * 2) + 1, 2))
    If $MON = 2 Then $MD = $MD + LeapYear($YEA)
    If $DAY > $MD Then $DAY = $MD
    $StartingDay = DayOfYear(1, $MON, $YEA)
    $SelectedDay = DayOfYear($DAY, $MON, $YEA)
EndFunc   ;==>Check

Func TextB($c, $nr, $txt, $x, $y, $btn = 0)
    Local $ret
    Color(0xffffff)
    If $btn = 1 Then
        Local $tmpx = (StringLen($txt) * (FontSize())) + 4
        Local $tmpy = (FontSize() + 8)
        If ($MX >= $x And $MX <= $x + $tmpx) Then
            If ($MY >= $y And $MY <= $y + $tmpy) Then
                Color(0xff00ff)
                If $MB > 0 Then $ret = $MB
            EndIf
        EndIf
        Rect($x, $y, $tmpx, $tmpy, 0)
        Color(0xffffff)
    Else
        Color(0xffffff)
    EndIf
    If $c = $nr Then Color(0x00ff00)
    Print($txt, $x + 2, $y + 2)
    Color(0xffffff)
    Return $ret
EndFunc   ;==>TextB

Func DrawMoon($nr)
    Local $x, $y
    SetFont(2)
    $nr = Int($nr)
    If $nr < 1 Then $nr = 1
    If $nr > 30 Then $nr = 30
    If $OldNR <> $nr Then $OldNR = $nr
    $x = 248
    $y = 50
    Print($Phase, $x - 10, $y - 30)
    Print("Constelation:", $x+5 , $y + 113)
    Print($Zodiac, $x + 20, $y + 130)
    If $MoonImage > 0 Then DrawAnimImage($MoonImage, $x, $y, 91, 100, $nr)
    SetFont(1)
EndFunc   ;==>DrawMoon

Func LeapYear($y)
    ;code from the 8-bit show and tell - https://www.youtube.com/watch?v=W0qpOk5wNdY
    If Mod($y, 4) = 0 And Mod($y, 100) <> 0 Or Mod($y, 400) = 0 Then Return 1
    Return 0
EndFunc   ;==>LeapYear

Func DayOfYear($t, $m, $j)
    Local $z, $c, $RR, $A = "033614625035", $x

    $z = $j - 1
    $c = Int($z / 4) - Int($z / 100) + Int($z / 400)
    $RR = StringMid($A, $m, 1)
    $x = $j + $t + $c + $RR - 1
    If $m > 2 And ($j = 4 * Int($j / 4)) And $j <> 100 * Int($j / 100) Or $j = 400 * Int($j / 400) Then $x = $x + 1
    $x = $x - 7 * Int($x / 7)
    Return $x
EndFunc   ;==>DayOfYear

Func JulianDate($d, $m, $y)
;~ ;https://orbital-mechanics.space/reference/julian-date.html
    Local $A, $a1, $b, $c, $e
    $a1 = ($m - 14) / 12
    $A = 1461 * ($y + 4800 + $a1) / 4
    $b = (367 * ($m - 2 - 12 * ($a1))) / 12
    $c = (3 * (($y + 4900 + $a1) / 100)) / 4
    Return $A + $b - $c + $d - 32075
EndFunc   ;==>JulianDate

Func MoonAge($d, $m, $y)
    Local $AG                          ; Moon's age

    Local $YY, $MM, $K1, $K2, $K3, $JD
    Local $IP

    ; calculate the Julian date at 12h UT
    $YY = $y - Floor((12 - $m) / 10)
    $MM = $m + 9
    If ($MM >= 12) Then
        $MM = $MM - 12
    EndIf

    $K1 = Floor(365.25 * ($YY + 4712))
    $K2 = Floor(30.6 * $MM + 0.5)
    $K3 = Floor(Floor(($YY / 100) + 49) * 0.75) - 38

    $JD = $K1 + $K2 + $d + 59                  ; For dates in Julian calendar
    If ($JD > 2299160) Then
        $JD = $JD - $K3                       ; For Gregorian calendar
    EndIf

    ; calculate moon's age in days
    $IP = (($JD * 10) - (2451550.1 * 10)) / (29.5309 * 10)
    $IP = normalize($IP)
    $AG = ($IP) * (29.5236)

    If $AG < 1.84566 Then
        $Phase = "     NEW Moon"
    ElseIf $AG < 5.53699 Then
        $Phase = " Waxing crescent"
    ElseIf $AG < 9.22831 Then
        $Phase = "     First quarter"
    ElseIf $AG < 12.91963 Then
        $Phase = "  Waxing gibbous"
    ElseIf $AG < 16.61096 Then
        $Phase = "    FULL Moon   "
    ElseIf $AG < 20.30228 Then
        $Phase = "  Waning gibbous"
    ElseIf $AG < 23.99361 Then
        $Phase = "    Last quarter"
    ElseIf $AG < 27.68493 Then
        $Phase = " Waning crescent"
    Else
        $Phase = "     NEW Moon"
    EndIf
    ;********************

    $IP = $IP * 2 * $PI                   ; Convert phase to radians

    ; calculate moon's distance
    $DP = 2 * $PI * normalize(($JD - 2451562.2) / 27.55454988)
    $DI = 60.4 - 3.3 * Cos($DP) - 0.6 * Cos(2 * $IP - $DP) - 0.5 * Cos(2 * $IP)

    ; calculate moon's ecliptic latitude
    $NP  = 2 * $PI * normalize(($JD - 2451565.2) / 27.212220817)
    $LA  = 5.1 * Sin($NP)

    ; calculate moon's ecliptic longitude
    $RP  = normalize(($JD - 2451555.8) / 27.321582241)
    $LO  = 360 * $RP + 6.3 * Sin($DP) + 1.3 * Sin(2 * $IP - $DP) + 0.7 * Sin(2 * $IP)

    If $LO < 33.18 Then
        $Zodiac = "Pisces"
    ElseIf $LO < 51.16 Then
        $Zodiac = "Aries"
    ElseIf $LO < 93.44 Then
        $Zodiac = "Taurus"
    ElseIf $LO < 119.48 Then
        $Zodiac = "Gemini"
    ElseIf $LO < 135.30 Then
        $Zodiac = "Cancer"
    ElseIf $LO < 173.34 Then
        $Zodiac = "Leo"
    ElseIf $LO < 224.17 Then
        $Zodiac = "Virgo"
    ElseIf $LO < 242.57 Then
        $Zodiac = "Libra"
    ElseIf $LO < 271.26 Then
        $Zodiac = "Scorpio"
    ElseIf $LO < 302.49 Then
        $Zodiac = "Sagittarius"
    ElseIf $LO < 311.72 Then
        $Zodiac = "Capricorn"
    ElseIf $LO < 348.58 Then
        $Zodiac = "Aquarius"
    Else
        $Zodiac = "Pisces"
    EndIf

    ;*********************
    Return $AG
EndFunc   ;==>MoonAge

;~ ; normalize values To range 0...1
Func normalize($v)
    ;Print "v0= "+v+" "+(Floor( v ))
    $v = $v - Floor($v)
    ;Print "v1= "+(v)
    ;Print
    If $v < 0 Then
        $v = $v + 1
    EndIf
    Return $v
EndFunc   ;==>normalize

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            GUIDelete()
            Exit
    EndSelect
EndFunc   ;==>SpecialEvents

 

Moon.png

Edited by Dan_555
Correcting spelling mistakes

Some of my script sourcecode  ,  Gdi+ Canvas

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
×
×
  • Create New...