bugfix: bug499771

This commit is contained in:
Andreas Rumpf 2010-03-08 20:46:54 +01:00
commit dab64b5c0e
9 changed files with 128 additions and 489 deletions

View file

@ -9,30 +9,30 @@ const width = 500
const height = 500
const outFile = "CairoTest.png"
var surface = Cairo_ImageSurfaceCreate(CAIRO_FORMAT_RGB24, width, height)
var ç = Cairo_Create(surface)
var surface = Cairo.ImageSurfaceCreate(CAIRO.FORMAT_RGB24, width, height)
var ç = Cairo.Create(surface)
ç.Cairo_SetSourceRGB(1, 1, 1)
ç.Cairo_Paint()
ç.SetSourceRGB(1, 1, 1)
ç.Paint()
ç.Cairo_SetLineWidth(10)
ç.Cairo_SetLineCap(CAIRO_LINE_CAP_ROUND)
ç.SetLineWidth(10)
ç.SetLineCap(CAIRO.LINE_CAP_ROUND)
const count = 12
var winc = width / count
var hinc = width / count
for i in 1 .. count-1:
var amount = i / count
ç.Cairo_SetSourceRGB(0, 1 - amount, amount)
ç.Cairo_MoveTo(i * winc, hinc)
ç.Cairo_LineTo(width - i * winc, height - hinc)
ç.Cairo_Stroke()
ç.SetSourceRGB(0, 1 - amount, amount)
ç.MoveTo(i * winc, hinc)
ç.LineTo(width - i * winc, height - hinc)
ç.Stroke()
ç.Cairo_SetSourceRGB(1 - amount, 0, amount)
ç.Cairo_MoveTo(winc, i * hinc)
ç.Cairo_LineTo(width - winc, height - i * hinc)
ç.Cairo_Stroke()
ç.SetSourceRGB(1 - amount, 0, amount)
ç.MoveTo(winc, i * hinc)
ç.LineTo(width - winc, height - i * hinc)
ç.Stroke()
echo(surface.Cairo_SurfaceWriteToPNG(outFile))
surface.Cairo_SurfaceDestroy()
echo(surface.WriteToPNG(outFile))
surface.Destroy()

View file

@ -8,6 +8,7 @@ tbind1.nim;3
tbind3.nim;1
tbintre2.nim;halloworld99110223
tbintree.nim;halloworld99110223
tbug499771.nim;TSubRange: 5 from 1 to 10
tbug511622.nim;10
tcasestm.nim;ayyy
tclosure.nim;2 4 6 8 10

1 tack.nim 125
8 tbind3.nim 1
9 tbintre2.nim halloworld99110223
10 tbintree.nim halloworld99110223
11 tbug499771.nim TSubRange: 5 from 1 to 10
12 tbug511622.nim 10
13 tcasestm.nim ayyy
14 tclosure.nim 2 4 6 8 10

View file

@ -0,0 +1,6 @@
type TSubRange = range[1 .. 10]
var sr: TSubRange = 5
echo("TSubRange: " & $sr & " from " & $low(TSubRange) & " to " &
$high(TSubRange))