LinearGradient()

语法

LinearGradient(x1, y1, x2, y2)
概要
Sets the drawing gradient to have a linear shape defined by the two points x1,y1 and x2,y2.

参数

x1, y1 The position at which to apply the current background color.
x2, y2 The position at which to apply the current front color.

返回值

无.

Remarks

Additional colors can be added to the gradient with the GradientColor() command.

Note: This command only has an effect with ImageOutput() and CanvasOutput(). The gradient only affects the drawing commands when #PB_2DDrawing_Gradient is set with the DrawingMode() command.

示例

  If OpenWindow(0, 0, 0, 400, 200, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If CreateImage(0, 400, 200) And StartDrawing(ImageOutput(0))
      Box(0, 0, 400, 200, $FFFFFF)
      
      DrawingMode(#PB_2DDrawing_Gradient)      
      BackColor($00FFFF)
      FrontColor($FF0000)
      
      LinearGradient(0, 0, 200, 200)    
      Circle(100, 100, 100)   
      LinearGradient(350, 100, 250, 100)
      Circle(300, 100, 100)
      
      StopDrawing() 
      ImageGadget(0, 0, 0, 400, 200, ImageID(0))
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

参阅

GradientColor(), ResetGradientColors(), CircularGradient(), EllipticalGradient(), BoxedGradient(), ConicalGradient(), CustomGradient(), DrawingMode()

已支持操作系统

所有

<- LineXY() - 2DDrawing Index - OutputDepth() ->