~ubuntu-branches/ubuntu/maverick/cairo/maverick

« back to all changes in this revision

Viewing changes to util/cairo-script/examples/dragon.cs

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-06-26 16:13:32 UTC
  • mfrom: (1.3.3 upstream) (1.5.10 experimental)
  • Revision ID: james.westby@ubuntu.com-20100626161332-s14u9kutazlea7c1
Tags: 1.9.10-1
* New upstream development release:
  + Use subpixel rendering settings for fonts (Closes: #555722).
  + debian/patches/99_autoreconf.patch:
    - Regenerated for the new version.
  + debian/patches/01_no-private-symbol-export.patch,
    debian/patches/03_no-cxx.patch,
    debian/patches/05_am-maintainer-mode.patch,
    debian/patches/99_ltmain_as-needed.patch:
    - Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%!CairoScript
 
2
/pot { % n -- n
 
3
  1 sub
 
4
  dup  -1 bitshift or
 
5
  dup  -2 bitshift or
 
6
  dup  -4 bitshift or
 
7
  dup  -8 bitshift or
 
8
  dup -16 bitshift or
 
9
  1 add
 
10
} bind def
 
11
 
 
12
/direction { % i -- bool
 
13
  dup 2 lt { pop true } {
 
14
      dup 1 add dup pot dup 3 -1 roll eq { pop pop true } {
 
15
          2 div 1 sub 2 mul exch sub direction not
 
16
      } ifelse
 
17
  } ifelse
 
18
} bind def
 
19
 
 
20
/path { % cr dx dy -- cr
 
21
  0 1 2048 {
 
22
    4 1 roll 3 copy L pop 4 -1 roll direction {
 
23
      exch neg
 
24
    } {
 
25
      neg exch
 
26
    } ifelse
 
27
  } for
 
28
  pop pop
 
29
} bind def
 
30
 
 
31
dict
 
32
  /width  512 set
 
33
  /height 512 set
 
34
  surface context
 
35
 
 
36
1 g set-source paint
 
37
 
 
38
//LINE_CAP_ROUND set-line-cap
 
39
//LINE_JOIN_ROUND set-line-join
 
40
4 set-line-width
 
41
 
 
42
256 256 m  12 0 path 0 0 0 rgb set-source stroke
 
43
256 256 m -12 0 path 1 0 0 rgb set-source stroke
 
44
256 256 m 0  12 path 0 1 0 rgb set-source stroke
 
45
256 256 m 0 -12 path 0 0 1 rgb set-source stroke
 
46
 
 
47
/target get (out.png) write-to-png pop
 
48
pop