02-26-2023, 12:32 AM
I've got one that works similar to this, that's been in my toolbox forever:
Code: (Select All)
_Define A-Z As _FLOAT
Dim BlendedScreen As Long
ViewScreen = _NewImage(800, 800, 32): Screen ViewScreen
CreateBlendedScreen 'Create a blended screen of colors
Screen BlendedScreen 'Display that screen
Sleep 'Pause so folks can view that screen
'For fun, add some fontage to the screen also
Color &HFF000000, 0 'Black with transparent background
f = _LoadFont("cour.ttf", 48)
If f > 0 Then
_Font f
w = _PrintWidth("Hello World! We love STEVE! He's Sooo AWESOME!")
sw = _Width: sh = _Height
_PrintString ((sw - w) \ 2 + 1, 0), "Hello World! We love STEVE! He's Sooo AWESOME!"
End If
Sleep 'Give the user the time to see our nice screen pattern which we're going to "warp" to our circle.
Screen ViewScreen 'Swap back over to our main screen
CreateCircle 400, 400, 400, 100 'Use that blended screen as reference so we can plot/color our circle in that same pattern
Sleep 'Pause to show the circle before ending the demo
System
Sub CreateCircle (Xcenter, YCenter, radius As Long, width As Long)
Shared BlendedScreen As Long
p = _Pi(2) * radius
tempimage = _NewImage(p, width, 32)
_PutImage , BlendedScreen, tempimage
_Source tempimage
For i = 0 To p - 1 Step .25
For w = 0 To width - 1
ai = 360 / p
a = _D2R(ai * i)
x = Xcenter - Sin(a) * (radius - w)
y = YCenter + Cos(a) * (radius - w)
PSet (x, y), Point(i, w)
Next
Next
_Source 0
_FreeImage tempimage
End Sub
Sub CreateBlendedScreen
Shared BlendedScreen As Long
If Not BlendedScreen Then BlendedScreen = _NewImage(1536, 50, 32) Else Exit Sub
'step from red to green
Dim kolor As _Float, i As _Float
_Dest BlendedScreen
For i = 0 To 255
kolor = kolor + 1
Line (i, 0)-Step(0, 99), _RGB32(255, kolor, 0)
Next
For i = 256 To 511
kolor = kolor - 1
Line (i, 0)-Step(0, 99), _RGB32(kolor, 255, 0)
Next
For i = 512 To 767
kolor = kolor + 1
Line (i, 0)-Step(0, 99), _RGB32(0, 255, kolor)
Next
For i = 768 To 1023
kolor = kolor - 1
Line (i, 0)-Step(0, 99), _RGB32(0, kolor, 255)
Next
For i = 1024 To 1279
kolor = kolor + 1
Line (i, 0)-Step(0, 99), _RGB32(kolor, 0, 255)
Next
For i = 1280 To 1535
kolor = kolor - 1
Line (i, 0)-Step(0, 99), _RGB32(255, 0, kolor)
Next
_Dest ViewScreen
End Sub