Jump to content

A naive question


Gianni
 Share

Recommended Posts

Hi, I would translate some of the functions found here to Autoit, (http://members.chello.at/~easyfilter/bresenham.html)
How can I translate this line of code? (I don't know what the += ++ operator does):

if (r > x || err > y) err += ++x*2+1; /* e_xy+e_x > 0 or no 2nd y-step */

thanks

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

hmmm....... 

Maybe like this:

if ($r > $x Or $err > $y) Then
    $x += 1
    $err += $x*2+1
EndIf

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Thanks mLipok

maybe?...
 shouldn't the ++ operator be used on the right of the variable?

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Thanks trancexx

....so, precedences are like this:
 ++ ($x * 2) + 1 ..... ??? I don't get it
where the +3 cames from

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

ok, so according to your explanation of "First case", tranlation should be done in 2 steps like in post #2
is it right?

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

6 hours ago, Chimp said:

ok, so according to your explanation of "First case", tranlation should be done in 2 steps like in post #2
is it right?

It can be. Unless inside a loop maybe, where you'd be using For...Next with $x automatically incremented - I haven't looked at the original code.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

many thanks to you both!!, that point is clearer now, and the translation to AutoIt partially works .

now I'm nearly done with the whole tranlation, however, I'm stuck again on a couple of new knots within the plotQuadBezierSeg() function...

point 1: on line 128: what assert() does??

assert(xx*sx <= 0 && yy*sy <= 0);  /* sign of gradient must not change */

point 2: on line 130: what the (long) means in that way?? solved, see next post

if (sx*(long)sx+sy*(long)sy > xx*xx+yy*yy) [ /* begin with longer part */

point 3: ... lines 140 and 142 are not bad at all....?? solved, see next post

xx += sx; xx *= sx = x0 < x2 ? 1 : -1;           /* x step direction */
    yy += sy; yy *= sy = y0 < y2 ? 1 : -1;           /* y step direction */

here is the script that I've botched just to test the translation, and partially it works now. Working functions are plotLine(), plotCircle(), and plotEllipseRect(), while the plotQuadBezierSeg() is still incomplete for the above problems, and if executed it stuck the script.

original functions are here: http://members.chello.at/~easyfilter/bresenham.html

Any suggestion on how to complete the translation is welcome and will have all my gratefully...

#cs
    The Beauty of Bresenham's Algorithm
    A simple implementation to plot lines, circles, ellipses and Bézier curves.
    http://members.chello.at/~easyfilter/bresenham.html
#ce
; ------------------------------------------
; setup blackboard
#include <GDIPlus.au3>
_GDIPlus_Startup()
OnAutoItExitRegister("_Terminate")
Local $iWinWidth = 500, $iWinHeight = 500
Local $hScreen = GUICreate("Blackboard", $iWinWidth, $iWinHeight)
GUISetBkColor(0)
GUISetState(@SW_SHOW, $hScreen)
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hScreen)
Global $hColor = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) ; Bright White
;
; ------------------------------------------
; test the functions
plotLine(0, 0, 500, 500)
plotCircle(250, 250, 200)
plotEllipseRect(10, 200, 490, 300)
MsgBox(0, "Pause", "plotQuadBezierSeg() function still incomplete.")
; plotQuadBezierSeg(10, 490, 125, 30, 490, 30)

; ------------------------------------------
; Line
Func plotLine($x0, $y0, $x1, $y1)
    Local $dx = Abs($x1 - $x0), $sx = $x0 < $x1 ? 1 : -1
    Local $dy = -Abs($y1 - $y0), $sy = $y0 < $y1 ? 1 : -1
    Local $err = $dx + $dy, $e2 ; /* error value e_xy */

    While 1 ;  /* loop */
        setPixel($x0, $y0)
        If ($x0 = $x1 And $y0 = $y1) Then ExitLoop ; break
        $e2 = 2 * $err
        If ($e2 >= $dy) Then ; /* e_xy + e_x > 0 */
            $err += $dy
            $x0 += $sx ; /* x step */
        EndIf
        If ($e2 <= $dx) Then ; /* e_xy + e_y < 0 */
            $err += $dx
            $y0 += $sy ; /* y step */
        EndIf
    WEnd

EndFunc   ;==>plotLine

; Circle
Func plotCircle($xm, $ym, $r)
    Local $x = -$r, $y = 0, $err = 2 - 2 * $r ; /* II. Quadrant */
    While ($x < 0); Do
        setPixel($xm - $x, $ym + $y); /*   I. Quadrant */
        setPixel($xm - $y, $ym - $x); /*  II. Quadrant */
        setPixel($xm + $x, $ym - $y); /* III. Quadrant */
        setPixel($xm + $y, $ym + $x); /*  IV. Quadrant */
        $r = $err;
        If ($r <= $y) Then ;           /* e_xy+e_y < 0 */
            $y += 1
            $err += $y * 2 + 1
        EndIf
        If ($r > $x Or $err > $y) Then ; /* e_xy+e_x > 0 or no 2nd y-step */
            $x += 1
            $err += $x * 2 + 1
        EndIf
    WEnd ; While ($x < 0);
EndFunc   ;==>plotCircle

; Ellipse
; This function plots an ellipse inside a specified rectangle.
Func plotEllipseRect($x0, $y0, $x1, $y1)
    Local $a = Abs($x1 - $x0), $b = Abs($y1 - $y0), $b1 = BitAND($b, 1) ;  $b1 = $b & 1; /* values of diameter */
    Local $dx = 4 * (1 - $a) * $b * $b, $dy = 4 * ($b1 + 1) * $a * $a ; /* error increment */
    Local $err = $dx + $dy + $b1 * $a * $a, $e2; /* error of 1.step */

    If ($x0 > $x1) Then ; /* if called with swapped points */
        $x0 = $x1
        $x1 += $a
    EndIf
    If ($y0 > $y1) Then $y0 = $y1 ; /* .. exchange them */
    $y0 += ($b + 1) / 2
    $y1 = $y0 - $b1 ;   /* starting pixel */
    $a *= 8 * $a;
    $b1 = 8 * $b * $b;

    While ($x0 <= $x1) ; do [
        setPixel($x1, $y0); /*   I. Quadrant */
        setPixel($x0, $y0); /*  II. Quadrant */
        setPixel($x0, $y1); /* III. Quadrant */
        setPixel($x1, $y1); /*  IV. Quadrant */
        $e2 = 2 * $err;
        If ($e2 <= $dy) Then
            $y0 += 1
            $y1 -= 1
            $dy += $a
            $err += $dy ; += $a; }  /* y step */
        EndIf
        If ($e2 >= $dx Or 2 * $err > $dy) Then
            $x0 += 1
            $x1 -= 1
            $dx += $b1
            $err += $dx ; += $b1; } /* x step */
        EndIf
    WEnd ; while ($x0 <= $x1);

    While ($y0 - $y1 < $b) ; [  /* too early stop of flat ellipses a=1 */
        setPixel($x0 - 1, $y0); /* -> finish tip of ellipse */

        $y0 += 1
        setPixel($x1 + 1, $y0) ; ++);

        setPixel($x0 - 1, $y1);

        $y1 -= 1
        setPixel($x1 + 1, $y1) ; --);
    WEnd
EndFunc   ;==>plotEllipseRect

; #cs
; Bézier curve
; This function plots a quadratic Bézier curve limited to gradients without sign change.
Func plotQuadBezierSeg($x0, $y0, $x1, $y1, $x2, $y2)

    Local $sx = $x2 - $x1, $sy = $y2 - $y1;
    Local $xx = $x0 - $x1, $yy = $y0 - $y1, $xy;         /* relative values for checks */
    Local $dx, $dy, $err, $cur = $xx * $sy - $yy * $sx;                    /* curvature */

    ; assert($xx * $sx <= 0 && $yy * $sy <= 0) ;  /* sign of gradient must not change */

    ;If ($sx * (long) $sx + $sy * (long) $sy > $xx * $xx + $yy * $yy) Then ; { /* begin with longer part */
    If ($sx * $sx + $sy * $sy > $xx * $xx + $yy * $yy) Then ; { /* begin with longer part */
        $x2 = $x0
        $x0 = $sx + $x1
        $y2 = $y0
        $y0 = $sy + $y1
        $cur = -$cur ;  /* swap P0 P2 */
    EndIf ; }
    If ($cur <> 0) Then ;{ / * no straight line * /
        $xx += $sx
        $xx *= $sx = $x0 < $x2 ? 1 : -1 ;           /* x step direction */
        $yy += $sy
        $yy *= $sy = $y0 < $y2 ? 1 : -1 ;           /* y step direction */
        $xy = 2 * $xx * $yy
        $xx *= $xx
        $yy *= $yy ;          /* differences 2nd degree */
        If ($cur * $sx * $sy < 0) Then ;{         /* negated curvature? */
            $xx = -$xx
            $yy = -$yy
            $xy = -$xy
            $cur = -$cur
        EndIf ; }
        $dx = 4.0 * $sy * $cur * ($x1 - $x0) + $xx - $xy;             /* differences 1st degree */
        $dy = 4.0 * $sx * $cur * ($y0 - $y1) + $yy - $xy;
        $xx += $xx
        $yy += $yy
        $err = $dx + $dy + $xy;                /* error 1st step */
        While ($dy < $dx) ; do {
            setPixel($x0, $y0);                                     /* plot curve */
            ; If ($x0 == $x2 && $y0 == $y2) Then Return;  /* last pixel -> curve finished */
            If ($x0 = $x2 And $y0 = $y2) Then Return;  /* last pixel -> curve finished */
            $y1 = 2 * $err < $dx;                  /* save value for test of y step */
            If (2 * $err > $dy) Then
                $x0 += $sx
                $dx -= $xy
                $dy += $yy
                $err += $dy ; += $yy;
            EndIf ; } /* x step */
            If ($y1) Then
                $y0 += $sy
                $dy -= $xy
                $dx += $xx
                $err += $dx ; += xx;
            EndIf ; } /* y step */
        WEnd ;} while (dy < dx );           /* gradient negates -> algorithm fails */
    EndIf ; }
    plotLine($x0, $y0, $x2, $y2);               /* plot remaining part to end */
EndFunc   ;==>plotQuadBezierSeg
; #ce

Func setPixel($x0, $y0); it draws a single pixel
    _GDIPlus_GraphicsFillRect($hGraphics, _
            $x0, _ ;  Horizontal pixel position
            $y0, _ ;  Vertical pixel position
            1, 1, _ ; pixel is a 1x1 square
            $hColor)
EndFunc   ;==>setPixel

Func _Terminate()
    ; Clean up resources
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BrushDispose($hColor)
    _GDIPlus_Shutdown()
    Exit
EndFunc   ;==>_Terminate

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites


Point 3: I have solved the block of point 3 by breaking the code into 2 parts (thanks to trancexx's explanations in posts 6 and 7).

xx += sx; xx *= sx = x0 < x2 ? 1 : -1;

becomes

$xx += $sx
        $sx = ($x0 < $x2 ? 1 : -1)
        $xx *= $sx ;           /* x step direction */

Point 2: Perhaps the (Long) is just for type conversion, since Autoit manage variable types automatically, I've thougt to simply remove that instruction (and it seems to work...)

Point 1: Still stucked on the assert() part.... ??? on line 138

any suggestion about this last point is welcome. Thanks

updated code:

#cs
    The Beauty of Bresenham's Algorithm
    A simple implementation to plot lines, circles, ellipses and Bézier curves.
    http://members.chello.at/~easyfilter/bresenham.html
#ce
; ------------------------------------------
; setup blackboard
#include <GDIPlus.au3>
_GDIPlus_Startup()
OnAutoItExitRegister("_Terminate")
Local $iWinWidth = 500, $iWinHeight = 500
Local $hScreen = GUICreate("Blackboard", $iWinWidth, $iWinHeight)
GUISetBkColor(0)
GUISetState(@SW_SHOW, $hScreen)
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hScreen)
Global $hColor = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) ; Bright White
;
; ------------------------------------------
; test the functions
_GDIPlus_BrushSetSolidColor($hColor, 0xFFff0000) ; red
plotLine(0, 0, 500, 500)
_GDIPlus_BrushSetSolidColor($hColor, 0xFF00ff00) ; green
plotCircle(250, 250, 200)
_GDIPlus_BrushSetSolidColor($hColor, 0xFFffff00) ; yellow
plotEllipseRect(10, 200, 490, 300)
; MsgBox(0, "Pause", "plotQuadBezierSeg() function still incomplete.")
_GDIPlus_BrushSetSolidColor($hColor, 0xFFffffff) ; white
For $yyy = 0 to 500 Step 50
    _GDIPlus_BrushSetSolidColor($hColor, Random(4278190080, 4294967295, 1)) ; 0xFF000000 to 0xFFffffff
    plotCircle($yyy, 250, 3) ; to show position of control point
    ;            start point ; curve point ; end point
    plotQuadBezierSeg(0, 500, $yyy, 250, 500, 0)
Next
; plotQuadBezierSeg(10, 490, 125, 30, 490, 300)
MsgBox(0, "Pause", "Pause")
; ------------------------------------------
; Line
Func plotLine($x0, $y0, $x1, $y1)
    Local $dx = Abs($x1 - $x0), $sx = $x0 < $x1 ? 1 : - 1
    Local $dy = -Abs($y1 - $y0), $sy = $y0 < $y1 ? 1 : - 1
    Local $err = $dx + $dy, $e2 ; /* error value e_xy */

    While 1 ;  /* loop */
        setPixel($x0, $y0)
        If($x0 = $x1 And $y0 = $y1) Then ExitLoop ; break
        $e2 = 2 * $err
        If($e2 >= $dy) Then ; /* e_xy + e_x > 0 */
            $err += $dy
            $x0 += $sx ; /* x step */
        EndIf
        If($e2 <= $dx) Then ; /* e_xy + e_y < 0 */
            $err += $dx
            $y0 += $sy ; /* y step */
        EndIf
    WEnd

EndFunc   ;==>plotLine

; Circle
Func plotCircle($xm, $ym, $r)
    Local $x = -$r, $y = 0, $err = 2 - 2 * $r ; /* II. Quadrant */
    While($x < 0); Do
        setPixel($xm - $x, $ym + $y); /*   I. Quadrant */
        setPixel($xm - $y, $ym - $x); /*  II. Quadrant */
        setPixel($xm + $x, $ym - $y); /* III. Quadrant */
        setPixel($xm + $y, $ym + $x); /*  IV. Quadrant */
        $r = $err;
        If($r <= $y) Then ;           /* e_xy+e_y < 0 */
            $y += 1
            $err += $y * 2 + 1
        EndIf
        If($r > $x Or $err > $y) Then ; /* e_xy+e_x > 0 or no 2nd y-step */
            $x += 1
            $err += $x * 2 + 1
        EndIf
    WEnd ; While ($x < 0);
EndFunc   ;==>plotCircle

; Ellipse
; This function plots an ellipse inside a specified rectangle.
Func plotEllipseRect($x0, $y0, $x1, $y1)
    Local $a = Abs($x1 - $x0), $b = Abs($y1 - $y0), $b1 = BitAND($b, 1) ;  $b1 = $b & 1; /* values of diameter */
    Local $dx = 4 * (1 - $a) * $b * $b, $dy = 4 * ($b1 + 1) * $a * $a ; /* error increment */
    Local $err = $dx + $dy + $b1 * $a * $a, $e2; /* error of 1.step */

    If($x0 > $x1) Then ; /* if called with swapped points */
        $x0 = $x1
        $x1 += $a
    EndIf
    If($y0 > $y1) Then $y0 = $y1 ; /* .. exchange them */
    $y0 += ($b + 1) / 2
    $y1 = $y0 - $b1 ;   /* starting pixel */
    $a *= 8 * $a;
    $b1 = 8 * $b * $b;

    While($x0 <= $x1) ; do [
        setPixel($x1, $y0); /*   I. Quadrant */
        setPixel($x0, $y0); /*  II. Quadrant */
        setPixel($x0, $y1); /* III. Quadrant */
        setPixel($x1, $y1); /*  IV. Quadrant */
        $e2 = 2 * $err;
        If($e2 <= $dy) Then
            $y0 += 1
            $y1 -= 1
            $dy += $a
            $err += $dy ; += $a; }  /* y step */
        EndIf
        If($e2 >= $dx Or 2 * $err > $dy) Then
            $x0 += 1
            $x1 -= 1
            $dx += $b1
            $err += $dx ; += $b1; } /* x step */
        EndIf
    WEnd ; while ($x0 <= $x1);

    While($y0 - $y1 < $b) ; [  /* too early stop of flat ellipses a=1 */
        setPixel($x0 - 1, $y0); /* -> finish tip of ellipse */

        $y0 += 1
        setPixel($x1 + 1, $y0) ; ++);

        setPixel($x0 - 1, $y1);

        $y1 -= 1
        setPixel($x1 + 1, $y1) ; --);
    WEnd
EndFunc   ;==>plotEllipseRect

; #cs
; Bézier curve
; This function plots a quadratic Bézier curve limited to gradients without sign change.
Func plotQuadBezierSeg($x0, $y0, $x1, $y1, $x2, $y2)

    Local $sx = $x2 - $x1, $sy = $y2 - $y1;
    Local $xx = $x0 - $x1, $yy = $y0 - $y1, $xy;         /* relative values for checks */
    Local $dx, $dy, $err, $cur = $xx * $sy - $yy * $sx;                    /* curvature */

    ; assert($xx * $sx <= 0 && $yy * $sy <= 0) ;  /* sign of gradient must not change */       <--------- ? ? ? ? what's this

    ;If ($sx * (long) $sx + $sy * (long) $sy > $xx * $xx + $yy * $yy) Then ; { /* begin with longer part */
    If($sx * $sx + $sy * $sy > $xx * $xx + $yy * $yy) Then ; { /* begin with longer part */    <--------- (Long) removed
        $x2 = $x0
        $x0 = $sx + $x1
        $y2 = $y0
        $y0 = $sy + $y1
        $cur = -$cur ;  /* swap P0 P2 */
    EndIf ; }
    If($cur <> 0) Then ;{ / * no straight line * /
        $xx += $sx
        ; **************************
        $sx = ($x0 < $x2 ? 1 : - 1)
        $xx *= $sx ; = $x0 < $x2 ? 1 : -1 ;           /* x step direction */

        $yy += $sy

        $sy = ($y0 < $y2 ? 1 : - 1)
        $yy *= $sy ; = $y0 < $y2 ? 1 : -1 ;           /* y step direction */
        ; **************************
        $xy = 2 * $xx * $yy
        $xx *= $xx
        $yy *= $yy ;          /* differences 2nd degree */
        If($cur * $sx * $sy < 0) Then ;{         /* negated curvature? */
            $xx = -$xx
            $yy = -$yy
            $xy = -$xy
            $cur = -$cur
        EndIf ; }
        $dx = 4.0 * $sy * $cur * ($x1 - $x0) + $xx - $xy;             /* differences 1st degree */
        $dy = 4.0 * $sx * $cur * ($y0 - $y1) + $yy - $xy;
        $xx += $xx
        $yy += $yy
        $err = $dx + $dy + $xy;                /* error 1st step */
        While($dy < $dx) ; do {
            setPixel($x0, $y0);                                     /* plot curve */
            ; If ($x0 == $x2 && $y0 == $y2) Then Return;  /* last pixel -> curve finished */
            If($x0 = $x2 And $y0 = $y2) Then Return;  /* last pixel -> curve finished */
            $y1 = 2 * $err < $dx;                  /* save value for test of y step */
            If(2 * $err > $dy) Then
                $x0 += $sx
                $dx -= $xy
                $dy += $yy
                $err += $dy ; += $yy;
            EndIf ; } /* x step */
            If($y1) Then
                $y0 += $sy
                $dy -= $xy
                $dx += $xx
                $err += $dx ; += xx;
            EndIf ; } /* y step */
        WEnd ;} while (dy < dx );           /* gradient negates -> algorithm fails */
    EndIf ; }
    plotLine($x0, $y0, $x2, $y2);               /* plot remaining part to end */
EndFunc   ;==>plotQuadBezierSeg
; #ce

Func setPixel($x0, $y0); it draws a single pixel
    _GDIPlus_GraphicsFillRect($hGraphics, _
            $x0, _ ;  Horizontal pixel position
            $y0, _ ;  Vertical pixel position
            1, 1, _ ; pixel is a 1x1 square
            $hColor)
EndFunc   ;==>setPixel

Func _Terminate()
    ; Clean up resources
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BrushDispose($hColor)
    _GDIPlus_Shutdown()
    Exit
EndFunc   ;==>_Terminate

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

2 hours ago, trancexx said:

assert is just something that the programmer asserts. You can simply remove lines with asserts.

ok, thanks trancexx for this info, ... so it's very easy to translate... :)
very well, so I've already finished my translation.
Thank you all.

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...