resume in images
parent
70b121ce12
commit
56e63b5663
@ -0,0 +1,27 @@
|
||||
#lang pitfall/racket
|
||||
(provide PDFImage)
|
||||
|
||||
(define PDFImage
|
||||
(class object%
|
||||
(super-new)
|
||||
|
||||
(as-methods
|
||||
open)))
|
||||
|
||||
|
||||
(define/contract (open this src label)
|
||||
(any/c any/c . ->m . bytes?)
|
||||
(define data (cond
|
||||
[(isBuffer? src) src]
|
||||
;;else if src instanceof ArrayBuffer
|
||||
;;data = new Buffer(new Uint8Array(src))
|
||||
[(regexp-match #rx"^data:.+;base64,(.*)$" src)
|
||||
(void)] ;; base64 ; todo
|
||||
[else (file->bytes src)]))
|
||||
(cond
|
||||
[(equal? (subbytes data 0 2) (bytes #xff #xd8))
|
||||
'doJpeg]
|
||||
[(equal? (subbytes data 0 4) (apply bytes (cons #x89 (map char->integer '(#\P #\N #\G)))))
|
||||
'doPNG]
|
||||
[else (raise-argument-error 'PDFImage-open "valid image format" src)]))
|
||||
|
@ -0,0 +1,21 @@
|
||||
#lang pitfall/racket
|
||||
(require "image.rkt")
|
||||
(provide image-mixin)
|
||||
|
||||
(define (image-mixin [% mixin-tester%])
|
||||
(class %
|
||||
(super-new)
|
||||
#;(field [_opacityRegistry #f]
|
||||
[_opacityCount #f]
|
||||
[_gradCount #f]
|
||||
[_fillColor #f])
|
||||
|
||||
(as-methods
|
||||
)))
|
||||
|
||||
|
||||
#;(define/contract (initColor this)
|
||||
(->m void?)
|
||||
(set-field! _opacityRegistry this (mhash))
|
||||
(set-field! _opacityCount this 0)
|
||||
(set-field! _gradCount this 0))
|
Loading…
Reference in New Issue