AA-Kreis
- KeyKon
- Beiträge: 1412
- Registriert: 10.09.2004 20:51
- Computerausstattung: Laptop: i5 2,8 Ghz, 16GB DDR3 RAM, GeForce 555GT 2GB VRAM
PC: i7 4,3 Ghz, 32GB DDR3 RAM, GeForce 680 GTX 4GB VRAM
Win10 x64 Home/Prof
PB 5.30 (64bit) - Wohnort: Ansbach
- Kontaktdaten:
AA-Kreis
Hat zufällig jemand eine Routine parat mit der man einen Kreis weichgezeichnet (Also sozusagen AntiAlaised) erstellen kann, im Codearchiv gibts das ja nur mit Linien...
Edit: Es gibt mir nur um einen Gefüllten Kreis, außerdem muss das ganze nich besonders schnell gehen da nur auf ein Sprite gezeichnet wird...
Edit: Es gibt mir nur um einen Gefüllten Kreis, außerdem muss das ganze nich besonders schnell gehen da nur auf ein Sprite gezeichnet wird...
(\/) (°,,,°) (\/)
Code: Alles auswählen
Procedure ColorMix(Color1, Color2, MixFactor.f=0.50)
Protected R, G, B, InvMixFactor.f
InvMixFactor = 1-MixFactor
R = Red(Color1) * InvMixFactor + Red(Color2) * MixFactor
G = Green(Color1) * InvMixFactor + Green(Color2) * MixFactor
B = Blue(Color1) * InvMixFactor + Blue(Color2) * MixFactor
ProcedureReturn RGB(R,G,B)
EndProcedure
Procedure ClearCircle(x, y, Radius, Color)
Circle(x,y,Radius-1,Color)
For iy = -Radius To Radius
Pixel = #False
For ix = -Radius To 0
r.f = Sqr(ix*ix+ix+iy*iy+iy+0.5)
d.f = r-Radius+0.5
If d < 1 And d > -1
If d < 0 : d = 0 : EndIf
Point = Point(x+ix, y+iy)
PlotColor = ColorMix(Color, Point, d)
Plot(x+ix, y+iy, PlotColor)
Point = Point(x-ix-1, y+iy)
PlotColor = ColorMix(Color, Point, d)
Plot(x-ix-1, y+iy, PlotColor)
Pixel = #True
ElseIf Pixel
Break
EndIf
Next
Next
EndProcedure
CreateImage(0, 768, 256)
StartDrawing(ImageOutput(0))
DrawingMode(1)
For n = 0 To 255
Box(n*3,0,3,256,RGB(n,n,n))
Next
DrawingMode(1)
Restore Color
r = 40
For n = 1 To 8
Read.l Color
ClearCircle(64*n+64,64,r,Color)
Circle(64*n+64,192,r,Color)
Next
StopDrawing()
OpenWindow(0, 0, 0, ImageWidth(0), ImageHeight(0), "Fenster", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ImageGadget(0,0,0,ImageWidth(0), ImageHeight(0), ImageID(0))
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
DataSection
Color:
Data.l $FFFFFF, $FFFF00, $FF0000, $FF00FF, $0000FF, $00FFFF, $00FF00, $000000
EndDataSection
einfach mal n bisschen was ausprobieren ^^
Oben ist AA (hint hintergrund verschmelzung) unten ohne AA
EDIT: Der Code war eigentlich für nicht gefüllte kreise, habe ih nun etwas verändert, sollte ganz gut sein
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
jo dann schreib hier mal
Circle(x,y,Radius-1,Color)
besser das:
Circle(x,y,Radius,Color)
dann gehts
Circle(x,y,Radius-1,Color)
besser das:
Circle(x,y,Radius,Color)
dann gehts
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
okee dann so:
die -1 wieder hin, wie ich es hatte, aber dann muss mehr selber gePlottet werden, deshalt die And d > -2.
Sollte dann gehen ...
Code: Alles auswählen
Procedure ClearCircle(x, y, Radius, Color)
Circle(x,y,Radius-1,Color)
For iy = -Radius To Radius
Pixel = #False
For ix = -Radius To 0
r.f = Sqr(ix*ix+ix+iy*iy+iy+0.5)
d.f = r-Radius+0.5
If d < 1 And d > -2
If d < 0 : d = 0 : EndIf
Point = Point(x+ix, y+iy)
PlotColor = ColorMix(Color, Point, d)
Plot(x+ix, y+iy, PlotColor)
Point = Point(x-ix-1, y+iy)
PlotColor = ColorMix(Color, Point, d)
Plot(x-ix-1, y+iy, PlotColor)
Pixel = #True
ElseIf Pixel
Break
EndIf
Next
Next
EndProcedure
Sollte dann gehen ...
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
- NicTheQuick
- Ein Admin
- Beiträge: 8814
- Registriert: 29.08.2004 20:20
- Computerausstattung: Ryzen 7 5800X, 64 GB DDR4-3200
Ubuntu 24.04.2 LTS
GeForce RTX 3080 Ti - Wohnort: Saarbrücken
