fixes for builder get() procs and cairo
This commit is contained in:
parent
e84cb1dba9
commit
4c93a26d04
7 changed files with 3212 additions and 267 deletions
25
examples/darea_test.nim
Normal file
25
examples/darea_test.nim
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import gintro/cairo
|
||||
import drawingarea
|
||||
from math import PI
|
||||
|
||||
proc extents(): (float, float, float, float) =
|
||||
(0.0, 0.0, 100.0, 100.0) # ugly float literals
|
||||
|
||||
# draw to cairo context
|
||||
proc draw(cr: cairo.Context) =
|
||||
cr.setSource(1, 1, 1) # set background color and paint
|
||||
cr.paint
|
||||
cr.setSource(0, 0, 0) # forground color
|
||||
cr.arc(20, 30, 10, 0, 5) # nearly a circle
|
||||
cr.newSubPath # do not join the two arcs
|
||||
cr.arc(70, 60, 20, 0, math.PI)
|
||||
cr.stroke # finally do it
|
||||
|
||||
proc main =
|
||||
var data: PDA_Data
|
||||
data.draw = draw
|
||||
data.extents = extents
|
||||
data.windowSize = (800, 600)
|
||||
newDisplay(data)
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue