Page 1 of 1

LinearGradient in PB4.4

Posted: Thu Nov 05, 2009 9:46 pm
by wichtel
When I use LinearGradient in PB 4.4 with a box() command, it only works left to right.
How can I make it work top to bottom?

Code: Select all

CreateImage(0,380,380)
StartDrawing(ImageOutput(0)) 
  DrawingMode(#PB_2DDrawing_Gradient) 
  ResetGradientColors()
  LinearGradient(0,380,380,380)
  GradientColor(0.0,$FF0000)
  GradientColor(0.5,$00FF00)
  GradientColor(1.0,$0000FF)
  Box(0,0,380,380,-1) 
StopDrawing()

OpenWindow(0,0,0,400,400,"test",#PB_Window_ScreenCentered|#PB_Window_TitleBar|#PB_Window_SystemMenu) 
ImageGadget(0,10,10,380,380,ImageID(0))

Repeat 
  EventID=WaitWindowEvent() 
  Select EventID 
  EndSelect 
Until EventID=#PB_Event_CloseWindow 

Re: LinearGradient in PB4.4

Posted: Thu Nov 05, 2009 9:52 pm
by Foz
the y needs to be zero:

Code: Select all

CreateImage(0,380,380)
StartDrawing(ImageOutput(0))
  DrawingMode(#PB_2DDrawing_Gradient)
  ResetGradientColors()
  LinearGradient(380,0,380,380)
  GradientColor(0.0,$FF0000)
  GradientColor(0.5,$00FF00)
  GradientColor(1.0,$0000FF)
  Box(0,0,380,380,-1)
StopDrawing()

OpenWindow(0,0,0,400,400,"test",#PB_Window_ScreenCentered|#PB_Window_TitleBar|#PB_Window_SystemMenu)
ImageGadget(0,10,10,380,380,ImageID(0))

Repeat
  EventID=WaitWindowEvent()
  Select EventID
  EndSelect
Until EventID=#PB_Event_CloseWindow 

Re: LinearGradient in PB4.4

Posted: Thu Nov 05, 2009 10:31 pm
by wichtel
Thank you!
Now I understand the notation...