Neon-Effekt
Übersicht

RocysBetreff: Neon-Effekt |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hab heute Abend mal einen kleinen Neon-Effekt programmiert.
Dieser funktioniert am allerdings nur bei Bildern mit schwarzem Hintergrund. Es sieht am besten aus, wenn moeglichst duenne, helle Linien im Bild sind. Der Effekt selbst beginnt ab dem Type, der Rest des Codes ist nur, um es ein bisschen zu demonstrieren. Viel Spass damit. Code: [AUSKLAPPEN] ;Neon-Effekt fuer BlitzBasic ;(c)2008 by Rocys Graphics 1024,768,16,2 SetBuffer BackBuffer() SeedRnd MilliSecs() Global test_image=CreateImage(200,400,5) For i=0 To 4 x=255 Color Rand(0,255),Rand(0,255),Rand(0,255) SetBuffer ImageBuffer(test_image,i) Line 0,0,200,400 Line 0,200,200,0 Rect 60,120,60,120,0 Rect 60,120,10,20,1 Oval 100-i*20,200-i*40,i*40,i*80,0 Text 0,100,"RANDOM NUMBER: "+Rand(100000,999999) For j=0 To 300 Step 30 Line 0,j+Rand(-30,30),j+Rand(-30,30),0 Next Next SetBuffer BackBuffer() For i=0 To 4 DrawImage test_image,i*200,0,i neon(test_image,i) Next For i=0 To 4 DrawImage test_image,i*200,400,i Next Flip WaitKey() End ;hier beginnt der Neon-Effekt Type glow ;zeigt dem Programm, welche Pixel als naechstes eingezeichnet werden Field x Field y Field col Field draw End Type Dim glowed(63,63);wurde dieser Pixel schon mit dem Neon-Effekt belegt? Function neon(image,frame) SetBuffer ImageBuffer(image,frame) maxx=ImageWidth(image)-1 maxy=ImageHeight(image)-1 Dim glowed(maxx,maxy) LockBuffer ImageBuffer(image,frame) ;jeder Pixel wird getestet. Wenn er gesetzt ist, wird er deutlich heller und weisser gemalt For x=0 To maxx For y=0 To maxy farbe=ReadPixelFast(x,y) rot=((farbe And $FF0000)/$10000)*3+150 If rot>255 Then rot=255 gruen=((farbe And $FF00)/$100)*3+150 If gruen>255 Then gruen=255 blau=(farbe And $FF)*3+150 If blau>255 Then blau=255 farbe2=rot*$10000+gruen*$100+blau If farbe<>$FF000000 Then WritePixelFast x,y,farbe2 ;Wenn der Pixel nicht ganz am Rand ist, werden seine Nachbarn auch beruecksichtigt If x>0 And x<maxx And y>0 And y<maxy Then glow.glow=New glow glow\x=x glow\y=y glow\col=farbe End If glowed(x,y)=1 End If If KeyDown(1) Then End Next Next ;jetzt werden alle Pixel, die noch ausstehen gemalt Repeat fertig=1 For glow.glow=Each glow If glow<>Null Then fertig=0 If glow\draw=1 Then WritePixelFast glow\x,glow\y,glow\col ;Farbwerte fuer Nachbarpixel berechnen rot=((glow\col And $FF0000)/$10000)/1.2 gruen=((glow\col And $FF00)/$100)/1.2 blau=(glow\col And $FF)/1.2 ;wenn die Nachbarpixel hell genug sind, werden auch diese gemalt If rot>25 Or blau>25 Or gruen>25 Then If glow\x>0 Then If glowed(glow\x-1,glow\y)=0 Then neu.glow=New glow neu\x=glow\x-1 neu\y=glow\y neu\col=rot*$10000+gruen*$100+blau neu\draw=1 glowed(glow\x-1,glow\y)=1 End If End If If glow\x<maxx Then If glowed(glow\x+1,glow\y)=0 Then neu.glow=New glow neu\x=glow\x+1 neu\y=glow\y neu\col=rot*$10000+gruen*$100+blau neu\draw=1 glowed(glow\x+1,glow\y)=1 End If End If If glow\y>0 Then If glowed(glow\x,glow\y-1)=0 Then neu.glow=New glow neu\x=glow\x neu\y=glow\y-1 neu\col=rot*$10000+gruen*$100+blau neu\draw=1 glowed(glow\x,glow\y-1)=1 End If End If If glow\y<maxy Then If glowed(glow\x,glow\y+1)=0 Then neu.glow=New glow neu\x=glow\x neu\y=glow\y+1 neu\col=rot*$10000+gruen*$100+blau neu\draw=1 glowed(glow\x,glow\y+1)=1 End If End If End If Delete glow Next Until fertig=1 UnlockBuffer ImageBuffer(image,frame) SetBuffer BackBuffer() End Function |
||
![]() |
The Shark |
![]() Antworten mit Zitat ![]() |
---|---|---|
sieht cool aus
ist aber nicht realtimefähig schätz ich mal THE SHARK |
||
Tritium |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich halt das auch nicht für realtimefähig, aber um Bilder nachzubearbeiten, warum nicht. Gefällt mir echt gut! | ||
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Sied cool aus ![]() ich versuch gerade den Code zu begreifen xD |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
gigi |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Erinnert mich an das HDR Rendering Dingens | ||
Anfänger Tut von mir:
http://www.blitzforum.de/forum...hp?t=26185 |
![]() |
Dottakopf |
![]() Antworten mit Zitat ![]() |
---|---|---|
ja gefällt mir auch! Schöne sache ![]() mfg Dottakopf |
||
Rechtschreibfehler gelten der allgemeinen Belustigung! |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group