add the ability to pass a bitmap directly for the splash screen

original commit: d381c7b40b58c6ea4d9fa7bf1d507a661ed91358
This commit is contained in:
Robby Findler 2011-11-28 14:25:15 -06:00
parent c0ffac2972
commit f25948153a
2 changed files with 18 additions and 7 deletions

View File

@ -123,7 +123,9 @@
;; the function bound to the variable should only be called on the splash-eventspace main thread
(define (splash-paint-callback dc)
(if splash-bitmap
(send dc draw-bitmap splash-bitmap 0 0)
(begin
(send dc clear)
(send dc draw-bitmap splash-bitmap 0 0))
(send dc clear)))
(define (splash-event-callback evt) (void))
@ -163,6 +165,10 @@
(send splash-tlw set-icon large (send large get-loaded-mask) 'large))
(send splash-tlw set-icon frame-icon (send frame-icon get-loaded-mask) 'both)))
(cond
[(or (path? splash-draw-spec)
(string? splash-draw-spec)
(is-a? splash-draw-spec bitmap%))
(cond
[(or (path? splash-draw-spec)
(string? splash-draw-spec))
@ -170,7 +176,10 @@
(fprintf (current-error-port) "WARNING: bitmap path ~s not found\n" splash-draw-spec)
(no-splash))
(set! splash-bitmap (make-object bitmap% splash-draw-spec))
(set! splash-bitmap (make-object bitmap% splash-draw-spec))]
[else
(set! splash-bitmap splash-draw-spec)])
(unless (send splash-bitmap ok?)
(fprintf (current-error-port) "WARNING: bad bitmap ~s\n" splash-draw-spec)
(no-splash))

View File

@ -13,6 +13,7 @@ that counts how many files are loaded (until @racket[shutdown-splash] is called)
that number to control the gauge along the bottom of the splash screen.
@defproc[(start-splash [draw-spec (or/c path-string?
(is-a?/c bitmap%)
(vector/c (or/c (-> (is-a?/c dc<%>) void?)
(-> (is-a?/c dc<%>)
exact-nonnegative-integer?
@ -49,7 +50,8 @@ that number to control the gauge along the bottom of the splash screen.
is reset based on the number of files that were loaded that time.
If the @racket[draw-spec] is a @racket[path-string?], then the path is expected to be a file
that contains a bitmap that is drawn as the contents of the splash screen. If @racket[draw-spec]
that contains a bitmap that is drawn as the contents of the splash screen. If it is
a bitmap, then that bitmap is used directly. If @racket[draw-spec]
is a vector, then the vector's first element is a procedure that is called to draw
the splash screen and the other two integers are the size of the splash screen, width followed by height.
If the procedure accepts only one argument, then it is called with a @racket[dc<%>] object where the