Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing 20 planets with graphical commands
#7
here is demo adding tilts to the rings using RotoZoom and _PutImage, more advanced graphics commands:
Code: (Select All)
Option _Explicit

_Title "Arc of Ellipse 2 add tilt demo" 'b+ 2021-12-25 tilt added 2026-02-07

Dim sw, sh, img&, x, y, tilt
sw = 600: sh = 600

Screen _NewImage(sw, sh, 32)
_ScreenMove 300, 200

ArcRingOfEllipse sw / 2, sh / 2, 120, 200, _Pi(0), _Pi(1), .25, &HFFAAAAFF
Ring sw / 2, sh / 2, 0, 85, &HFF880088
ArcRingOfEllipse sw / 2, sh / 2, 120, 200, _Pi(1), _Pi(1.999), .25, &HFFAAAAFF

' copy this image into a container
img& = _NewImage(sw, sh, 32) ' screen sized container
_PutImage , 0, img& ' the easiest use of _PutImage!!!
Cls ' disappear screen image
' now RotoZoom image
tilt = 65
For y = 150 To 450 Step 300
    For x = 150 To 450 Step 300
        RotoZoom x, y, img&, .25, tilt
        tilt = tilt + 65
    Next
Next

Sub Ring (cx, cy, innerRadius, outerRadius, colr~&) ' wont work well with alpha's < 255
    Dim r
    For r = innerRadius To outerRadius Step .25
        Circle (cx, cy), r, colr~&
    Next
End Sub

'ra's here go Counter Clockwise from East
Sub ArcRing (cx, cy, innerRadius, outerRadius, raStart, raEnd, colr~&) ' ra's 0 to <2*pi (almost)
    Dim r
    For r = innerRadius To outerRadius Step .25
        Circle (cx, cy), r, colr~&, raStart, raEnd
    Next
End Sub

'ra's here go Counter Clockwise from East
Sub ArcRingOfEllipse (cx, cy, innerRadius, outerRadius, raStart, raEnd, aspect, colr~&) ' ra's 0 to <2*pi (almost)
    Dim r
    For r = innerRadius To outerRadius Step .25
        Circle (cx, cy), r, colr~&, raStart, raEnd, aspect
    Next
End Sub

Sub RotoZoom (X As Long, Y As Long, Image As Long, Scale As Single, degreesRotation As Single)
    Dim px(3) As Single, py(3) As Single, W&, H&, sinr!, cosr!, i&, x2&, y2&
    W& = _Width(Image&): H& = _Height(Image&)
    px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
    px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
    sinr! = Sin(-degreesRotation / 57.2957795131): cosr! = Cos(-degreesRotation / 57.2957795131)
    For i& = 0 To 3
        x2& = (px(i&) * cosr! + sinr! * py(i&)) * Scale + X: y2& = (py(i&) * cosr! - px(i&) * sinr!) * Scale + Y
        px(i&) = x2&: py(i&) = y2&
    Next

    _MapTriangle (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
    _MapTriangle (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
End Sub

   
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
RE: Drawing 20 planets with graphical commands - by bplus - 02-07-2026, 06:56 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  A drawing program Frederick 8 582 02-28-2026, 04:45 PM
Last Post: Frederick
  BallDraw - simple drawing programing using colored balls Dav 2 399 11-11-2025, 08:57 PM
Last Post: Dav
  Improved my small Gradient Ball drawing SUB Dav 22 5,395 07-13-2023, 05:23 PM
Last Post: Dav
  "Slower" Line Drawing Example James D Jarvis 2 1,146 05-13-2023, 03:56 PM
Last Post: James D Jarvis
  Simple drawing that fades to background. Dav 8 1,632 11-05-2022, 03:09 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)