You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/ptest/test2.rkt

76 lines
1.5 KiB
Racket

#lang racket/base
(require pitfall/pdftest)
8 years ago
(define (proc doc)
;; curved path as bezier
6 years ago
[move-to doc 0 20]
[line-to doc 100 160]
[quadratic-curve-to doc 130 200 150 120]
[bezier-curve-to doc 190 -40 200 200 300 150]
[line-to doc 400 90]
[stroke doc]
8 years ago
6 years ago
[translate doc 0 200]
8 years ago
;; triangle
6 years ago
[polygon doc '(100 0) '(50 100) '(150 100)]
[stroke doc]
8 years ago
;; dashed circle
6 years ago
[save doc]
[translate doc 200 0]
[circle doc 100 50 50]
[dash doc 5 (hash 'space 10)]
[stroke doc]
[restore doc]
8 years ago
;; filled circle
6 years ago
[save doc]
[translate doc 400 0]
[circle doc 100 50 50]
[line-width doc 3]
[fill-opacity doc 0.8]
[fill-and-stroke doc "red" "#900"]
[restore doc]
8 years ago
6 years ago
[translate doc 0 200]
8 years ago
;; these examples are easier to see with a large line width
6 years ago
[line-width doc 25]
8 years ago
;; line cap settings
6 years ago
[line-cap doc 'butt]
[move-to doc 50 20]
[line-to doc 100 20]
[stroke doc]
[line-cap doc 'round]
[move-to doc 150 20]
[line-to doc 200 20]
[stroke doc]
8 years ago
;; square line cap shown with a circle instead of a line so you can see it
6 years ago
[line-cap doc 'square]
[move-to doc 250 20]
[circle doc 275 30 15]
[stroke doc]
8 years ago
;; line join settings
6 years ago
[line-join doc 'miter]
[rect doc 50 100 50 50]
[stroke doc]
[line-join doc 'round]
[rect doc 150 100 50 50]
[stroke doc]
[line-join doc 'bevel]
[rect doc 250 100 50 50]
[stroke doc])
8 years ago
(define-runtime-path this "test2rkt.pdf")
(make-doc this #f proc)
(define-runtime-path that "test2crkt.pdf")
(make-doc that #t proc)