images/icons: add close-icon

Also add a `#:thickness` option to `x-icon`.
This commit is contained in:
Matthew Flatt 2014-01-05 15:28:30 -07:00
parent 05d984d7db
commit 2fa6ea76f6
3 changed files with 47 additions and 6 deletions

View File

@ -333,7 +333,8 @@ Returns the universal recycling symbol, rendered as an icon.
Returns an ``x'' icon that is guaranteed to look the same on all platforms.
(Anything similar that would be constructed by @racket[text-icon] would differ at least slightly across platforms.)
@examples[#:eval icons-eval (x-icon #:height 32)]
}
@history[#:changed "1.1" @elem{Added optional @racket[#:thickness] argument.}]}
@doc-apply[check-icon]{
@examples[#:eval icons-eval (check-icon #:height 32)]
@ -434,6 +435,11 @@ The default @racket[start] angle is chosen so that the polygon has a horizontal
#:material glass-icon-material)]
}
@doc-apply[close-icon]{
@examples[#:eval icons-eval
(close-icon #:height 32 #:material glass-icon-material)]
@history[#:added "1.1"]}
@;====================================================================================================
@section[#:tag "stickman"]{Stickman Icons}

View File

@ -12,6 +12,7 @@
regular-polygon-icon regular-polygon-flomap
stop-sign-icon stop-sign-flomap
stop-signs-icon stop-signs-flomap
close-icon close-flomap
foot-icon foot-flomap
magnifying-glass-icon magnifying-glass-flomap
left-magnifying-glass-icon left-magnifying-glass-flomap
@ -77,6 +78,31 @@
(define fm (stop-sign-flomap #:color color #:height (* height 2/3) #:material material))
(flomap-pin* 3/16 1/4 0 0 fm fm fm))
(defproc (close-flomap
[#:color color (or/c string? (is-a?/c color%)) "black"]
[#:height height (and/c rational? (>=/c 0)) (default-icon-height)]
[#:material material deep-flomap-material-value? (default-icon-material)]
) flomap?
(make-cached-flomap
[height color material]
(define scale (/ height 32))
(let* ([indent-fm (fm* 0.5 (flat-x-flomap "black" (* 22 scale) #:thickness 6))]
[indent-dfm (deep-flomap-raise (flomap->deep-flomap indent-fm) (* -1 scale))]
[fm (draw-rendered-icon-flomap
(λ (dc)
(set-icon-pen dc (icon-color->outline-color color) 1 'solid)
(send dc set-brush color 'solid)
(send dc draw-ellipse 0 0 31 31))
32 32 (/ height 32) material)]
[dfm (flomap->deep-flomap fm)]
[dfm (deep-flomap-icon-style dfm)]
[dfm (deep-flomap-cc-superimpose 'add dfm indent-dfm)]
[fm (deep-flomap-render-icon dfm material)])
(flomap-cc-superimpose fm (x-flomap #:color light-metal-icon-color
#:height (* 22 scale)
#:material metal-icon-material
#:thickness 6)))))
(defproc (foot-flomap
[#:color color (or/c string? (is-a?/c color%))]
[#:height height (and/c rational? (>=/c 0)) (default-icon-height)]
@ -597,6 +623,13 @@
[stop-sign-icon stop-sign-flomap]
[stop-signs-icon stop-signs-flomap])
(define-icon-wrappers
([#:color color (or/c string? (is-a?/c color%)) "black"]
[#:height height (and/c rational? (>=/c 0)) (default-icon-height)]
[#:material material deep-flomap-material-value? (default-icon-material)])
(height)
[close-icon close-flomap])
(define-icon-wrappers
([#:color color (or/c string? (is-a?/c color%))]
[#:height height (and/c rational? (>=/c 0)) (default-icon-height)]

View File

@ -17,16 +17,16 @@
hash-quote-icon hash-quote-flomap)
(only-doc-out (all-defined-out)))
(define (flat-x-flomap color height)
(define (flat-x-flomap color height #:thickness [thickness 10])
(define mn 7.5)
(define mx 23.5)
(draw-icon-flomap
(λ (dc)
(send dc set-pen (make-object pen% (icon-color->outline-color color)
12 'solid 'projecting 'miter))
(+ thickness 2) 'solid 'projecting 'miter))
(send dc draw-line mn mn mx mx)
(send dc draw-line mn mx mx mn)
(send dc set-pen (make-object pen% color 10 'solid 'projecting 'miter))
(send dc set-pen (make-object pen% color thickness 'solid 'projecting 'miter))
(send dc draw-line mn mn mx mx)
(send dc draw-line mn mx mx mn))
32 32 (/ height 32)))
@ -149,11 +149,12 @@
(defproc (x-flomap [#:color color (or/c string? (is-a?/c color%)) halt-icon-color]
[#:height height (and/c rational? (>=/c 0)) (default-icon-height)]
[#:material material deep-flomap-material-value? (default-icon-material)]
[#:thickness thickness (and/c rational? (>=/c 0)) 10]
) flomap?
(make-cached-flomap
[height color material]
(define scale (/ height 32))
(let* ([fm (flat-x-flomap color height)]
(let* ([fm (flat-x-flomap color height #:thickness thickness)]
[dfm (flomap->deep-flomap fm)]
[dfm (deep-flomap-icon-style dfm)]
[dfm (deep-flomap-raise dfm (* -8 scale))])
@ -298,7 +299,8 @@
(define-icon-wrappers
([#:color color (or/c string? (is-a?/c color%)) halt-icon-color]
[#:height height (and/c rational? (>=/c 0)) (default-icon-height)]
[#:material material deep-flomap-material-value? (default-icon-material)])
[#:material material deep-flomap-material-value? (default-icon-material)]
[#:thickness thickness (and/c rational? (>=/c 0)) 10])
(height)
[x-icon x-flomap])