Verfasst: 17.02.2008 02:03
meine kleine Spielerei, ich nenn es mal 70er Jahre Hippie-Tapete
Code: Alles auswählen
;/ Folker Linstedt
;/ 2008-02-16
;/ PureBaic Textur-Contest
EnableExplicit
#TextureWidth=128 ; Möglich 32, 64, 128, 256, 512
CreateImage(0,#TextureWidth,#TextureWidth)
CreateImage(1,1024,1024)
Structure pos
addx.l
addy.l
EndStructure
Procedure ZeichneTextur(u)
Protected NewList Punkte.pos()
;/ Optional
Protected index.l
Protected i, i2, ix,k,f, R, G, B, x.f, y.f, RichtungX.f=1.2, RichtungY.f=0.7
Protected farbe.l,rot.l,gruen.l,blau.l
Protected mompunktx,mompunkty
Protected a.l
ix=ImageWidth(0)
StartDrawing(ImageOutput(0))
For a=0 To ImageWidth(0)/2
For b=0 To ImageHeight(0)/2
rot=(a+30)%(b+1)%255*3
gruen=(b+30)%(a+1)%255*3
blau=(rot%(gruen+1)+gruen%(rot+1))%255*3
Plot(a,b,RGB(rot,gruen,blau))
Plot(ImageWidth(0)-a+1,b,RGB(rot,gruen,blau))
Plot(ImageWidth(0)-a+1,ImageHeight(0)-b+1,RGB(rot,gruen,blau))
Plot(a,ImageHeight(0)-b+1,RGB(rot,gruen,blau))
Next
Next
StopDrawing()
EndProcedure
Procedure ZeichneTexturen()
Protected i, i2, u=1
For i2=0 To ImageHeight(1)/ImageHeight(0)-1
For i=0 To ImageWidth(1)/ImageWidth(0)-1
ZeichneTextur(u)
StartDrawing(ImageOutput(1))
DrawImage(ImageID(0),ImageWidth(0)*i,ImageHeight(0)*i2)
StopDrawing()
u+1
Next
Next
EndProcedure
Procedure createGadgets()
ImageGadget(0,5,5,ImageWidth(0),ImageHeight(0),ImageID(0),#PB_Image_Border)
ScrollAreaGadget(1,GadgetX(0)+GadgetWidth(0)+5,5,WindowWidth(0)-GadgetWidth(0)-15,650,1124,1124,10)
ImageGadget(2,5,5,ImageWidth(1),ImageHeight(1),ImageID(1),#PB_Image_Border)
CloseGadgetList()
EndProcedure
If OpenWindow(0,0,0,1000,700,"FL Bild",#PB_Window_ScreenCentered | #PB_Window_SystemMenu) And CreateGadgetList(WindowID(0))
createGadgets()
ZeichneTextur(1)
ZeichneTexturen()
SetGadgetState(0,ImageID(0))
SetGadgetState(2,ImageID(1))
Define Event.l, Quit, GadgetNr
Repeat
Event=WaitWindowEvent()
If Event=16
Quit=1
ElseIf Event=#PB_Event_Gadget
GadgetNr=EventGadget()
EndIf
Until Quit
EndIf