Codebase list splix / 970703d
Imported Upstream version 2.0.0 Luca Niccoli 10 years ago
296 changed file(s) with 41368 addition(s) and 12393 deletion(s). Raw diff Collapse all Expand all
0 DEFLOADED := 1
1 _SUBDIRS := src
2 DEFDONE := 1
0 Sun Feb 04 02:45:18 2006 Aurélien Croc <programmation AT ap2c DOT org>
0 Fri Feb 6 03:02:01 2009 Aurélien Croc <programmation AT ap2c DOT org>
1 * Add:
2 - Support for SCX 4500 (by Pablo Mazzini)
3 --- RELEASE OF THE VERSION V. 2.0.0 ---
4
5 Mon Nov 24 01:15:01 2008 Aurélien Croc <programmation AT ap2c DOT org>
6 * Bug correction:
7 Lots of bug corrected since Feb 10th
8 * Add:
9 - Support for printer which use the algorithm 0x0D
10 - Support for printer which use the algorithm 0x0E
11 - Localization of the PPD in brazilian portuguese
12
13 Sun Feb 10 18:25:47 2008 Aurélien Croc <programmation AT ap2c DOT org>
14 * Driver rewritten from scratch
15 * Improvment:
16 - Margin bug solved
17 - Algorithm 0x11 optimized
18 - Black color correction optimized
19 - Color profile used for color printers
20 - New printer options (Altitude...)
21 - New paper size supported (Oficio, Size6, No9Env)
22 - Manual duplex supported
23 - Reversed duplex supported
24 - QPDL V. 5 supported
25 - Driver optimized for multi-core processors
26 * Better PPD translations
27
28 Fri Feb 09 03:39:12 2008 Aurélien Croc <programmation AT ap2c DOT org>
29 * Replace the current SpliX version by the branch 2.0
30
31 Sun Jan 27 23:47:45 2008 Aurélien Croc <programmation AT ap2c DOT org>
32 * Add:
33 The JBIG compression used is or was under patent. A new
34 Makefile rule permits to not compile the JBIG code.
35 --- RELEASE OF THE VERSION V. 1.1.1 ---
36
37 Fri Nov 16 03:08:01 2007 Aurélien Croc <programmation AT ap2c DOT org>
38 * Add:
39 The JBIG compression used by newer printers
40 LOTS of new printer supported
41 * Implement new debugging tools
42 * Rewrite all the PPD files
43 * Reformat the code
44 * Bug fix:
45 Fix the Duplex bug
46 Prevent from loading an old PPD file
47 The code should now compile under IRIX
48 --- RELEASE OF THE VERSION V. 1.1.0 ---
49
50 Fri Oct 19 17:12:28 2007 Aurélien Croc <programmation AT ap2c DOT org>
51 * Bug fix:
52 The X clipping was miss-calculated.
53 --- RELEASE OF THE VERSION V. 1.0.2 ---
54
55 Sat Feb 10 15:18:01 2007 Aurélien Croc <programmation AT ap2c DOT org>
56 * Bug fix:
57 ML-2010 resolution bug is now fixed
58 --- RELEASE OF THE VERSION V. 1.0.1-1 ---
59
60 Sun Feb 04 02:45:18 2007 Aurélien Croc <programmation AT ap2c DOT org>
161 * Add:
262 Support for QPDL v. 0, 1 and 2
363 Duplex support
1474 * Add:
1575 Compression optimization: skip empty bands
1676 Ghostscript correction for black layer (color printers)
77
1778 Sun Nov 26 04:21:15 2006 Aurélien Croc <programmation AT ap2c DOT org>
1879 * Add:
1980 English translation of the SPL-2 documentation
0 # Doxyfile 1.5.4
1
2 #---------------------------------------------------------------------------
3 # Project related configuration options
4 #---------------------------------------------------------------------------
5 DOXYFILE_ENCODING = UTF-8
6 PROJECT_NAME = SpliX
7 PROJECT_NUMBER = 2.0.0
8 OUTPUT_DIRECTORY = doc
9 CREATE_SUBDIRS = NO
10 OUTPUT_LANGUAGE = English
11 BRIEF_MEMBER_DESC = YES
12 REPEAT_BRIEF = YES
13 ABBREVIATE_BRIEF = "The $name class" \
14 "The $name widget" \
15 "The $name file" \
16 is \
17 provides \
18 specifies \
19 contains \
20 represents \
21 a \
22 an \
23 the
24 ALWAYS_DETAILED_SEC = NO
25 INLINE_INHERITED_MEMB = NO
26 FULL_PATH_NAMES = NO
27 STRIP_FROM_PATH = /Applications/
28 STRIP_FROM_INC_PATH =
29 SHORT_NAMES = NO
30 JAVADOC_AUTOBRIEF = NO
31 QT_AUTOBRIEF = NO
32 MULTILINE_CPP_IS_BRIEF = NO
33 DETAILS_AT_TOP = NO
34 INHERIT_DOCS = YES
35 SEPARATE_MEMBER_PAGES = NO
36 TAB_SIZE = 8
37 ALIASES =
38 OPTIMIZE_OUTPUT_FOR_C = NO
39 OPTIMIZE_OUTPUT_JAVA = NO
40 BUILTIN_STL_SUPPORT = NO
41 CPP_CLI_SUPPORT = NO
42 SIP_SUPPORT = NO
43 DISTRIBUTE_GROUP_DOC = NO
44 SUBGROUPING = YES
45 TYPEDEF_HIDES_STRUCT = NO
46 #---------------------------------------------------------------------------
47 # Build related configuration options
48 #---------------------------------------------------------------------------
49 EXTRACT_ALL = NO
50 EXTRACT_PRIVATE = NO
51 EXTRACT_STATIC = NO
52 EXTRACT_LOCAL_CLASSES = YES
53 EXTRACT_LOCAL_METHODS = NO
54 EXTRACT_ANON_NSPACES = NO
55 HIDE_UNDOC_MEMBERS = YES
56 HIDE_UNDOC_CLASSES = YES
57 HIDE_FRIEND_COMPOUNDS = NO
58 HIDE_IN_BODY_DOCS = NO
59 INTERNAL_DOCS = NO
60 CASE_SENSE_NAMES = NO
61 HIDE_SCOPE_NAMES = NO
62 SHOW_INCLUDE_FILES = YES
63 INLINE_INFO = YES
64 SORT_MEMBER_DOCS = YES
65 SORT_BRIEF_DOCS = NO
66 SORT_BY_SCOPE_NAME = NO
67 GENERATE_TODOLIST = YES
68 GENERATE_TESTLIST = YES
69 GENERATE_BUGLIST = YES
70 GENERATE_DEPRECATEDLIST= YES
71 ENABLED_SECTIONS =
72 MAX_INITIALIZER_LINES = 30
73 SHOW_USED_FILES = YES
74 SHOW_DIRECTORIES = NO
75 FILE_VERSION_FILTER =
76 #---------------------------------------------------------------------------
77 # configuration options related to warning and progress messages
78 #---------------------------------------------------------------------------
79 QUIET = NO
80 WARNINGS = YES
81 WARN_IF_UNDOCUMENTED = YES
82 WARN_IF_DOC_ERROR = YES
83 WARN_NO_PARAMDOC = NO
84 WARN_FORMAT = "$file:$line: $text"
85 WARN_LOGFILE =
86 #---------------------------------------------------------------------------
87 # configuration options related to the input files
88 #---------------------------------------------------------------------------
89 INPUT = .
90 INPUT_ENCODING = UTF-8
91 FILE_PATTERNS = *.c \
92 *.cc \
93 *.cxx \
94 *.cpp \
95 *.c++ \
96 *.java \
97 *.ii \
98 *.ixx \
99 *.ipp \
100 *.i++ \
101 *.inl \
102 *.h \
103 *.hh \
104 *.hxx \
105 *.hpp \
106 *.h++ \
107 *.idl \
108 *.odl \
109 *.cs \
110 *.php \
111 *.php3 \
112 *.inc \
113 *.m \
114 *.mm \
115 *.dox \
116 *.py \
117 *.f90
118 RECURSIVE = YES
119 EXCLUDE = .svn
120 EXCLUDE_SYMLINKS = NO
121 EXCLUDE_PATTERNS =
122 EXCLUDE_SYMBOLS =
123 EXAMPLE_PATH =
124 EXAMPLE_PATTERNS = *
125 EXAMPLE_RECURSIVE = NO
126 IMAGE_PATH =
127 INPUT_FILTER =
128 FILTER_PATTERNS =
129 FILTER_SOURCE_FILES = NO
130 #---------------------------------------------------------------------------
131 # configuration options related to source browsing
132 #---------------------------------------------------------------------------
133 SOURCE_BROWSER = YES
134 INLINE_SOURCES = NO
135 STRIP_CODE_COMMENTS = YES
136 REFERENCED_BY_RELATION = NO
137 REFERENCES_RELATION = NO
138 REFERENCES_LINK_SOURCE = YES
139 USE_HTAGS = NO
140 VERBATIM_HEADERS = NO
141 #---------------------------------------------------------------------------
142 # configuration options related to the alphabetical class index
143 #---------------------------------------------------------------------------
144 ALPHABETICAL_INDEX = NO
145 COLS_IN_ALPHA_INDEX = 5
146 IGNORE_PREFIX =
147 #---------------------------------------------------------------------------
148 # configuration options related to the HTML output
149 #---------------------------------------------------------------------------
150 GENERATE_HTML = YES
151 HTML_OUTPUT = html
152 HTML_FILE_EXTENSION = .html
153 HTML_HEADER =
154 HTML_FOOTER =
155 HTML_STYLESHEET =
156 HTML_ALIGN_MEMBERS = YES
157 GENERATE_HTMLHELP = NO
158 HTML_DYNAMIC_SECTIONS = NO
159 CHM_FILE =
160 HHC_LOCATION =
161 GENERATE_CHI = NO
162 BINARY_TOC = NO
163 TOC_EXPAND = NO
164 DISABLE_INDEX = NO
165 ENUM_VALUES_PER_LINE = 4
166 GENERATE_TREEVIEW = NO
167 TREEVIEW_WIDTH = 250
168 #---------------------------------------------------------------------------
169 # configuration options related to the LaTeX output
170 #---------------------------------------------------------------------------
171 GENERATE_LATEX = NO
172 LATEX_OUTPUT = latex
173 LATEX_CMD_NAME = latex
174 MAKEINDEX_CMD_NAME = makeindex
175 COMPACT_LATEX = NO
176 PAPER_TYPE = a4wide
177 EXTRA_PACKAGES =
178 LATEX_HEADER =
179 PDF_HYPERLINKS = NO
180 USE_PDFLATEX = NO
181 LATEX_BATCHMODE = NO
182 LATEX_HIDE_INDICES = NO
183 #---------------------------------------------------------------------------
184 # configuration options related to the RTF output
185 #---------------------------------------------------------------------------
186 GENERATE_RTF = NO
187 RTF_OUTPUT = rtf
188 COMPACT_RTF = NO
189 RTF_HYPERLINKS = NO
190 RTF_STYLESHEET_FILE =
191 RTF_EXTENSIONS_FILE =
192 #---------------------------------------------------------------------------
193 # configuration options related to the man page output
194 #---------------------------------------------------------------------------
195 GENERATE_MAN = YES
196 MAN_OUTPUT = man
197 MAN_EXTENSION = .3
198 MAN_LINKS = NO
199 #---------------------------------------------------------------------------
200 # configuration options related to the XML output
201 #---------------------------------------------------------------------------
202 GENERATE_XML = NO
203 XML_OUTPUT = xml
204 XML_SCHEMA =
205 XML_DTD =
206 XML_PROGRAMLISTING = YES
207 #---------------------------------------------------------------------------
208 # configuration options for the AutoGen Definitions output
209 #---------------------------------------------------------------------------
210 GENERATE_AUTOGEN_DEF = NO
211 #---------------------------------------------------------------------------
212 # configuration options related to the Perl module output
213 #---------------------------------------------------------------------------
214 GENERATE_PERLMOD = NO
215 PERLMOD_LATEX = NO
216 PERLMOD_PRETTY = YES
217 PERLMOD_MAKEVAR_PREFIX =
218 #---------------------------------------------------------------------------
219 # Configuration options related to the preprocessor
220 #---------------------------------------------------------------------------
221 ENABLE_PREPROCESSING = YES
222 MACRO_EXPANSION = NO
223 EXPAND_ONLY_PREDEF = NO
224 SEARCH_INCLUDES = YES
225 INCLUDE_PATH =
226 INCLUDE_FILE_PATTERNS =
227 PREDEFINED =
228 EXPAND_AS_DEFINED =
229 SKIP_FUNCTION_MACROS = YES
230 #---------------------------------------------------------------------------
231 # Configuration::additions related to external references
232 #---------------------------------------------------------------------------
233 TAGFILES =
234 GENERATE_TAGFILE =
235 ALLEXTERNALS = NO
236 EXTERNAL_GROUPS = YES
237 PERL_PATH = /usr/bin/perl
238 #---------------------------------------------------------------------------
239 # Configuration options related to the dot tool
240 #---------------------------------------------------------------------------
241 CLASS_DIAGRAMS = YES
242 MSCGEN_PATH = /Applications/Doxygen.app/Contents/Resources/
243 HIDE_UNDOC_RELATIONS = YES
244 HAVE_DOT = YES
245 CLASS_GRAPH = YES
246 COLLABORATION_GRAPH = YES
247 GROUP_GRAPHS = YES
248 UML_LOOK = NO
249 TEMPLATE_RELATIONS = YES
250 INCLUDE_GRAPH = YES
251 INCLUDED_BY_GRAPH = YES
252 CALL_GRAPH = NO
253 CALLER_GRAPH = NO
254 GRAPHICAL_HIERARCHY = YES
255 DIRECTORY_GRAPH = YES
256 DOT_IMAGE_FORMAT = png
257 DOT_PATH = /Applications/Doxygen.app/Contents/Resources/
258 DOTFILE_DIRS =
259 DOT_GRAPH_MAX_NODES = 50
260 MAX_DOT_GRAPH_DEPTH = 1000
261 DOT_TRANSPARENT = YES
262 DOT_MULTI_TARGETS = YES
263 GENERATE_LEGEND = YES
264 DOT_CLEANUP = YES
265 #---------------------------------------------------------------------------
266 # Configuration::additions related to the search engine
267 #---------------------------------------------------------------------------
268 SEARCHENGINE = NO
00 HOW-TO INSTALL AND USE THIS DRIVER:
11 ===================================
2
3
24
35 Introduction:
46 ------------
57
6 This driver is usable by all printer devices which understand the SPL II
7 language. It covers several _Samsung_ and _Xerox_ printers like the ML-2250
8 which uses it as a native printer language (Check the technical
9 documentation for more information).
8 This driver is usable by all printer devices which understand the QPDL
9 (Quick Page Description Language) language. It covers several _Samsung_,
10 _Xerox_, _Dell_ and _Ricoh_ printers like the ML-2250 which uses it as a native
11 printer language (Check the technical documentation for more information).
12
13
1014
1115 Requested:
1216 ----------
1317
14 To use this driver you need.... a SPL II printer! Last but not least you
15 need CUPS. It has been tested with CUPS V. 1.1.23 and worked fine of course..
18 To use this driver you need.... a QPDL printer! Last but not least you
19 need CUPS. It has been tested with CUPS V. 1.1.23, 1.3.0 and works fine of
20 course..
1621
1722 If you're using a distribution with a real package manager you need to
1823 install the cups developement package (libcups...-devel or something like that).
24 To finish the libjbig is needed if the JBIG algorithm compilation isn't
25 disabled.
26
27 Summary:
28 * CUPS
29 * libcups
30 * libjbig (If the JBIG algorithm compilation isn't disabled)
31
32
1933
2034 Installation:
2135 -------------
2236
23 If you're CUPS installation is not locate in /usr, please edit and
24 update the Makefile.
37 +=======================================================================+
38 | !!! IMPORTANT NOTICE !!! |
39 +=======================================================================+
40 | If you are upgrading your current version, you MUST delete |
41 | your printer in the CUPS interface and install it again. This |
42 | operation MUST be done since CUPS make a copy of the PPD file and |
43 | this file is modified between versions. |
44 +=======================================================================+
2545
26 Then, perform the compilation by doing:
46 Perform the compilation by doing (It is possible to customize some
47 compilation options. Please check at the end of this file):
2748
2849 $ make
2950
3859 browser and add a new printer by selecting the correct printer in the list.
3960
4061 and HAVE FUN ;-)
62
63
64
65 Installation of the color profile for color printers:
66 -----------------------------------------------------
67
68 Color printers needs color profile files to get better results. These
69 files are provided by your printer manufacturer and you have to install them
70 manually. To do that, download the linux official drivers and locate the "cms"
71 directory. Install them with the command:
72
73 # make installcms CMSDIR=/path/to/cms/directory \
74 MANUFACTURER=samsung or xerox or dell
75
76 Samsung color profile files are available at:
77 (Then use MANUFACTURER=samsung)
78
79 http://splix.ap2c.org/samsung_cms.tar.bz2
80
81
82
83 Compilation options:
84 --------------------
85
86 SpliX code can be tuned by using specific make options. All these
87 options are:
88
89 * DISABLE_JBIG=1 [0 by default]:
90 Since some of the JBIG algorithm may patented, this
91 option disable the use of this algorithm. Unfortunatly
92 _JBIG printers_ (such as CLP-600) won't work with SpliX.
93 * DISABLE_THREADS=1 [0 by default]:
94 This option will disable the use of threads in the SpliX
95 code. If it is disabled, _manual duplex_ will no longer
96 work.
97 * DISABLE_BLACKOPTIM=1 [0 by default]:
98 A black correction algorithm is used to optimize the use
99 of black and color toner on color printers. This option
100 will disable the use of this algorithm. Colors of a
101 printed page will be different, more toner may be used
102 and black may not be dark.
103 * THREADS=XX [2 by default]:
104 Specify the number of _compression_ threads to use. Note
105 that compression is a full CPU time job. Specify more
106 than physical CPU core avaiable may be stupid.
107 For instance quad core owners should use THREADS=4.
108 * CACHESIZE=XX [30 by default]:
109 Specify the number of _compressed_ kept into memory
110 waiting for the rendering. This option is important with
111 the use of manual duplex. Note that a standard
112 compressed A4 paper is about 300ko. So 30 pages into
113 memory will use an average of 9Mo of RAM. Other pages
114 are swapped into the disk. A little CACHESIZE value will
115 increase disk access and increase the job rendering time.
116
117 Example:
118
119 $ make DISABLE_JBIG=1 THREADS=4 CACHESIZE=100
120
121 This will disable the use of the JBIG algorithm. Threads and black
122 optimization algorithm will be compiled. Then, manual duplex will be available.
123 The number of compression threads will be 4 and the maximum number of compressed
124 pages which will be kept into the memory will be 100 (with a maximum average of
125 memory of 30Mo)
126
127
128 === PLEASE GIVE THESE OPTIONS TO MAKE AND MAKE INSTALL RULES ===
129
00 #
1 # Makefile (C) 2006, Aurélien Croc (AP²C)
2 #
3 # This project has been placed under the GPL Licence.
4 #
5
6 CXXFLAGS := -O2 `cups-config --cflags`
7 LDFLAGS := `cups-config --ldflags`
8 CUPSFILTER := `cups-config --serverbin`/filter
9 CUPSPPD := `cups-config --datadir`/model
10
11 # === DON'T CHANGE ANYTHING AFTER THIS MESSAGE ====
12
13 export CXXFLAGS LDFLAGS CUPSFILTER CUPSPPD
14
15 all: src ppd
16
17 .PHONY: src ppd
18 src ppd:
19 @$(MAKE) -C $@
1 # Makefile (C) 2006-2008, Aurélien Croc (AP²C)
2 #
3 # This project is under the GPL Licence
4 #
5 # Available MAKE options:
6 # * V sets to 1 for verbose mode
7 #
8 # Available variables in module.mk :
9 # * SUBDIRS
10 # * MODE = {default,debug,optimized}
11 # * CFLAGS
12 # * CXXFLAGS
13 # * LDFLAGS
14 # * DEBUG_CFLAGS
15 # * DEBUG_CXXFLAGS
16 # * OPTIMIZED_CFLAGS
17 # * OPTIMIZED_CXXFLAGS
18 # * TARGETS
19 # * GENERIC_TARGETS
20 # * PRE_GENERIC_TARGETS
21 # * directory1_directory2_file_ext_FLAGS
22 #
23 # Each project must be listed in the TARGETS variable. Next:
24 # * project1_SRC
25 # * project1_LIB
26 # * project1_CFLAGS
27 # * project1_LDFLAGS
28 # * project1_MODULES
29 # * project1_CXXFLAGS
30 # * ...
31 #
32 # This Makefile will generate:
33 # * project1_TARGET
34 # * project1_OBJ
35 #
36 #
37 # In the file rules.mk:
38 #
39 # You can add your own rules
40 #
41 # To add a new target file support, please add the target extension in the
42 # TARGET_RULES variable and define the function targetDefinition_{extension}.
43 # This function will be called with one parameters: the target name
44 # Like the examples above, use $(value $(1)_TARGET) or _OBJ, .. to access
45 # to useful informations
46 #
47 #
48 # /!\ = Please do your modifications in the module.mk file = /!\
49 #
50
51
52 # +--------------------------------------------------------------------------+
53 # | SUPPORTED LANGUAGES, DIRECTORIES ARCHI AND TOOLS LOCATIONS & FLAGS |
54 # +--------------------------------------------------------------------------+
55 LANGUAGES := cpp c
56
57 CC := gcc
58 CXX := g++
59 RM := rm -f
60 AR := ar crs
61 LEX := flex
62 YACC := bison
63 LINKER := $(CXX)
64
65 DEPDIR := .deps
66 BUILDDIR := .build
67 TARGETDIR := .
68
69
70 empty :=
71 space := $(empty) $(empty)
72 comma := ,
73
74 DEBUG_CFLAGS := -O0 -g
75 DEBUG_CXXFLAGS := -O0 -g
76 OPTIM_CFLAGS := -O2
77 OPTIM_CXXFLAGS := -O2
78
79 ARCHI := $(shell uname -s)
80
81 ifeq ($(ARCHI),Darwin)
82 PLUGIN_EXT := bundle
83 LIBRARY_EXT := dylib
84 else
85 PLUGIN_EXT := so
86 LIBRARY_EXT := so
87 endif
88
89
90 # +--------------------------------------------------------------------------+
91 # | DEFINITIONS VARIABLE LOADING |
92 # +--------------------------------------------------------------------------+
93
94 MODE := default
95 DEFFILE := .defs.mk
96 -include $(DEFFILE)
97
98
99
100 # +--------------------------------------------------------------------------+
101 # | SUBDIRS LOADING |
102 # +--------------------------------------------------------------------------+
103
104 include module.mk
105 ifeq ($(DEFLOADED),1)
106 include $(patsubst %, %/module.mk, $(_SUBDIRS))
107 endif # DEFLOADED == 1
108 ifeq ($(DEFDONE),1)
109
110
111
112
113 # +--------------------------------------------------------------------------+
114 # | COMPILATION MODE INITIALIZATION |
115 # +--------------------------------------------------------------------------+
116
117 ifeq ($(MAKECMDGOALS),debug)
118 MODE := debug
119 endif #MAKECMDGOALS == debug
120 ifeq ($(MAKECMDGOALS),optimized)
121 MODE := optimized
122 endif #MAKECMDGOALS == optimized
123 ifeq ($(MAKECMDGOALS),default)
124 MODE := default
125 endif #MAKECMDGOALS == default
126
127 ifeq ($(MODE),debug) # DEBUG
128 CFLAGS += $(DEBUG_CFLAGS)
129 CXXFLAGS += $(DEBUG_CXXFLAGS)
130 BUILDDIR := debug
131 TARGETDIR := debug
132 DEPDIR := debug
133 else
134 ifeq ($(MODE),optimized) # OPTIMIZED
135 CFLAGS += $(OPTIM_CFLAGS)
136 CXXFLAGS += $(OPTIM_CXXFLAGS)
137 BUILDDIR := optimized
138 TARGETDIR := optimized
139 DEPDIR := optimized
140 endif # MODE == optimized
141 endif # MODE == debug
142
143
144
145 # +--------------------------------------------------------------------------+
146 # | VERBOSE MODE AND INITIALIZATION |
147 # +--------------------------------------------------------------------------+
148
149 V :=
150 ifeq ($(V),1)
151 Q :=
152 else
153 Q := @
154 endif
155
156
157
158 # +--------------------------------------------------------------------------+
159 # | MAIN RULES AND TARGETS |
160 # +--------------------------------------------------------------------------+
161
162 _TARGETS := $(foreach target,$(TARGETS),$(TARGETDIR)/$(target))
163 _TARGETS := $(PRE_GENERIC_TARGETS) $(_TARGETS) $(GENERIC_TARGETS)
164
165 all: $(_TARGETS)
166 debug: $(_TARGETS)
167 optimized: $(_TARGETS)
168
169
170
171 # +--------------------------------------------------------------------------+
172 # | MACRO DEFINITIONS |
173 # +--------------------------------------------------------------------------+
174
175 # Function to print smart messages
176 printCmd = $(if $(filter $(V),1),,$(shell echo "@echo \" $(1)\""))
177
178 # Get the target variable name
179 targetName = $(subst .,_,$(subst /,_,$(1)))
180
181 # Specific flags definition
182 flags = $(value $(subst /,_,$(subst .,_,$(1)))_FLAGS)
183 flag = $(subst /,_,$(subst .,_,$(1)))_FLAGS
184
185
186
187 # +--------------------------------------------------------------------------+
188 # | LOAD AND GENERATE DEPENDENCIES FILES |
189 # +--------------------------------------------------------------------------+
190
191 # Get all the source files in ALLSRC
192 ALLSRC := $(foreach target,$(call targetName,$(TARGETS)),$(value \
193 $(target)_SRC))
194
195 # Get the dependencies files
196 DEPENDENCIES := $(foreach lang,$(LANGUAGES),$(patsubst %.$(lang), %.d, \
197 $(filter %.$(lang),$(ALLSRC))))
198
199 # Generate dependencies files for C++ source file
200 $(DEPDIR)/%.d: %.cpp
201 @mkdir -p $(dir $@)
202 @$(CXX) $(CXXFLAGS) -MM -MP -MG -MT "\$$(DEPDIR)/$(basename $<).d \
203 \$$(BUILDDIR)/$(basename $<).o" -MG "$<" -MF $@
204
205 # Load dependencies files
206 -include $(foreach dep,$(DEPENDENCIES),$(DEPDIR)/$(dep))
207
208
209
210 # +--------------------------------------------------------------------------+
211 # | PREVENT LOADING RULES IF DEFFILE IS NOT COMPLET |
212 # +--------------------------------------------------------------------------+
213
214 else
215 TARGETS := $(empty)
216
217 endif # DEFDONE == 1
218
219
220
221 # +--------------------------------------------------------------------------+
222 # | OBJECTS AND TARGETS DEFINITIONS |
223 # +--------------------------------------------------------------------------+
224
225
226 # Define target variables
227 defineTarget = $(call targetName,$(1))_TARGET := $(TARGETDIR)/$(1)
228
229 # Define target object variables
230 define defineObject
231 $(1)_OBJ := $(foreach obj,$(foreach lang,$(LANGUAGES),$(patsubst \
232 %.$(lang),%.o,$(filter %.$(lang),$(value $(1)_SRC)))), \
233 $(BUILDDIR)/$(obj)) \
234 $(foreach module,$(value \
235 $(1)_MODULES),$(TARGETDIR)/$(module)) \
236 $(foreach obj,$(patsubst %.l,%.l.o,$(filter %.l,$(value \
237 $(1)_SRC))),$(BUILDDIR)/$(obj)) \
238 $(foreach obj,$(patsubst %.y,%.yy.o,$(filter %.y,$(value \
239 $(1)_SRC))),$(BUILDDIR)/$(obj))
240 $(1)_CLEAN := $(foreach obj,$(patsubst %.y,%.yy.h,$(filter %.y,$(value \
241 $(1)_SRC))),$(BUILDDIR)/$(obj))
242 endef
243
244 # Create these definitions
245 $(foreach target,$(TARGETS),$(eval $(call defineTarget,$(strip $(target)))) \
246 $(eval $(call defineObject,$(strip $(call targetName,$(target))))))
247
248
249
250 # +--------------------------------------------------------------------------+
251 # | SMART MESSAGE PRINTING |
252 # +--------------------------------------------------------------------------+
253
254
255 # Smart messages
256 cmd_ar_a_o = AR $@
257 cmd_cc_o_c = CC $<
258 cmd_cxx_o_cpp = CXX $<
259 cmd_yacc_h = YACC [H] $<
260 cmd_yacc_cpp = YACC [CPP] $<
261 cmd_lex_cpp = LEX $<
262 cmd_link = LINK $@
263 cmd_ln_so_o = LINK [M] $@
264 cmd_rm_clean = RM *.o
265 cmd_rm_distclean = RM $(_TARGETS) *.d $(DEFFILE)
266
267
268
269 # +--------------------------------------------------------------------------+
270 # | TARGET RULES |
271 # +--------------------------------------------------------------------------+
272
273 TARGET_RULES := a so bundle
274
275 # Archives
276 define targetDefinition_a
277 $(value $(1)_TARGET): $(value $(1)_OBJ)
278 $$(call printCmd, $$(cmd_ar_a_o))
279 $$(Q)$$(AR) $$@ $$^
280 endef
281 -include rules.mk
282
283 # Plugins (for MacOS X)
284 define targetDefinition_bundle
285 $(value $(1)_TARGET): $(value $(1)_OBJ) $(value $(1)_LOADER)
286 $$(call printCmd, $$(cmd_ln_so_o))
287 $$(Q)$$(LINKER) $$(MODULE_FLAGS) $$(LDFLAGS) -o $$@ $$(value $(1)_OBJ) \
288 -bundle -bundle_loader $$(value $(1)_LOADER) \
289 $$(value $(1)_LIBS) $$(value $(1)_FLAGS) $$(LIBS)
290 endef
291
292 # Plugins and libaries (for UNIXes)
293 define targetDefinition_so
294 $(value $(1)_TARGET): $(value $(1)_OBJ)
295 $$(call printCmd, $$(cmd_ln_so_o))
296 $$(Q)$$(LINKER) $$(MODULE_FLAGS) $$(LDFLAGS) -o $$@ $$(value $(1)_OBJ) \
297 -rdynamic -shared $$(value $(1)_LIBS) $$(value $(1)_FLAGS) \
298 $$(LIBS)
299 endef
300
301 rulesTarget := $(foreach rules,$(TARGET_RULES),$(filter \
302 %.$(rules),$(TARGETS)))
303 $(foreach target,$(rulesTarget),$(eval $(call targetDefinition_$(subst \
304 .,,$(suffix $(target))),$(call targetName,$(target)))))
305
306
307
308 # +--------------------------------------------------------------------------+
309 # | COMPILATION RULES |
310 # +--------------------------------------------------------------------------+
311
312 # C Files
313 $(BUILDDIR)/%.o: $(BUILDDIR)/%.c
314 $(call printCmd, $(cmd_cc_o_c))
315 @mkdir -p $(dir $@)
316 $(Q)$(CC) $(CFLAGS) $(call flags,$<) -o $@ -c $<
317 $(BUILDDIR)/%.o: %.c
318 $(call printCmd, $(cmd_cc_o_c))
319 @mkdir -p $(dir $@)
320 $(Q)$(CC) $(CFLAGS) $(call flags,$<) -o $@ -c $<
321
322 # C++ Files
323 $(BUILDDIR)/%.o: $(BUILDDIR)/%.cpp
324 $(call printCmd, $(cmd_cxx_o_cpp))
325 @mkdir -p $(dir $@)
326 $(Q)$(CXX) $(CXXFLAGS) $(call flags,$<) -o $@ -c $<
327 $(BUILDDIR)/%.o: %.cpp
328 $(call printCmd, $(cmd_cxx_o_cpp))
329 @mkdir -p $(dir $@)
330 $(Q)$(CXX) $(CXXFLAGS) $(call flags,$<) -o $@ -c $<
331
332 # Yacc compilation
333 $(BUILDDIR)/%.yy.h: %.y
334 $(call printCmd, $(cmd_yacc_h))
335 @mkdir -p $(dir $@)
336 $(Q)$(YACC) $(call flags,$<) -d -b $(basename $(basename $@)) \
337 -p $(basename $(notdir $<)) $<
338 $(Q)rm $(basename $(basename $@)).tab.c
339 $(Q)mv $(basename $(basename $@)).tab.h $(basename $@).h
340 $(BUILDDIR)/%.yy.cpp: %.y
341 $(call printCmd, $(cmd_yacc_cpp))
342 @mkdir -p $(dir $@)
343 $(Q)$(YACC) $(call flags,$<) -b $(basename $(basename $@)) \
344 -p $(basename $(notdir $<)) -o $@ $<
345
346 # Lex compilation
347 $(BUILDDIR)/%.l.cpp: %.l $(BUILDDIR)/%.yy.h
348 $(call printCmd, $(cmd_lex_cpp))
349 $(Q)$(LEX) $(call flags,$<) -P$(basename $(notdir $<)) -t $< > $@
350
351
352
353 # +--------------------------------------------------------------------------+
354 # | CLEAN RULES |
355 # +--------------------------------------------------------------------------+
20356
21357 .PHONY: clean distclean
22358 clean:
23 @$(MAKE) -C src clean
24 @$(MAKE) -C ppd clean
359 $(call printCmd, $(cmd_rm_clean))
360 $(Q)$(RM) $(foreach target,$(TARGETS),$(value $(call \
361 targetName,$(target))_OBJ) $(value $(target)_CLEAN))
25362
26363 distclean: clean
27 @$(MAKE) -C src distclean
28 @$(MAKE) -C ppd distclean
29
30 .PHONY: install
31 install:
32 @$(MAKE) -C src install
33 @$(MAKE) -C ppd install
34 @echo ""
35 @echo " --- Everything is done! Have fun ---"
36 @echo ""
364 $(call printCmd, $(cmd_rm_distclean))
365 $(Q)$(RM) $(foreach dep,$(DEPENDENCIES),$(DEPDIR)/$(dep))
366 $(Q)$(RM) $(_TARGETS)
367 $(Q)$(RM) $(DEFFILE)
368
369
370
371 # +--------------------------------------------------------------------------+
372 # | GET ALL SUBDIRS TO EXPLORE |
373 # +--------------------------------------------------------------------------+
374
375 # Generate the defs.mk file which contains sub directories
376 $(DEFFILE): Makefile $(patsubst %, %/module.mk, $(SUBDIRS)) module.mk
377 @echo -n " GEN $(DEFFILE)"
378 @echo "" > $@
379 @make -s -C ./ _depsreload
380
381 .PHONY: _depsreload
382 _depsreload:
383 @echo -n "."
384 @echo "DEFLOADED := 1" > $(DEFFILE)
385 @echo "_SUBDIRS := $(SUBDIRS)" >> $(DEFFILE)
386 @if [ "$(SUBDIRS)" != "$(_SUBDIRS)" ]; then make -j 1 -s -C ./ _depsreload; \
387 else echo "DEFDONE := 1" >> $(DEFFILE); echo ""; fi
388
00 A special thanks for Keith White who helped me to debug several points and add
11 the support for asymetric resolution support and translate the SPL2
22 documentation. Thanks again!
3
4 Another thanks to Rick Richardson and its work on the JBIG algorithm also
5 known as algorithm 0x13 and to Leonardo Hirokazu de Souza Hamada and its work on
6 the compression algorithms 0x0D and 0x0E.
7
8 Thank you to Timo Juhani Lindfors who helped me to solve lots of bugs contained
9 in the SpliX 2.0.0 release candidate and to Jindrich Makovicka for the same
10 reason.
11
12 Other thanks to Koji Otani from BBR Inc., Japan. for bug resolution.
13
14 And for the ones who helped me to write the driver files:
15 * Pablo Mazzini (Samsung SCX4500)
00 08-25-2006 Aurélien Croc
1 * Add the duplex support
2 * Add a support for non symetric resolution
3 * Add a support for custom page size
4 * Add other compressin algorithms (0x13 for text!) ?
1 * Add other compressin algorithms (0x12 for text!) ?
52 * Stop sending the job if a SIGTERM is received
3 * Catch for the cancel button pressed
4
5 11-25-2008 Aurélien Croc
6 * Rewrite in another way the compress.cpp for generalization of the
7 runtime compression algorithm modification
8 * Check the qpdl.cpp for a better code
0 /*
1 * algo0x0d.h SpliX is Copyright 2006-2008 by Aurélien Croc
2 * This file is a SpliX derivative work
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * $Id: algo0x0d.h 245 2008-11-24 23:00:43Z ap2c $
19 * --
20 * This code is written by Leonardo Hamada
21 */
22 #ifndef _ALGO0x0D_H_
23 #define _ALGO0x0D_H_
24
25 #include "algorithm.h"
26 #include <inttypes.h>
27
28
29 /**
30 * @brief This class implements the type 0xd encoding.
31 */
32 class Algo0x0D : public Algorithm
33 {
34 protected:
35 inline void writeTwoBytesPacket(
36 unsigned char * output,
37 unsigned long & outputSize,
38 long int accumulatedHorizontalOffsetValue,
39 long int displacementValue,
40 unsigned long accumulatedRunCount );
41
42 inline void writeFourBytesPacket(
43 unsigned char * output,
44 unsigned long & outputSize,
45 long int accumulatedHorizontalOffsetValue,
46 long int displacementValue,
47 unsigned long accumulatedRunCount );
48
49 inline void writeSixBytesPacket(
50 unsigned char * output,
51 unsigned long & outputSize,
52 long int displacementValue,
53 unsigned long accumulatedRunCount );
54
55 inline void selectPacketSize(
56 unsigned char * output,
57 unsigned long & outputSize,
58 unsigned long preAccumulatedHorizontalOffsetValue,
59 unsigned long accumulatedHorizontalOffsetValue,
60 unsigned long currentHorizontalPenPosition,
61 unsigned long pixelsLeftInScanline,
62 unsigned long accumulatedRunCount,
63 unsigned long consecutiveBlankScanLines,
64 unsigned long currentVerticalPenPosition,
65 const unsigned long wrapWidth );
66
67 public:
68 Algo0x0D();
69 virtual ~Algo0x0D();
70
71 public:
72 virtual BandPlane* compress(const Request& request,
73 unsigned char *data, unsigned long width,
74 unsigned long height);
75 virtual bool reverseLineColumn() {return false;}
76 virtual bool inverseByte() {return false;}
77 virtual bool splitIntoBands() {return true;}
78 };
79
80 #endif /* _ALGO0x0D_H_ */
0 /*
1 * algo0x0e.h SpliX is Copyright 2006-2008 by Aurélien Croc
2 * This file is a SpliX derivative work
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * $Id: algo0x0e.h 245 2008-11-24 23:00:43Z ap2c $
19 * --
20 * This code has been written by Leonardo Hamada
21 */
22 #ifndef _ALGO0x0E_H_
23 #define _ALGO0x0E_H_
24
25 #include "algorithm.h"
26 #include <inttypes.h>
27
28 /**
29 * @brief This class implements the type 0xe encoding.
30 */
31 class Algo0x0E : public Algorithm
32 {
33 protected:
34 inline void addLiteralSequence(
35 unsigned char * output,
36 unsigned long & outputSize,
37 unsigned char * data,
38 unsigned long position,
39 unsigned long length,
40 unsigned long blanks );
41 inline void addReplicativeRun(
42 unsigned char * output,
43 unsigned long & outputSize,
44 unsigned long runs,
45 unsigned char value );
46 unsigned long verifyGain(unsigned long e,
47 unsigned long L,
48 unsigned char * data);
49 unsigned long encodeReplications(unsigned long q,
50 unsigned long L,
51 unsigned char * data,
52 unsigned char * output,
53 unsigned long & outputSize);
54 unsigned long locateBackwardReplications(unsigned long L,
55 unsigned char * data);
56
57 public:
58 Algo0x0E();
59 virtual ~Algo0x0E();
60
61 public:
62 virtual BandPlane* compress(const Request& request,
63 unsigned char *data, unsigned long width,
64 unsigned long height);
65 virtual bool reverseLineColumn() {return false;}
66 virtual bool inverseByte() {return true;}
67 virtual bool splitIntoBands() {return true;}
68 };
69
70 #endif /* _ALGO0x0E_H_ */
0 /*
1 * algo0x11.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: algo0x11.h 157 2008-02-09 02:01:24Z ap2c $
18 *
19 */
20 #ifndef _ALGO0X11_H_
21 #define _ALGO0X11_H_
22
23 #include "algorithm.h"
24 #include <inttypes.h>
25
26 #define COMPRESS_SAMPLE_RATE 0x800
27 #define TABLE_PTR_SIZE 0x40
28 #define MAX_UNCOMPRESSED_BYTES 0x80
29 #define MAX_COMPRESSED_BYTES 0x202
30 #define MIN_COMPRESSED_BYTES 0x2
31
32 #define COMPRESSION_FLAG 0x80
33
34 /**
35 * @brief This class implements the compression algorithm 0x11.
36 */
37 class Algo0x11 : public Algorithm
38 {
39 protected:
40 uint32_t _ptrArray[TABLE_PTR_SIZE];
41
42 protected:
43 static int __compare(const void *n1, const void *n2);
44 bool _lookupBestOccurs(const unsigned char* data,
45 unsigned long size);
46 bool _compress(const unsigned char *data,
47 unsigned long size,
48 unsigned char* &output,
49 unsigned long &outputSize);
50
51 public:
52 Algo0x11();
53 virtual ~Algo0x11();
54
55 public:
56 virtual BandPlane* compress(const Request& request,
57 unsigned char *data, unsigned long width,
58 unsigned long height);
59 virtual bool reverseLineColumn() {return true;}
60 virtual bool inverseByte() {return true;}
61 virtual bool splitIntoBands() {return true;}
62 };
63
64 #endif /* _ALGO0X11_H_ */
65
66 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
67
0 /*
1 * algo0x13.h (C) 2007-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: algo0x13.h 158 2008-02-09 02:02:13Z ap2c $
18 *
19 */
20 #ifndef _ALGO0X13_H_
21 #define _ALGO0X13_H_
22
23 #ifndef DISABLE_JBIG
24
25 #include "algorithm.h"
26 extern "C" {
27 # include "jbig.h"
28 }
29
30 /**
31 * @brief This class implements the compression algorithm 0x13.
32 */
33 class Algo0x13 : public Algorithm
34 {
35 protected:
36 typedef struct bandList_s {
37 BandPlane* band;
38 struct bandList_s* next;
39 } bandList_t;
40
41 typedef struct info_s {
42 bandList_t** list;
43 bandList_t* last;
44 unsigned char* data;
45 unsigned long size;
46 unsigned long maxSize;
47 } info_t;
48
49 protected:
50 bool _compressed;
51 jbg_enc_state _state;
52 bandList_t* _list;
53
54
55 public:
56 Algo0x13();
57 virtual ~Algo0x13();
58
59 public:
60 static void _callback(unsigned char *data, size_t len, void *arg);
61
62 public:
63 virtual BandPlane* compress(const Request& request,
64 unsigned char *data, unsigned long width,
65 unsigned long height);
66 };
67
68 #endif /* DISABLE_JBIG */
69
70 #endif /* _ALGO0X13_H_ */
71
72 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
73
0 /*
1 * algorithm.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: algorithm.h 157 2008-02-09 02:01:24Z ap2c $
18 *
19 */
20 #ifndef _ALGORITHM_H_
21 #define _ALGORITHM_H_
22
23 class Request;
24 class BandPlane;
25
26 /**
27 * @brief This super class is an interface to implement a compression
28 * algorithm.
29 */
30 class Algorithm
31 {
32 protected:
33
34 public:
35 /**
36 * Initialize the instance.
37 */
38 Algorithm();
39 /**
40 * Destroy the instance.
41 */
42 virtual ~Algorithm();
43
44 public:
45 /**
46 * Compress data.
47 * @param request the request instance
48 * @param data the data to compress
49 * @param width the width of the data / band / page
50 * @param height the height of the data / band / page
51 * @return a pointer to a @ref BandPlane instance or NULL.
52 */
53 virtual BandPlane* compress(const Request& request,
54 unsigned char *data, unsigned long width,
55 unsigned long height) = 0;
56 /**
57 * Reverse line and column.
58 * the byte at (x=1, y=0) is placed at (x=0, y=1) etc.
59 * This is used by algorithm 0x11 (at least).
60 * @return TRUE if this operation is needed. Otherwise returns FALSE.
61 */
62 virtual bool reverseLineColumn() {return false;}
63 /**
64 * Inverse the byte.
65 * Do a NOT operation on each byte.
66 * @return TRUE if this operation is needed. Otherwise returns FALSE.
67 */
68 virtual bool inverseByte() {return false;}
69 /**
70 * Split into bands
71 * @return TRUE if each planes has to ben split into bands. Otherwise
72 * it returns FALSE.
73 */
74 virtual bool splitIntoBands() {return false;}
75 };
76
77 #endif /* _ALGORITHM_H_ */
78
79 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
80
00 /*
1 * band.h (C) 2006, Aurélien Croc (AP²C)
1 * band.h (C) 2006-2008, Aurélien Croc (AP²C)
22 *
33 * This program is free software; you can redistribute it and/or modify
44 * it under the terms of the GNU General Public License as published by
1414 * Free Software Foundation, Inc.,
1515 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1616 *
17 * $Id: band.h 49 2006-11-29 10:57:15Z ap2c $
17 * $Id: band.h 140 2008-01-31 18:33:18Z ap2c $
1818 *
1919 */
20 #ifndef BAND_H_
21 #define BAND_H_
20 #ifndef _BAND_H_
21 #define _BAND_H_
2222
23 #include <sys/types.h>
24 #include <stdint.h>
23 #include <stddef.h>
2524
25 class Page;
26 class BandPlane;
27
28 /**
29 * @brief This class contains all information related to a band.
30 *
31 */
2632 class Band
2733 {
28 protected:
29 unsigned char* _band;
30 unsigned long _width;
31 unsigned long _height;
32 unsigned long _line;
33 unsigned long _clipping;
34 bool _empty;
35
36 protected:
37 unsigned char* _algorithm0(size_t *size);
38 unsigned char* _algorithm11(size_t *size);
34 protected:
35 unsigned long _bandNr;
36 const Page* _parent;
37 unsigned char _colors;
38 BandPlane* _planes[4];
39 unsigned long _width;
40 unsigned long _height;
41 Band* _sibling;
3942
40 public:
41 Band(unsigned long bandWidth, unsigned long bandHeight);
42 ~Band();
43 public:
44 /**
45 * Initialize the band instance.
46 */
47 Band();
48 /**
49 * Initialize the band instance.
50 * @param nr the band number
51 * @param width the band width
52 * @param height the band height
53 */
54 Band (unsigned long nr, unsigned long width, unsigned long height);
55 /**
56 * Destroy the instance
57 */
58 virtual ~Band();
4359
44 public:
45 unsigned long width() const {return _width * 8;}
46 unsigned long height() const {return _height;}
47 unsigned long line() const {return _line;}
48 unsigned long clipping() const {return _clipping * 8;}
49 unsigned char* band() {return _band;}
50 bool isEmpty() const {return _empty;}
60 public:
61 /**
62 * Set the band number.
63 * @param nr the band number
64 */
65 void setBandNr(unsigned long nr) {_bandNr = nr;}
66 /**
67 * Register the parent @ref Page instance.
68 * @param parent the parent page instance
69 */
70 void registerParent(const Page* parent)
71 {_parent = parent;}
72 /**
73 * Register a new plane.
74 * @param plane the band plane
75 */
76 void registerPlane(BandPlane* plane)
77 {if (_colors < 4) {_planes[_colors] = plane;
78 _colors++;}}
79 /**
80 * Set the band width.
81 * @param width the band width
82 */
83 void setWidth(unsigned long width)
84 {_width = width;}
85 /**
86 * Set the band height.
87 * @param height the band height
88 */
89 void setHeight(unsigned long height)
90 {_height = height;}
91 /**
92 * Register sibling.
93 * @param sibling the sibling.
94 */
95 void registerSibling(Band* sibling)
96 {_sibling = sibling;}
5197
52 void setEmpty() {_empty = true;}
53 void setLine(unsigned long line) {_line = line;}
54 void setClipping(unsigned long c)
55 {_clipping = (c + 7) / 8;}
98 /**
99 * @return the band number.
100 */
101 unsigned long bandNr() const {return _bandNr;}
102 /**
103 * @return the number of registered planes.
104 */
105 unsigned long planesNr() const {return _colors;}
106 /**
107 * @return the parent @ref Page instance.
108 */
109 const Page* parent() const {return _parent;}
110 /**
111 * Get a specific band plane.
112 * @param nr the band plane number
113 * @return the @ref BandPlane instance if it exists. Otherwise it
114 * returns NULL.
115 */
116 const BandPlane* plane(unsigned char nr) const
117 {return nr < _colors ? _planes[nr] : NULL;}
118 /**
119 * @return the band width.
120 */
121 unsigned long width() const {return _width;}
122 /**
123 * @return the band height.
124 */
125 unsigned long height() const {return _height;}
126 /**
127 * @return the next sibling or NULL if there is no sibling.
128 */
129 Band* sibling() const {return _sibling;}
56130
57
58
59 void clean() {_line = 0;}
60 int addLine(unsigned char *line, unsigned long width);
61
62 unsigned char* exportBand(int algorithm, size_t *size);
63
64 bool isFull() const
65 {return _line == _height ? true : false;}
131 public:
132 /**
133 * Swap this instance on the disk.
134 * @param fd the file descriptor where the instance has to be swapped
135 * @return TRUE if the instance has been successfully swapped.
136 * Otherwise it returns FALSE.
137 */
138 bool swapToDisk(int fd);
139 /**
140 * Restore an instance from the disk into memory.
141 * @param fd the file descriptor where the instance has been swapped
142 * @return a band instance if it has been successfully restored.
143 * Otherwise it returns NULL.
144 */
145 static Band* restoreIntoMemory(int fd);
66146 };
67147
68 #endif /* BAND_H_ */
148 #endif /* _BAND_H_ */
69149
150 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
151
+0
-30
include/bandanalyser.h less more
0 /*
1 * bandanalyser.h (C) 2006, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: bandanalyser.h 48 2006-11-29 10:55:55Z ap2c $
18 *
19 */
20 #ifndef BANDANALYSER_H_
21 #define BANDANALYSER_H_
22
23 class Band;
24
25 extern void checkEmptyBand(Band *band);
26 extern void correctBlackColor(Band *bandC, Band *bandM, Band *bandY, Band *bandB);
27
28 #endif /* BANDANALYSER_H_ */
29
0 /*
1 * bandplane.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: bandplane.h 247 2008-11-24 23:18:31Z ap2c $
18 *
19 */
20 #ifndef _BANDPLANE_H_
21 #define _BANDPLANE_H_
22
23 /**
24 * @brief This class contains data related to a band plane.
25 *
26 */
27 class BandPlane
28 {
29 public:
30 enum Endian {
31 /** Machine dependant */
32 Dependant,
33 /** Big endian */
34 BigEndian,
35 /** Little endian */
36 LittleEndian,
37 };
38
39 protected:
40 unsigned char _colorNr;
41 unsigned long _size;
42 unsigned char* _data;
43 unsigned long _checksum;
44 Endian _endian;
45 unsigned char _compression;
46
47 public:
48 /**
49 * Initialize the band plane instance.
50 */
51 BandPlane();
52 /**
53 * Destroy the instance
54 */
55 virtual ~BandPlane();
56
57 public:
58 /**
59 * Set the color number of this plane.
60 * @param nr the color number
61 */
62 void setColorNr(unsigned char nr) {_colorNr = nr;}
63 /**
64 * Set the data buffer.
65 * The buffer will be freed during the destruction of this instance.
66 * @param data the data buffer
67 * @param size the size of the data
68 */
69 void setData(unsigned char *data,
70 unsigned long size);
71 /**
72 * Set the endian to use.
73 * @param endian the endian to use.
74 */
75 void setEndian(Endian endian) {_endian = endian;}
76 /**
77 * Set the compression algorithm used.
78 * @param compression the compression algorithm used.
79 */
80 void setCompression(unsigned char compression)
81 {_compression = compression;}
82
83 /**
84 * @return the color number.
85 */
86 unsigned char colorNr() const {return _colorNr;}
87 /**
88 * @return the data size.
89 */
90 unsigned long dataSize() const {return _size;}
91 /**
92 * @return the data.
93 */
94 const unsigned char* data() const {return _data;}
95 /**
96 * @return the endian to use.
97 */
98 Endian endian() const {return _endian;}
99 /**
100 * @return the checksum.
101 */
102 unsigned long checksum() const {return _checksum;}
103 /**
104 * @return the compression algorithm used.
105 */
106 unsigned char compression() const {return _compression;}
107
108 public:
109 /**
110 * Swap this instance on the disk.
111 * @param fd the file descriptor where the instance has to be swapped
112 * @return TRUE if the instance has been successfully swapped.
113 * Otherwise it returns FALSE.
114 */
115 bool swapToDisk(int fd);
116 /**
117 * Restore an instance from the disk into memory.
118 * @param fd the file descriptor where the instance has been swapped
119 * @return a bandplane instance if it has been successfully restored.
120 * Otherwise it returns NULL.
121 */
122 static BandPlane* restoreIntoMemory(int fd);
123 };
124
125 #endif /* _BANDPLANE_H_ */
126
127 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
128
0 /*
1 * cache.h (C) 2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: cache.h 141 2008-02-01 00:10:50Z ap2c $
18 *
19 */
20 #ifndef _CACHE_H_
21 #define _CACHE_H_
22
23 class Page;
24
25 /**
26 * List all the different cache policy available.
27 */
28 enum CachePolicy {
29 /** All pages are needed with page number increasing. */
30 EveryPagesIncreasing,
31 /** Only even pages are needed with page number decreasing. */
32 EvenDecreasing,
33 /** Only odd pages are needed with page number increasing. */
34 OddIncreasing,
35 };
36
37
38 /**
39 * Initialize the cache mechanism and load the cache controller thread.
40 * @return TRUE if the initialization succeed. Otherwise it returns FALSE.
41 */
42 extern bool initializeCache();
43
44 /**
45 * Uninitialize the cache mechanism and unload the cache controller thread.
46 * @return TRUE if the uninitialization succeed. Otherwise it returns FALSE.
47 */
48 extern bool uninitializeCache();
49
50
51 /**
52 * Extract the next page (depending on the curernt cache policy)
53 * @return the instance of the page. Otherwise it returns NULL if no page are
54 * found.
55 */
56 extern Page* getNextPage();
57
58 /**
59 * Register a new page in the cache.
60 * @param page the page instance to register in the cache
61 */
62 extern void registerPage(Page* page);
63
64 /**
65 * Set the new cache policy.
66 * @param policy the new cache policy
67 */
68 extern void setCachePolicy(CachePolicy policy);
69
70 /**
71 * Set the number of pages in the document.
72 * @param nr the number of pages
73 */
74 extern void setNumberOfPages(unsigned long nr);
75
76
77 /**
78 * @brief This class represent a cache entry to store a page.
79 * To preserve memory a swapping mechanism is present.
80 */
81 class CacheEntry {
82 protected:
83 Page* _page;
84 CacheEntry* _previous;
85 CacheEntry* _next;
86 char* _tempFile;
87
88 public:
89 /**
90 * Initialize the cache entry instance.
91 * @param page the page instance associated to this entry.
92 */
93 CacheEntry(Page* page);
94 /**
95 * Destroy the cache entry instance.
96 */
97 virtual ~CacheEntry();
98
99 public:
100 /**
101 * Set the next cache entry.
102 * @param entry the next cache entry
103 */
104 void setNext(CacheEntry *entry) {_next = entry;}
105 /**
106 * Set the previous cache entry.
107 * @param entry the previous cache entry
108 */
109 void setPrevious(CacheEntry *entry)
110 {_previous = entry;}
111 /**
112 * Swap the page instance on the disk.
113 * @return TRUE if the page has been successfully swapped. Otherwise it
114 * returns FALSE.
115 */
116 bool swapToDisk();
117 /**
118 * Restore a previously swapped page into memory.
119 * @return TRUE if the page has been successfully restored. Otherwise
120 * it returns FALSE.
121 */
122 bool restoreIntoMemory();
123
124 /**
125 * @return the page instance.
126 */
127 Page* page() const {return _page;}
128 /**
129 * @return the next instance.
130 */
131 CacheEntry* next() const {return _next;}
132 /**
133 * @return the previous instance.
134 */
135 CacheEntry* previous() const {return _previous;}
136 /**
137 * @return TRUE if the page is currently swapped on disk. Otherwise
138 * returns FALSE.
139 */
140 bool isSwapped() const
141 {return _tempFile ? true : false;}
142 };
143 #endif /* _CACHE_H_ */
144
145 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
146
0 /*
1 * colors.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: colors.h 136 2008-01-30 17:15:49Z ap2c $
18 *
19 */
20 #ifndef _COLORS_H_
21 #define _COLORS_H_
22
23 #ifndef DISABLE_BLACKOPTIM
24
25 class Page;
26
27 /**
28 * Optimize the black channel.
29 * Transform red, green and cyan dots in a black dot and remove red, green or
30 * cyan dot if a black dot is present.
31 */
32 extern void applyBlackOptimization(Page* page);
33
34 #endif /* DISABLE_BLACKOPTIM */
35 #endif /* _COLORS_H_ */
36
37 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
38
00 /*
1 * compress.h (C) 2006, Aurélien Croc (AP²C)
1 * compress.h (C) 2006-2008, Aurélien Croc (AP²C)
22 *
33 * This program is free software; you can redistribute it and/or modify
44 * it under the terms of the GNU General Public License as published by
1414 * Free Software Foundation, Inc.,
1515 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1616 *
17 * $Id: compress.h 1 2006-08-26 03:31:31Z ap2c $
18 *
17 * $Id: compress.h 127 2008-01-28 17:52:50Z ap2c $
18 *
1919 */
20 #ifndef COMPRESS_H_
21 #define COMPRESS_H_
20 #ifndef _COMPRESS_H_
21 #define _COMPRESS_H_
2222
23 struct BandArray {
24 unsigned char *array;
25 unsigned char *next;
26 unsigned char *prev;
27 };
23 class Page;
24 class Request;
2825
29 extern int compressBand(struct BandArray *bandArray, unsigned char *inputBand,
30 unsigned long bandWidth, unsigned long bandHeight);
31 extern int calcOccurs(unsigned char *band, unsigned long bandHeight,
32 unsigned long bandWidth, unsigned long number);
26 extern bool compressPage(const Request& request, Page* page);
3327
34 #endif
28 #endif /* _COMPRESS_H_ */
3529
30 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
31
0 /*
1 * core.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: core.h 119 2008-01-22 23:06:29Z ap2c $
18 *
19 */
20 #ifndef _CORE_H_
21 #define _CORE_H_
22
23 #endif /* _CORE_H_ */
24
25 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
26
00 /*
1 * document.h (C) 2006, Aurélien Croc (AP²C)
1 * document.h (C) 2006-2008, Aurélien Croc (AP²C)
22 *
33 * This program is free software; you can redistribute it and/or modify
44 * it under the terms of the GNU General Public License as published by
1414 * Free Software Foundation, Inc.,
1515 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1616 *
17 * $Id: document.h 39 2006-11-11 17:26:51Z ap2c $
17 * $Id: document.h 137 2008-01-31 14:41:36Z ap2c $
1818 *
1919 */
20 #ifndef DOCUMENT_H_
21 #define DOCUMENT_H_
20 #ifndef _DOCUMENT_H_
21 #define _DOCUMENT_H_
2222
23 #include <stdio.h>
24 #include "printer.h"
23 #include <cups/raster.h>
2524
25 class Page;
26 class Request;
27
28 /**
29 * @brief This class converts the job into usable pages.
30 *
31 * Two main methods permits to get a bitmap page (used by the compression
32 * algorithms) and to get the compressed pages (used by the QPDL render).
33 */
2634 class Document
2735 {
28 public:
29 Document() {};
30 virtual ~Document() {};
36 protected:
37 cups_raster_t* _raster;
38 unsigned long _currentPage;
39 bool _lastPage;
3140
32 public:
33 virtual void unload() = 0;
34 virtual int load() = 0;
35 virtual int loadPage(Printer *printer) = 0;
36 virtual int readLine() = 0;
41 public:
42 /**
43 * Initialize the instance.
44 */
45 Document();
46 /**
47 * Destroy the instance.
48 */
49 virtual ~Document();
3750
38 public:
39 virtual unsigned long width() const = 0;
40 virtual unsigned long height() const = 0;
41 virtual unsigned long lineSize() const = 0;
42 virtual unsigned char* lineBuffer() const = 0;
51 public:
52 /**
53 * Load the file which contains the job.
54 * The file have to be opened on the file descriptor 0 (STDIN_FILENO)
55 * and be formatted as CUPS Raster.
56 * @param request the request instance
57 * @return TRUE if it has been successfully opened. Otherwise it
58 * returns FALSE.
59 */
60 bool load(const Request& request);
4361
44 public:
45 virtual bool isColor() const = 0;
62 /**
63 * Load the next page into memory and store all the needed information
64 * in a @ref Page instance.
65 * If the page is empty, it means there is no more pages (check the
66 * @ref noMorePages method) or there is an error.
67 * @param request the request instance
68 * @return a @ref Page instance containing the current page.
69 */
70 Page* getNextRawPage(const Request& request);
71 /**
72 * @return the number of pages or 0 if its number is not yet known.
73 */
74 unsigned long numberOfPages() const
75 {return _lastPage ? _currentPage - 1: 0;}
4676 };
4777
48 #endif /* DOCUMENT_H_ */
78 #endif /* _DOCUMENT_H_ */
4979
80 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
81
0 /*
1 * errlog.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: errlog.h 221 2008-06-14 23:03:24Z ap2c $
18 *
19 */
20 #ifndef _ERRLOG_H_
21 #define _ERRLOG_H_
22
23 #include <stdio.h>
24
25 #define _(X) X
26
27 #ifdef DEBUG
28 # define ERRORMSG(X, args ...) fprintf(stderr, "ERROR: " X "\n", ##args);
29 # define WARNMSG(X, args ...) fprintf(stderr, "WARNING: " X "\n", ##args);
30 # define DEBUGMSG(X, args ...) fprintf(stderr, "DEBUG: " X "\n", ##args);
31 #else
32 # define ERRORMSG(X, args ...) fprintf(stderr, "ERROR: SpliX " X "\n", ##args);
33 # define WARNMSG(X, args ...) fprintf(stderr, "WARNING: SpliX " X "\n", ##args);
34 # define DEBUGMSG(X, args ...) fprintf(stderr, "DEBUG: SpliX " X "\n", ##args);
35 #endif /* DEBUG */
36
37 #endif /* _ERRLOG_H_ */
38
39 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
40
+0
-34
include/error.h less more
0 /*
1 * error.h (C) 2006, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: error.h 1 2006-08-26 03:31:31Z ap2c $
18 *
19 */
20 #ifndef ERROR_H_
21 #define ERROR_H_
22
23 #include <stdio.h>
24
25 #define _(X) X
26
27 #define ERROR(X, args ...) fprintf(stderr, "" X "\n", ##args);
28 //#define DEBUG(X, args ...) fprintf(stderr, "" X "\n", ##args);
29 #define DEBUG(X, args ...)
30
31
32 #endif /* ERROR_H_ */
33
0 /*
1 * options.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: options.h 190 2008-02-10 15:30:10Z ap2c $
18 *
19 */
20 #ifndef _OPTIONS_H_
21 #define _OPTIONS_H_
22
23 #ifdef DISABLE_JBIG
24 bool opt_jbig = false;
25 #else
26 bool opt_jbig = true;
27 #endif /* DISABLE_JBIG */
28
29 #ifdef DISABLE_THREADS
30 bool opt_threads = false;
31 #define THREADS 0
32 #define CACHESIZE 0
33 #else
34 bool opt_threads = true;
35 #endif /* DISABLE_THREADS */
36
37 #ifdef DISABLE_BLACKOPTIM
38 bool opt_blackoptim = false;
39 #else
40 bool opt_blackoptim = true;
41 #endif /* DISABLE_BLACKOPTIM */
42
43 #endif /* _OPTIONS_H_ */
44
45 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
46
0 /*
1 * page.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: page.h 186 2008-02-09 16:18:52Z ap2c $
18 *
19 */
20 #ifndef _PAGE_H_
21 #define _PAGE_H_
22
23 #include <stddef.h>
24
25 class Band;
26
27 /**
28 * @brief This class contains a page representation.
29 *
30 * There are two steps. During the first step, the instance contains the bitmap
31 * representation of the page. During the second step, the bitmap
32 * representation is freed and is replaced by bands representations.
33 * Each band is linked to this instance and will be used by the QPDL render.
34 *
35 * When the page will be compressed this instance have to be sent to the cache
36 * manager for waiting its use by the render code.
37 */
38 class Page
39 {
40 protected:
41 unsigned long _xResolution;
42 unsigned long _yResolution;
43 unsigned long _width;
44 unsigned long _height;
45 unsigned char _colors;
46 unsigned long _pageNr;
47 unsigned long _copiesNr;
48 unsigned long _compression;
49 unsigned char* _planes[4];
50 bool _empty;
51 unsigned long _bandsNr;
52 Band* _firstBand;
53 Band* _lastBand;
54
55 public:
56 /**
57 * Initialize the page instance.
58 */
59 Page();
60 /**
61 * Destroy the instance
62 */
63 virtual ~Page();
64
65 public:
66 /**
67 * Convert a length (given for 72DPI) in the X resolution.
68 * @param f the float to convert.
69 * @return the converted value.
70 */
71 long double convertToXResolution(long double f)
72 {return f * _xResolution / 72.;}
73 /**
74 * Convert a length (given for 72DPI) in the Y resolution.
75 * @param f the float to convert.
76 * @return the converted value.
77 */
78 long double convertToYResolution(long double f)
79 {return f * _yResolution / 72.;}
80
81 /**
82 * Delete all planes registered and free the used memory.
83 * This function has to be called when planes are no longer
84 * used to free the huge amount of memory required for them.
85 */
86 void flushPlanes();
87
88 /**
89 * Make a 180° rotation of the bitmap planes
90 */
91 void rotate();
92
93 public:
94 /**
95 * Set the X resolution.
96 * @param xRes the X resolution
97 */
98 void setXResolution(unsigned long xRes)
99 {_xResolution = xRes;}
100 /**
101 * Set the Y resolution.
102 * @param xRes the Y resolution
103 */
104 void setYResolution(unsigned long yRes)
105 {_yResolution = yRes;}
106 /**
107 * Set the page width.
108 * @param width the page width
109 */
110 void setWidth(unsigned long width)
111 {_width = width;}
112 /**
113 * Set the page height.
114 * @param height the page height
115 */
116 void setHeight(unsigned long height)
117 {_height = height;}
118 /**
119 * Set the number of colors.
120 * @param nr the number of colors
121 */
122 void setColorsNr(unsigned char nr) {_colors = nr;}
123 /**
124 * Set this page number.
125 * @param nr this page number
126 */
127 void setPageNr(unsigned long nr) {_pageNr = nr;}
128 /**
129 * Set the number of copies needed.
130 * @param nr the number of copies to do
131 */
132 void setCopiesNr(unsigned long nr)
133 {_copiesNr = nr;}
134 /**
135 * Set the compression algorithm number to use.
136 * @param nr this compression algorithm number
137 */
138 void setCompression(unsigned long nr)
139 {_compression = nr;}
140 /**
141 * Register a new color plane.
142 * @param color the color number
143 * @param buffer the plane buffer.
144 */
145 void setPlaneBuffer(unsigned char color,
146 unsigned char* buffer)
147 {_planes[color] = buffer; _empty = false;}
148 /**
149 * Register a new band.
150 * Note that band instances will be destroyed when this instance will
151 * be destroyed.
152 * @param band the band instance.
153 */
154 void registerBand(Band *band);
155 /**
156 * Set this page empty.
157 * This is useful in case of compression error.
158 */
159 void setEmpty() {_empty = true;}
160
161 /**
162 * @return the X resolution.
163 */
164 unsigned long xResolution() const {return _xResolution;}
165 /**
166 * @return the Y resolution.
167 */
168 unsigned long yResolution() const {return _yResolution;}
169 /**
170 * @return the page width.
171 */
172 unsigned long width() const {return _width;}
173 /**
174 * @return the page height.
175 */
176 unsigned long height() const {return _height;}
177 /**
178 * @return the number of colors.
179 */
180 unsigned char colorsNr() const {return _colors;}
181 /**
182 * @return this page number.
183 */
184 unsigned long pageNr() const {return _pageNr;}
185 /**
186 * @return the number of copies to do.
187 */
188 unsigned long copiesNr() const {return _copiesNr;}
189 /**
190 * @return the compression algorithm number.
191 */
192 unsigned long compression() const {return _compression;}
193 /**
194 * Get the buffer associated to a plane.
195 * @param color the color plane number.
196 * @return the plane buffer. Otherwise it returns NULL if the color
197 * plane number is incorrect or if there is no plane
198 * associated.
199 */
200 unsigned char* planeBuffer(unsigned char color) const
201 {return color < _colors ? _planes[color] :
202 NULL;}
203 /**
204 * @return TRUE if no planes has been set. Otherwise it returns FALSE.
205 */
206 bool isEmpty() const {return _empty;}
207 /**
208 * @return the first band or NULL if no bands has been registered.
209 */
210 const Band* firstBand() const {return _firstBand;}
211
212 public:
213 /**
214 * Swap this instance on the disk.
215 * @param fd the file descriptor where the instance has to be swapped
216 * @return TRUE if the instance has been successfully swapped.
217 * Otherwise it returns FALSE.
218 */
219 bool swapToDisk(int fd);
220 /**
221 * Restore an instance from the disk into memory.
222 * @param fd the file descriptor where the instance has been swapped
223 * @return a page instance if it has been successfully restored.
224 * Otherwise it returns NULL.
225 */
226 static Page* restoreIntoMemory(int fd);
227 };
228 #endif /* _PAGE_H_ */
229
230 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
231
+0
-72
include/pbmimage.h less more
0 /*
1 * pbmimage.h (C) 2006, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: pbmimage.h 56 2006-12-13 15:20:59Z ap2c $
18 *
19 */
20 #ifndef PBMIMAGE_H_
21 #define PBMIMAGE_H_
22
23 #include <inttypes.h>
24 #include <stdio.h>
25 #include "printer.h"
26 #include "document.h"
27
28 class PbmImage : public Document
29 {
30 protected:
31 const char* _blackFile;
32 const char* _cyanFile;
33 const char* _magentaFile;
34 const char* _yellowFile;
35 FILE* _black;
36 FILE* _cyan;
37 FILE* _magenta;
38 FILE* _yellow;
39
40 uint32_t _width;
41 uint32_t _height;
42 uint32_t _lineSize;
43 uint32_t _line;
44 unsigned char* _lineBuffer;
45
46 bool _color;
47 uint8_t _currentColor;
48
49 public:
50 PbmImage(const char *black, const char *cyan,
51 const char *magenta, const char *yellow);
52 virtual ~PbmImage();
53
54 public:
55 virtual void unload();
56 virtual int load();
57 virtual int loadPage(Printer *printer);
58 virtual int readLine();
59
60 public:
61 virtual unsigned long width() const {return _width;}
62 virtual unsigned long height() const {return _height;}
63 virtual unsigned long lineSize() const {return _lineSize;}
64 virtual unsigned char* lineBuffer() const {return _lineBuffer;}
65
66 public:
67 virtual bool isColor() const {return _color;}
68 };
69
70 #endif /* DOCUMENT_H_ */
71
0 /*
1 * ppdfile.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: ppdfile.h 234 2008-10-19 20:41:51Z ap2c $
18 *
19 */
20 #ifndef _PPDFILE_H_
21 #define _PPDFILE_H_
22
23 #include <cups/ppd.h>
24
25 /**
26 * @class PPDFile
27 * @brief This class provides an easy method to manage PPD files.
28 *
29 * This class provides methods to access in a easy way to data contained in PPD
30 * files. During the opening of the file, the PPD version can be compared with
31 * the current project version, default and user values are set as default.
32 * Next, data contained in the ppd file can be manipulated easily with two
33 * methods. The second one (@ref PPDValue::setPreformatted) allows the
34 * use of special bytes in strings.
35 */
36 class PPDFile
37 {
38 public:
39 /**
40 * @brief This class manages a PPD value.
41 *
42 * Use the defined type PPDValue to use this class.
43 *
44 * In a PPD a string can be preformatted to contain unprintable
45 * characters. For that, insert the ASCII number between < and >.
46 * @code
47 * *QPDL beginPJL: "<1B>%-12345X"
48 * @endcode
49 *
50 * To decode these preformatted string, call the @ref setPreformatted
51 * method and read the string.
52 *
53 */
54 class Value {
55 protected:
56 const char* _value;
57 char* _preformatted;
58 const char* _out;
59 float _width;
60 float _height;
61 float _marginX;
62 float _marginY;
63
64 public:
65 /**
66 * Initialize a new instance.
67 */
68 Value();
69 /**
70 * Initialize a new instance with the specified string.
71 * @param value the specified value.
72 */
73 Value(const char *value);
74 /**
75 * Destroy the instance.
76 */
77 virtual ~Value();
78
79 public:
80 /**
81 * Set a string.
82 * @param value the string value.
83 * @return itself.
84 */
85 PPDFile::Value& set(const char *value);
86 /**
87 * Set width, height and X, Y margins
88 * @param width the width.
89 * @param height the height.
90 * @param marginX the X margin.
91 * @param marginY the Y margin.
92 * @return itself.
93 */
94 PPDFile::Value& set(float width, float height, float
95 marginX, float marginY);
96 /**
97 * Specify the represented string is preformatted.
98 * @return itself.
99 */
100 PPDFile::Value& setPreformatted();
101
102 public:
103 /**
104 * @return the width value.
105 */
106 float width() const {return _width;}
107 /**
108 * @return the height value.
109 */
110 float height() const {return _height;}
111 /**
112 * @return the X margin value.
113 */
114 float marginX() const {return _marginX;}
115 /**
116 * @return the Y margin value.
117 */
118 float marginY() const {return _marginY;}
119 /**
120 * @return TRUE if there is no associated string. Otherwise it
121 * returns FALSE.
122 */
123 bool isNull() const {return _out ? false : true;}
124
125 /**
126 * Copy the string into an allocated buffer.
127 * The user has to free the string at the end of its use.
128 * @return a pointer to an allocated buffer containing the
129 * string. If there is no string, it returns NULL.
130 */
131 char* deepCopy() const;
132
133 /**
134 * @return TRUE if the key is set to true, enable, enabled,
135 * yes, 1 or on. Otherwise it returns FALSE.
136 */
137 bool isTrue() const;
138 /**
139 * @return FALSE if the key is set to true, enable, enabled,
140 * yes, 1 or on. Otherwise it returns TRUE.
141 */
142 bool isFalse() const {return !isTrue();}
143
144 /**
145 * @return TRUE if the key is set to true, enable, enabled,
146 * yes, 1 or on. Otherwise it returns FALSE.
147 */
148 operator bool() const {return isTrue();}
149 /**
150 * @return the string pointer.
151 */
152 operator const char*() const {return _out;}
153 /**
154 * @return the unsigned long converted value.
155 */
156 operator unsigned long() const
157 {return _out ? strtol(_out, (char**)NULL, 10) : 0;}
158 /**
159 * @return the long converted value.
160 */
161 operator long() const
162 {return _out ? strtol(_out, (char**)NULL, 10) : 0;}
163 /**
164 * @return the float converted value.
165 */
166 operator float() const
167 {return _out ? strtof(_out, (char**)NULL) : 0;}
168 /**
169 * @return the double converted value.
170 */
171 operator double() const
172 {return _out ? strtod(_out, (char**)NULL) : 0;}
173 /**
174 * @return the long double converted value.
175 */
176 operator long double() const
177 {return _out ? strtold(_out, (char**)NULL) : 0;}
178 /**
179 * Compare the value with a string.
180 * The comparison is case insensitive.
181 * @param val the string to compare to
182 * @return TRUE if the strings are equivalent. Otherwise it
183 * returns FALSE.
184 */
185 bool operator == (const char* val) const;
186 /**
187 * Compare the value with a string.
188 * The comparison is case insensitive.
189 * @param val the string to compare to
190 * @return TRUE if the strings are different. Otherwise it
191 * returns FALSE.
192 */
193 bool operator != (const char* val) const;
194 /**
195 * Assignment operator.
196 * @param val the specified value.
197 */
198 void operator = (const Value &val);
199 };
200
201 protected:
202 ppd_file_t* _ppd;
203
204 public:
205 /**
206 * Initialize a new PPDFile instance.
207 */
208 PPDFile();
209 /**
210 * Destroy the instance.
211 * the PPD file will be closed if it was opened.
212 */
213 virtual~ PPDFile();
214
215 public:
216 /**
217 * Open a PPD file and check its integrity.
218 * @param file the file path and name
219 * @param version the current SpliX version
220 * @param useropts the user options
221 * @return TRUE if the PPD has been successfully opened. Otherwise it
222 * returns false.
223 */
224 bool open(const char *file, const char *version,
225 const char *useropts = "");
226 /**
227 * Close a previously opened PPD file.
228 */
229 void close();
230
231 public:
232 /**
233 * Get the string associated to a key or a key and a group.
234 * @param name the key name
235 * @param opt the name of the group if the key is in the group.
236 * Otherwise it must be set to NULL
237 * @return a PPDValue instance containing the string or NULL if the key
238 * or the group/key doesn't exists or if there is no data
239 * associated.
240 */
241 Value get(const char *name, const char *opt=NULL);
242 /**
243 * Get the page size information.
244 * @param name the page format name
245 * @return a PPDValue instance containing the width and the height of
246 * the page format requested.
247 */
248 Value getPageSize(const char *name);
249 };
250
251 /**
252 * Represent a PPD value
253 */
254 typedef PPDFile::Value PPDValue;
255
256
257 #endif /* _PPDFILE_H_ */
258
259 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
260
00 /*
1 * printer.h (C) 2006, Aurélien Croc (AP²C)
1 * printer.h (C) 2006-2008, Aurélien Croc (AP²C)
22 *
33 * This program is free software; you can redistribute it and/or modify
44 * it under the terms of the GNU General Public License as published by
1414 * Free Software Foundation, Inc.,
1515 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1616 *
17 * $Id: printer.h 65 2006-12-14 01:39:35Z ap2c $
17 * $Id: printer.h 242 2008-11-24 00:12:22Z ap2c $
1818 *
1919 */
20 #ifndef PRINTER_H_
21 #define PRINTER_H_
20 #ifndef _PRINTER_H_
21 #define _PRINTER_H_
2222
23 #include <cups/ppd.h>
24 #include <stdlib.h>
23 class Request;
2524
26 class Printer
25 /**
26 * @brief This class contains all the needed information about the printer.
27 *
28 * This class is mainly used by the QPDL render.
29 */
30 class Printer
2731 {
28 protected:
29 ppd_file_t* _ppd;
32 protected:
33 char* _manufacturer;
34 char* _model;
35 char* _beginPJL;
36 char* _endPJL;
3037
31 const char* _username;
32 const char* _jobname;
33
34 unsigned long _xresolution;
35 unsigned long _yresolution;
36 unsigned char _paperType;
37 unsigned char _paperSource;
38 unsigned short _duplex;
38 bool _color;
39 unsigned long _qpdlVersion;
40 unsigned long _bandHeight;
41 unsigned long _packetSize;
3942
40 unsigned char _compVersion;
43 unsigned char _paperType;
44 unsigned char _paperSource;
4145
42 unsigned short _bandHeight;
43 long double _printableX;
44 long double _printableY;
45 long double _pageSizeX;
46 long double _pageSizeY;
47 long double _marginX;
48 long double _marginY;
49 long double _areaX;
50 long double _areaY;
46 float _paperWidth;
47 float _paperHeight;
48
49 unsigned char _unknownByte1;
50 unsigned char _unknownByte2;
51 unsigned char _unknownByte3;
5152
52 char* _docHeaderValues;
53 bool _color;
54 unsigned char _qpdlVersion;
55
56 protected:
57 long double _convertX(long double d) const;
58 long double _convertY(long double d) const;
59 char* _convertStr(const char *str) const;
53 float _pageWidth;
54 float _pageHeight;
6055
61 public:
62 Printer(ppd_file_t* ppd);
63 ~Printer();
56 float _hardMarginX;
57 float _hardMarginY;
6458
65 void newJob(FILE *output);
66 void endJob(FILE *output);
59 public:
60 /**
61 * Initialize a new instance.
62 */
63 Printer();
64 /**
65 * Destroy the instance and free the internal memory used.
66 */
67 virtual ~Printer();
6768
68 public:
69 void setPageSizeX(long double f) {_pageSizeX = f;}
70 void setPageSizeY(long double f) {_pageSizeY = f;}
71 void setMarginX(long double f) {_marginX = f;}
72 void setMarginY(long double f) {_marginY = f;}
73 void setAreaX(long double f) {_areaX = f;}
74 void setAreaY(long double f) {_areaY = f;}
75 void setResolution(unsigned long xres, unsigned long
76 yres)
77 {_xresolution = xres; _yresolution = yres;}
78 void setPrintableX(long double f) {_printableX = f;}
79 void setPrintableY(long double f) {_printableY = f;}
80 void setCompVersion(unsigned char v)
81 {_compVersion = v;}
82 void setUsername(const char *user)
83 {_username = user;}
84 void setJobName(const char *job) {_jobname = job;}
69 public:
70 /**
71 * Load the printer configuration requested.
72 * @return TRUE if the information have been successfully loaded.
73 * Otherwise it returns FALSE.
74 */
75 bool loadInformation(const Request& request);
8576
86 long double pageSizeX() const
87 {return _convertX(_pageSizeX);}
88 long double pageSizeY() const
89 {return _convertY(_pageSizeY);}
90 long double marginX() const
91 {return _convertX(_marginX);};
92 long double marginY() const
93 {return _convertY(_marginY);};
94 long double areaX() const
95 {return _convertX(_areaX);}
96 long double areaY() const
97 {return _convertY(_areaY);}
98 unsigned long printableX() const
99 {return (unsigned long)_convertX(_printableX);}
100 unsigned long printableY() const
101 {return (unsigned long)_convertY(_printableY);}
102 unsigned long resolutionX() const {return _xresolution;}
103 unsigned long resolutionY() const {return _yresolution;}
104 unsigned long bandHeight() const {return _bandHeight;}
77 /**
78 * Send the PJL header.
79 * The PJL header will be sent to STDOUT. Like the other methods which
80 * send data to the printer, if you need to redirect the data to
81 * somewhere else, use the freopen function to redirect STDOUT.
82 * @return TRUE if it succeed. Otherwise it returns FALSE.
83 */
84 bool sendPJLHeader(const Request& request) const;
85 /**
86 * Send the PJL footer.
87 * The PJL footer will be sent to STDOUT.
88 * @return TRUE if it succeed. Otherwise it returns FALSE.
89 */
90 bool sendPJLFooter(const Request& request) const;
10591
106 unsigned char paperType() const {return _paperType;}
107 unsigned char paperSource() const {return _paperSource;}
108 unsigned short duplex() const {return _duplex;}
109 unsigned char compVersion() const {return _compVersion;}
92 public:
93 /**
94 * @return the manufacturer name.
95 */
96 const char* manufacturer() const {return _manufacturer;}
97 /**
98 * @return the model name.
99 */
100 const char* model() const {return _model;}
101 /**
102 * @return the height of a band.
103 */
104 unsigned long bandHeight() const {return _bandHeight;}
105 /**
106 * @return the maximum size of a packet.
107 */
108 unsigned long packetSize() const {return _packetSize;}
109 /**
110 * @return the QPDL version.
111 */
112 unsigned long qpdlVersion() const {return _qpdlVersion;}
113 /**
114 * @return TRUE if this printer is a color printer. Otherwise it returns
115 * FALSE.
116 */
117 bool color() const {return _color;}
118 /**
119 * @return the paper source.
120 */
121 unsigned char paperSource() const {return _paperSource;}
122 /**
123 * @return the page width.
124 */
125 float pageWidth() const {return _pageWidth;}
126 /**
127 * @return the page height.
128 */
129 float pageHeight() const {return _pageHeight;}
130 /**
131 * @return the paper type.
132 */
133 unsigned char paperType() const {return _paperType;}
134 /**
135 * @return the unknown byte 1
136 */
137 unsigned char unknownByte1() const {return _unknownByte1;}
138 /**
139 * @return the unknown byte 2
140 */
141 unsigned char unknownByte2() const {return _unknownByte2;}
142 /**
143 * @return the unknown byte 3
144 */
145 unsigned char unknownByte3() const {return _unknownByte3;}
146 /**
147 * @return the hard margin of the printer in the X direction.
148 */
149 float hardMarginX() const {return _hardMarginX;}
150 /**
151 * @return the hard margin of the printer in the Y direction.
152 */
153 float hardMarginY() const {return _hardMarginY;}
110154
111 char docHeaderValues(unsigned long val) const
112 {return _docHeaderValues[val];}
113
114 bool isColorPrinter() const {return _color;}
115 unsigned char qpdlVersion() const {return _qpdlVersion;}
116155 };
117156
118 #endif /* PRINTER_H_ */
157 #endif /* _PRINTER_H_ */
119158
159 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
160
0 /*
1 * qpdl.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: qpdl.h 152 2008-02-02 21:00:53Z ap2c $
18 *
19 */
20 #ifndef _QPDL_H_
21 #define _QPDL_H_
22
23 class Request;
24 class Page;
25
26 /**
27 * Render a page and send the result to STDOUT.
28 * If the output needs to be redirected to a file, please use the
29 * freopen function to redirect the output to a specific place.
30 * @param request the request instance
31 * @param page the page instance
32 * @param lastPage set to TRUE if it's the last page (only used with manual
33 * duplex)
34 * @return TRUE if the page has been rendered into QPDL. Otherwise it returns
35 * FALSE.
36 */
37 extern bool renderPage(const Request& request, Page* page, bool lastPage=false);
38 #endif /* _QPDL_H_ */
39
40 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
41
+0
-77
include/raster.h less more
0 /*
1 * raster.h (C) 2006, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: raster.h 45 2006-11-26 03:15:59Z ap2c $
18 *
19 */
20 #ifndef RASTER_H_
21 #define RASTER_H_
22
23 #include "document.h"
24 #include <cups/raster.h>
25
26 class Raster : public Document
27 {
28 protected:
29 const char* _jobId;
30 const char* _user;
31 const char* _title;
32 const char* _copies;
33 const char* _options;
34 const char* _file;
35 int _fd;
36
37 cups_raster_t* _ras;
38 cups_page_header_t _header;
39
40 unsigned long _width;
41 unsigned long _height;
42 unsigned long _lineSize;
43 unsigned long _line;
44 unsigned long _page;
45 unsigned long _totalLines;
46
47 bool _color;
48
49
50 unsigned char* _lineBuffer;
51
52 public:
53 Raster(const char *job, const char *user, const char *title,
54 const char *copies, const char *options,
55 const char *file);
56 virtual ~Raster();
57
58 public:
59 virtual void unload();
60 virtual int load();
61 virtual int loadPage(Printer *printer);
62
63 virtual int readLine();
64
65 public:
66 virtual unsigned long width() const {return _width;}
67 virtual unsigned long height() const {return _height;}
68 virtual unsigned long lineSize() const {return _lineSize;}
69 virtual unsigned char* lineBuffer() const {return _lineBuffer;}
70
71 public:
72 virtual bool isColor() const {return _color;}
73 };
74
75 #endif /* RASTER_H_ */
76
0 /*
1 * rendering.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: rendering.h 151 2008-02-02 20:21:34Z ap2c $
18 *
19 */
20 #ifndef _RENDERING_H_
21 #define _RENDERING_H_
22
23 class Request;
24
25 /**
26 * Render the request.
27 * @param request the request
28 * @return TRUE if the request has been successfully rendered. Otherwise it
29 * returns FALSE.
30 */
31 extern bool render(Request& request);
32
33 #endif /* _RENDERING_H_ */
34
35 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */
36
0 /*
1 * request.h (C) 2006-2008, Aurélien Croc (AP²C)
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the
14 * Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 *
17 * $Id: request.h 151 2008-02-02 20:21:34Z ap2c $
18 *
19 */
20 #ifndef _REQUEST_H_
21 #define _REQUEST_H_
22
23 #include "printer.h"
24
25 class PPDFile;
26
27 /**
28 * @brief This class contains all the information about the requested job.
29 *
30 * During the job information loading, this class will instantiate @ref Printer
31 * and initialize it to have information on the printer which will be used to
32 * print the job.
33 * This instance is mainly used by the QPDL render.
34 */
35 class Request
36 {
37 public:
38 /**
39 * List the duplex modes.
40 */
41 enum Duplex {
42 /** Simplex mode. */
43 Simplex,
44 /** Duplex mode by the long edge. */
45 LongEdge,
46 /** Duplex mode by the short edge. */
47 ShortEdge,
48 /** Manual duplex mode by the long edge. */
49 ManualLongEdge,
50 /** Manual duplex mode by the short edge. */
51 ManualShortEdge,
52 };
53
54 protected:
55 PPDFile* _ppd;
56
57 const char* _username;
58 const char* _jobname;
59 const char* _jobtitle;
60 unsigned long _copiesNr;
61
62 Printer _printer;
63
64 Duplex _duplex;
65 bool _reverseDuplex;
66
67 public:
68 /**
69 * Initialize the instance.
70 */
71 Request();
72 /**
73 * Destroy the instance.
74 */
75 virtual ~Request();
76