Skip to content
Snippets Groups Projects
Commit 989bc859 authored by alufers's avatar alufers Committed by pippin
Browse files

uctx: Make example of add_stop use floating point numbers

parent 811a9ea5
No related branches found
No related tags found
1 merge request!182uctx: Document add_stop method and add linear_gradient example
Pipeline #7126 passed
...@@ -292,12 +292,12 @@ class Context(Protocol): ...@@ -292,12 +292,12 @@ class Context(Protocol):
This is a simple example rendering a rainbow gradient on the right side of the screen: This is a simple example rendering a rainbow gradient on the right side of the screen:
>>> ctx.linear_gradient(0.18*120,0.5*120,0.95*120,0.5*120) >>> ctx.linear_gradient(0.18*120,0.5*120,0.95*120,0.5*120)
>>> ctx.add_stop(0.0, [255,0,0], 1.0) >>> ctx.add_stop(0.0, [1.0,0.0,0.0], 1.0)
>>> ctx.add_stop(0.2, [255,255,0], 1.0) >>> ctx.add_stop(0.2, [1.0,1.0,0.0], 1.0)
>>> ctx.add_stop(0.4, [0,255,0], 1.0) >>> ctx.add_stop(0.4, [0.0,1.0,0.0], 1.0)
>>> ctx.add_stop(0.6, [0,255,255], 1.0) >>> ctx.add_stop(0.6, [0.0,1.0,1.0], 1.0)
>>> ctx.add_stop(0.8, [0,0,255], 1.0) >>> ctx.add_stop(0.8, [0.0,0.0,1.0], 1.0)
>>> ctx.add_stop(1.0, [255,0,255], 1.0) >>> ctx.add_stop(1.0, [1.0,0.0,1.0], 1.0)
>>> ctx.rectangle(-120, -120, 240, 240) >>> ctx.rectangle(-120, -120, 240, 240)
>>> ctx.fill() >>> ctx.fill()
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment