-
Notifications
You must be signed in to change notification settings - Fork 1
/
pdfcolor.lisp
32 lines (26 loc) · 1014 Bytes
/
pdfcolor.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(in-package :pdfparse)
(defparameter +literal-device-gray+ (lit "DeviceGray"))
(defparameter +literal-device-rgb+ (lit "DeviceRGB"))
(defparameter +literal-device-cmyk+ (lit "DeviceCMYK"))
(defclass pdf-color-space ()
((name :initarg :name)
(ncomponents :initarg :ncomponents)))
(defun make-pdf-color-space (name ncomponents)
(make-instance 'pdf-color-space :name name :ncomponents ncomponents))
(defmethod print-object ((self pdf-color-space) stream)
(with-slots (name ncomponents) self
(format stream "#<PDF-COLOR-SPACE ~s ncomponents=~d>" name ncomponents)))
(defparameter +predefined-colorspace+
(alist-hash-table
(mapcar (lambda (x)
(cons (car x) (make-pdf-color-space (car x) (cdr x))))
(list
(cons (lit "CalRGB") 3)
(cons (lit "CalGray") 1)
(cons (lit "Lab") 3)
(cons (lit "DeviceRGB") 3)
(cons (lit "DeviceCMYK") 4)
(cons (lit "DeviceGray") 1)
(cons (lit "Separation") 1)
(cons (lit "Indexed") 1)
(cons (lit "Pattern") 1)))))