impose contract on write-animated-gif, Closes PR11358
original commit: 07952e140867be125978e05516ea0fe1591deff8
This commit is contained in:
parent
99bba880ea
commit
c0aee593cc
|
@ -4,10 +4,9 @@
|
|||
scheme/class
|
||||
scheme/list
|
||||
net/gifwrite
|
||||
scheme/contract)
|
||||
racket/contract)
|
||||
|
||||
(provide write-gif
|
||||
write-animated-gif)
|
||||
(provide write-gif)
|
||||
|
||||
(define (force-bm bm) (if (procedure? bm) (bm) bm))
|
||||
|
||||
|
@ -76,6 +75,16 @@
|
|||
(define (write-gif bm filename)
|
||||
(write-gifs (list bm) #f filename #f #f #f))
|
||||
|
||||
(provide/contract
|
||||
[write-animated-gif
|
||||
(->i ((bms (and/c (listof (or/c (is-a?/c bitmap%) (-> (is-a?/c bitmap%)))) pair?))
|
||||
(delay (integer-in 0 4294967295))
|
||||
(filename (or/c path? string?)))
|
||||
(#:one-at-a-time? (one-at-a-time? any/c)
|
||||
#:last-frame-delay (last-frame-delay (or/c (integer-in 0 4294967295) false/c))
|
||||
#:loop? (Loop? (delay) (lambda (x) (and delay #t))))
|
||||
any)])
|
||||
|
||||
(define (write-animated-gif bms delay filename
|
||||
#:one-at-a-time? [one-at-a-time? #f]
|
||||
#:last-frame-delay [last-frame-delay #f]
|
||||
|
|
|
@ -21,8 +21,10 @@ a simple algorithm; see @scheme[quantize]. If the bitmap has a mask
|
|||
bitmap via @method[bitmap% get-loaded-mask], it is used to determine
|
||||
transparent pixels in the generated GIF image.}
|
||||
|
||||
@defproc[(write-animated-gif [bitmaps (listof (or/c (is-a?/c bitmap%)
|
||||
(-> (is-a?/c bitmap%))))]
|
||||
@defproc[(write-animated-gif [bitmaps (and/c
|
||||
(listof (or/c (is-a?/c bitmap%)
|
||||
(-> (is-a?/c bitmap%))))
|
||||
pair?)]
|
||||
[delay-csec (integer-in 0 #xFFFFFFFF)]
|
||||
[filename path-string]
|
||||
[#:loop loop? any/c (and delay-csec #t)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user