LinearGradient in PB4.4

Everything else that doesn't fall into one of the other PB categories.
User avatar
wichtel
User
User
Posts: 71
Joined: Fri May 02, 2003 11:14 am
Location: Germany
Contact:

LinearGradient in PB4.4

Post 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 
PB 5.40 LTS, W7,8,10 64bit and Mint x64
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: LinearGradient in PB4.4

Post 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 
User avatar
wichtel
User
User
Posts: 71
Joined: Fri May 02, 2003 11:14 am
Location: Germany
Contact:

Re: LinearGradient in PB4.4

Post by wichtel »

Thank you!
Now I understand the notation...
PB 5.40 LTS, W7,8,10 64bit and Mint x64
Post Reply