(09-07-2023, 04:52 PM)dbox Wrote:(09-07-2023, 04:01 PM)bplus Wrote: OK thanks, but it is odd it draws the ellipse once but changes that color to Color value updated in Color statement. Could be an asset as well as a glitch.
I'm not sure I understand where the issue is. I tried to follow the precedent of other drawing commands in QBasic for all of the relevant G2D library drawing commands: if the optional color parameter is left blank it uses the last value set with a Color statement. Is this not the behavior you are seeing? Or, perhaps, not the behavior you were expecting?
Hi @dbox every time I changed Color colorValue2, every ellipse drawn using Color colorVlaue1 switched to ColorValue2 as well, without any redraw. You can see it in the pumpkin lines in my last QBJS code link. The Color statement was used to change the light inside eyes, nose, mouth like a candle flicker but the ellipse lines supposed to be and remain black were switching color to same value as the Candle Light Color for eyes, nose and mouth. Update: they were being redrawn, my mistake!
I don't know maybe it was remembering the last Color change and redrawing the ellipse with that color. It wasn't black but I might have misdiagnosed what was happening. Yes I bet! it was using the last color change to redraw the ellipses. OK my bad on that.
But what was wrong with my ellipse code that QBJS couldn't complete the ellipse lines of the pumpkin and I had to resort to G2D.Ellipse in the first place. See old code in banners where I just started drawing the pumpkins. The ellipse lines would not complete along the x axis of ellipse in QBJS.
My ellipse code I tried all kinds of +/- 1 to get it to complete the lines
sample of attempted fix
Code: (Select All)
Sub ellipse (CX As Long, CY As Long, xRadius As Long, yRadius As Long, c As _Unsigned Long)
Dim scale As Single, xs As Single, x As Single, y As Single
Dim lastx As Single, lasty As Single
scale = yRadius / xRadius: xs = xRadius * xRadius
PSet (CX, CY - yRadius), c: PSet (CX, CY + yRadius), c
lastx = 0: lasty = yRadius
For x = 0 To xRadius
y = scale * Sqr(xs - x * x)
$If WEB Then
y = y + 1 ' tried -1 too I think
$End If
Line (CX + lastx, CY - lasty)-(CX + x, CY - y), c
Line (CX + lastx, CY + lasty)-(CX + x, CY + y), c
Line (CX - lastx, CY - lasty)-(CX - x, CY - y), c
Line (CX - lastx, CY + lasty)-(CX - x, CY + y), c
lastx = x: lasty = y
Next
End Sub
b = b + ...