racket / pict

Other
15 stars 20 forks source link

Add overview/guide to the docs #58

Open florence opened 4 years ago

florence commented 4 years ago

Facilities like dc and 2htdp/image being pict-convertible? are currently hard to discover.

@rfindler suggested that it seems like a good idea to add in a guide like overview of pict, which i imagine mentioning:

Combinator like image drawing Baselines, text, and pict-last and how to use them pict/convert and its implementations in the main distro Using pict with scribble

Ill try to add this soon, and would love suggestion as to what else should go in this guide!

bennn commented 4 years ago

Here's a little shopping bag that uses pin-line: bag

#lang racket

(require pict)

(define w 100)
(define h 160)
(define line-width 5)
(define line-color "brown")
(define turn (* 2 pi))

(define bag
  (filled-rectangle (* w 3/4) (* h 1/2) #:color "chocolate" #:border-color line-color #:border-width line-width))

(define handle-anchor
  (blank (* w 1/2) 0))

(pin-line
  (cc-superimpose
    (filled-rectangle w h #:color "white" #:draw-border? #f)
    (vc-append handle-anchor bag))
  handle-anchor lt-find
  handle-anchor rt-find
  #:start-angle (* 24/100 turn)
  #:end-angle (* 74/100 turn)
  #:start-pull 1/2
  #:end-pull 1/2
  #:line-width line-width
  #:color line-color)