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

80 lines
1.5 KiB
Racket

#lang racket/base
(require pitfall/pdftest)
8 years ago
(define (proc doc)
;; curved path as bezier
(send* doc
[moveTo 0 20]
[lineTo 100 160]
[quadraticCurveTo 130 200 150 120]
[bezierCurveTo 190 -40 200 200 300 150]
[lineTo 400 90]
[stroke])
8 years ago
(send* doc [translate 0 200])
8 years ago
;; triangle
(send* doc
[polygon '(100 0) '(50 100) '(150 100)]
[stroke])
8 years ago
;; dashed circle
(send* doc
[save]
[translate 200 0]
[circle 100 50 50]
[dash 5 (hash 'space 10)]
[stroke]
[restore])
8 years ago
;; filled circle
(send* doc
[save]
[translate 400 0]
[circle 100 50 50]
[lineWidth 3]
6 years ago
[fill-opacity 0.8]
[fillAndStroke "red" "#900"]
[restore])
8 years ago
(send* doc [translate 0 200])
8 years ago
;; these examples are easier to see with a large line width
(send* doc [lineWidth 25])
8 years ago
;; line cap settings
(send* doc [lineCap 'butt]
[moveTo 50 20]
[lineTo 100 20]
[stroke]
[lineCap 'round]
[moveTo 150 20]
[lineTo 200 20]
[stroke])
8 years ago
;; square line cap shown with a circle instead of a line so you can see it
(send* doc [lineCap 'square]
[moveTo 250 20]
[circle 275 30 15]
[stroke])
8 years ago
;; line join settings
(send* doc [lineJoin 'miter]
[rect 50 100 50 50]
[stroke]
[lineJoin 'round]
[rect 150 100 50 50]
[stroke]
[lineJoin 'bevel]
[rect 250 100 50 50]
[stroke]))
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)