support for cache-image
svn: r5395
This commit is contained in:
parent
298db5ef07
commit
ca93f4e358
30
collects/mred/wxme/cache-image.ss
Normal file
30
collects/mred/wxme/cache-image.ss
Normal file
|
@ -0,0 +1,30 @@
|
|||
|
||||
(module cache-image mzscheme
|
||||
(require (lib "class.ss"))
|
||||
|
||||
(provide reader
|
||||
(struct cache-image (argb width height pin-x pin-y)))
|
||||
|
||||
(define-struct cache-image (argb width height pin-x pin-y))
|
||||
|
||||
(define reader
|
||||
(new
|
||||
(class object%
|
||||
(define/public (read-header vers stream)
|
||||
(void))
|
||||
(define/public (read-snip text? cvers stream)
|
||||
(let ([content (send stream read-bytes "content")])
|
||||
(if text?
|
||||
#"."
|
||||
(let ([l (read (open-input-bytes content))])
|
||||
(make-cache-image (car l)
|
||||
(cadr l)
|
||||
(/ (vector-length (car l)) (cadr l) 4)
|
||||
(caddr l)
|
||||
(cadddr l))))))
|
||||
(super-new)))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -14,7 +14,9 @@
|
|||
[decimal-prefix (send stream read-bytes "decimal prefix")]
|
||||
[fraction-bytes (send stream read-bytes "fraction")]
|
||||
[expansions (send stream read-bytes "expansions")])
|
||||
number))
|
||||
(if text?
|
||||
number
|
||||
(lambda (src line col pos) (string->number (bytes->string/latin-1 number))))))
|
||||
(super-new)))))
|
||||
|
||||
|
||||
|
|
|
@ -36,4 +36,4 @@
|
|||
|
||||
(register-lib-mapping!
|
||||
"(lib \"cache-image-snip.ss\" \"mrlib\")"
|
||||
"(lib \"image.ss\" \"mred\" \"wxme\")"))
|
||||
"(lib \"cache-image.ss\" \"mred\" \"wxme\")"))
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
(module wxmefile mzscheme
|
||||
(require "wxme/wxme.ss")
|
||||
(provide (all-from-except "wxme/wxme.ss"
|
||||
wxme:read
|
||||
wxme:read-syntax)))
|
Loading…
Reference in New Issue
Block a user