Coolified clock-icon, added stopwatch-icon

Updated Performance Report toolbar icon

Updated FrTime loading icon
This commit is contained in:
Neil Toronto 2012-01-20 13:16:42 -07:00
parent 07500b27f6
commit 2465b87d84
5 changed files with 125 additions and 69 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -18,7 +18,8 @@
left-magnifying-glass-icon left-magnifying-glass-flomap
bomb-icon bomb-flomap
left-bomb-icon left-bomb-flomap
clock-icon clock-flomap)
clock-icon clock-flomap
stopwatch-icon stopwatch-flomap)
(only-doc-out (all-defined-out)))
(define (flat-regular-polygon-flomap sides start color size)
@ -257,8 +258,8 @@
(define clock-shell-material
(deep-flomap-material-value
'glass 3.0 0.75 0.0
0.5 0.15 1.0
'glass 1.5 0.75 0.0
0.15 0.05 1.0
0.1 0.1 0.6
0.0))
@ -266,63 +267,111 @@
[face-color (or/c string? (is-a?/c color%)) light-metal-icon-color]
[hand-color (or/c string? (is-a?/c color%)) "firebrick"]
[hours (integer-in 0 11) 1]
[minutes (real-in 0 60) 33]) flomap?
[minutes (real-in 0 60) 47]) flomap?
(make-cached-flomap
[height face-color hand-color hours minutes]
(define R 12)
(define hour-θ (* (+ (- hours 3) (/ minutes 60)) (/ (* 2 pi) 12)))
(define minute-θ (* (- minutes 15) (/ (* 2 pi) 60)))
(define 60-degrees (* 60 (/ (* 2 pi) 180)))
(define scale (/ height 32))
(define face-fm
(draw-icon-flomap
32 32 (λ (dc)
;; face
(set-icon-pen dc (icon-color->outline-color face-color) 1 'solid)
(send dc set-brush face-color 'solid)
(draw-ellipse/smoothed dc 0 0 32 32)
;; ticks
(define R 12.5)
(define hour-θ (* (+ (- hours 3) (/ minutes 60)) (/ (* 2 pi) 12)))
(define minute-θ (* (- minutes 15) (/ (* 2 pi) 60)))
(define scale (/ height 32))
(define face-fm
(flomap-cc-superimpose
;; face and ticks
(draw-icon-flomap
32 32 (λ (dc)
(set-icon-pen dc (icon-color->outline-color (icon-color->outline-color face-color))
1 'solid)
(send dc set-brush face-color 'solid)
(draw-ellipse/smoothed dc 0 0 32 32)
(set-icon-pen dc "black" 1 'solid)
(for ([i (in-range 60)]
[r (in-cycle (list 1.5 .5 .5 .5 .5
1.0 .5 .5 .5 .5
1.0 .5 .5 .5 .5))]
[t (in-cycle (list 1.0 .25 .25 .25 .25
.75 .25 .25 .25 .25
.75 .25 .25 .25 .25))])
(define θ (* i (* 1/30 pi)))
(set-icon-pen dc "black" t 'solid)
(send dc draw-line
(+ 15.5 (* (- R r) (cos θ)))
(+ 15.5 (* (- R r) (sin θ)))
(+ 15.5 (* R (cos θ)))
(+ 15.5 (* R (sin θ))))))
scale)
;; lambda logo
(fm* 0.33 (lambda-flomap face-color (* 1/2 height) glass-icon-material))
;; minute hand
(draw-rendered-icon-flomap
32 32 (λ (dc)
(set-icon-pen dc (icon-color->outline-color hand-color) 1/2 'solid)
(send dc set-brush hand-color 'solid)
(send dc draw-polygon
(list (cons (+ 15.5 (* R (cos minute-θ)))
(+ 15.5 (* R (sin minute-θ))))
(cons (+ 15.5 (* 1 (cos (+ minute-θ (* 1/2 pi)))))
(+ 15.5 (* 1 (sin (+ minute-θ (* 1/2 pi))))))
(cons (+ 15.5 (* 1 (cos (+ minute-θ pi))))
(+ 15.5 (* 1 (sin (+ minute-θ pi)))))
(cons (+ 15.5 (* 1 (cos (+ minute-θ (* 3/2 pi)))))
(+ 15.5 (* 1 (sin (+ minute-θ (* 3/2 pi)))))))))
scale
metal-icon-material)
;; hour hand
(draw-rendered-icon-flomap
32 32 (λ (dc)
(set-icon-pen dc (icon-color->outline-color hand-color) 1/2 'solid)
(send dc set-brush hand-color 'solid)
(send dc draw-polygon
(list (cons (+ 15.5 (* (- R 5) (cos hour-θ)))
(+ 15.5 (* (- R 5) (sin hour-θ))))
(cons (+ 15.5 (* 1.25 (cos (+ hour-θ (* 1/2 pi)))))
(+ 15.5 (* 1.25 (sin (+ hour-θ (* 1/2 pi))))))
(cons (+ 15.5 (* 1.25 (cos (+ hour-θ pi))))
(+ 15.5 (* 1.25 (sin (+ hour-θ pi)))))
(cons (+ 15.5 (* 1.25 (cos (+ hour-θ (* 3/2 pi)))))
(+ 15.5 (* 1.25 (sin (+ hour-θ (* 3/2 pi)))))))))
scale
metal-icon-material)))
(define shell-fm
(draw-icon-flomap
32 32 (λ (dc)
(set-icon-pen dc "white" 1 'solid)
(send dc set-brush "white" 'solid)
(draw-ellipse/smoothed dc 1 1 30 30))
scale))
(let* ([dfm (flomap->deep-flomap shell-fm)]
[dfm (deep-flomap-bulge-spheroid dfm (* 9 scale))]
[dfm (deep-flomap-raise dfm (* -2 scale))]
[dfm (deep-flomap-smooth-z dfm (* 1/3 scale))])
(flomap-cc-superimpose
face-fm
(deep-flomap-render-icon dfm clock-shell-material face-fm)))))
(defproc (stopwatch-flomap [height (and/c rational? (>=/c 0)) (default-icon-height)]
[face-color (or/c string? (is-a?/c color%)) light-metal-icon-color]
[hand-color (or/c string? (is-a?/c color%)) "firebrick"]
[hours (integer-in 0 11) 0]
[minutes (real-in 0 60) 47]) flomap?
(make-cached-flomap
[height face-color hand-color hours minutes]
(define clock-fm (clock-flomap (* 30/32 height) face-color hand-color hours minutes))
(define buttons-fm
(draw-rendered-icon-flomap
32 8 (λ (dc)
(set-icon-pen dc (make-object color% 128 0 0) 1 'solid)
(send dc set-brush (make-object color% 144 0 0) 'solid)
(send dc draw-polygon '((2 . 4) (4 . 2) (31 . 31)))
(send dc draw-polygon '((0 . 5) (5 . 0) (6 . 1) (1 . 6)))
(set-icon-pen dc "black" 1 'solid)
(for ([θ (in-range 0 (* 2 pi) (* 1/6 pi))]
[i (in-cycle (in-range 0 3))])
(define r (if (= i 0) 2 1))
(send dc draw-line
(+ 15.5 (* (- R r) (cos θ)))
(+ 15.5 (* (- R r) (sin θ)))
(+ 15.5 (* R (cos θ)))
(+ 15.5 (* R (sin θ)))))
(set-icon-pen dc (icon-color->outline-color hand-color) 1/2 'solid)
(send dc set-brush hand-color 'solid)
;; minute hand
(send dc draw-polygon
(list (cons (+ 15.5 (* R (cos minute-θ)))
(+ 15.5 (* R (sin minute-θ))))
(cons (+ 15.5 (* 1.5 (cos (+ minute-θ 60-degrees))))
(+ 15.5 (* 1.5 (sin (+ minute-θ 60-degrees)))))
(cons (+ 15.5 (* 1.5 (cos (- minute-θ 60-degrees))))
(+ 15.5 (* 1.5 (sin (- minute-θ 60-degrees)))))))
;; hour hand
(send dc draw-polygon
(list (cons (+ 15.5 (* (- R 4) (cos hour-θ)))
(+ 15.5 (* (- R 4) (sin hour-θ))))
(cons (+ 15.5 (* 1.5 (cos (+ hour-θ 60-degrees))))
(+ 15.5 (* 1.5 (sin (+ hour-θ 60-degrees)))))
(cons (+ 15.5 (* 1.5 (cos (- hour-θ 60-degrees))))
(+ 15.5 (* 1.5 (sin (- hour-θ 60-degrees))))))))
scale))
(define shell-fm
(draw-icon-flomap
32 32 (λ (dc)
(set-icon-pen dc (icon-color->outline-color "white") 1 'solid)
(send dc set-brush "white" 'solid)
(draw-ellipse/smoothed dc 0 0 32 32))
scale))
(let* ([dfm (flomap->deep-flomap shell-fm)]
[dfm (deep-flomap-bulge-spheroid dfm (* 8 scale))])
(deep-flomap-render-icon dfm clock-shell-material face-fm))))
(send dc set-brush (make-object color% 16 16 16) 'solid)
(send dc draw-polygon '((28.5 . 5.5) (25.5 . 2.5) (0 . 31)))
(send dc draw-polygon '((31 . 5) (26 . 0) (24.5 . 1.5) (29.5 . 6.5))))
(/ height 32)
metal-icon-material))
(flomap-pin* 1/2 0 1/2 -2/32 buttons-fm clock-fm)))
;; ===================================================================================================
;; Bitmaps (icons)
@ -335,12 +384,14 @@
) (is-a?/c bitmap%)
(flomap->bitmap (regular-polygon-flomap sides start color height material)))
(defproc (clock-icon [height (and/c rational? (>=/c 0)) (default-icon-height)]
[face-color (or/c string? (is-a?/c color%)) light-metal-icon-color]
[hand-color (or/c string? (is-a?/c color%)) "firebrick"]
[hours (integer-in 0 11) 1]
[minutes (real-in 0 60) 33]) (is-a?/c bitmap%)
(flomap->bitmap (clock-flomap height face-color hand-color hours minutes)))
(define-icon-wrappers
([height (and/c rational? (>=/c 0)) (default-icon-height)]
[face-color (or/c string? (is-a?/c color%)) light-metal-icon-color]
[hand-color (or/c string? (is-a?/c color%)) "firebrick"]
[hours (integer-in 0 11) 0]
[minutes (real-in 0 60) 47])
[clock-icon clock-flomap]
[stopwatch-icon stopwatch-flomap])
(define-icon-wrappers
([color (or/c string? (is-a?/c color%))]

View File

@ -393,10 +393,14 @@ Equivalent to @racket[(regular-polygon-icon 8 (/ (* 2 pi) 16) color height mater
@doc-apply[clock-icon]{
@examples[#:eval icons-eval
(clock-icon 48)
(clock-icon 96)
(clock-icon 48 "lightblue" "darkblue" 3 21)]
}
@doc-apply[stopwatch-icon]{
@examples[#:eval icons-eval (stopwatch-icon 96)]
}
@;====================================================================================================
@section[#:tag "stickman"]{Stickman Icons}

View File

@ -53,7 +53,8 @@
(λ (color) (magnifying-glass-icon metal-icon-color color))
(λ (color) (left-magnifying-glass-icon metal-icon-color color))
(λ (color) (bomb-icon metal-icon-color color))
(λ (color) (left-bomb-icon metal-icon-color color)))))
(λ (color) (left-bomb-icon metal-icon-color color))
(λ (color) (stopwatch-icon (default-icon-height) color)))))
(define tool-icon-procs
(list check-syntax-icon small-check-syntax-icon

View File

@ -1,7 +1,9 @@
#lang racket/base
(require racket/class racket/port racket/list racket/match
racket/gui/base racket/unit drracket/tool)
racket/gui/base racket/unit drracket/tool
images/compile-time
(for-syntax racket/base images/icons/misc images/icons/style))
(require "report.rkt" "display.rkt")
@ -11,9 +13,7 @@
;; DrRacket tool for reporting missed optimizations in the editor.
(define performance-report-bitmap
(make-object
bitmap%
(collection-file-path "performance-report.png" "icons") 'png/mask))
(compiled-bitmap (stopwatch-icon (toolbar-icon-height))))
;; performance-report-callback : drracket:unit:frame<%> -> void
(define (performance-report-callback drr-frame)