Hello Gerel.
I've just started adapting the run length filter.
So the initialization function would be as follows,
##
pdf_status_t pdf_stm_f_rl_init (pdf_hash_t params, pdf_hash_t state);
###
Note that now we are using a void pointer for the internal state.
Now, suppose that I want to use that filter in 'decode mode'. So the params
argument should have a "mode" -> pdf_stm_f_rl_mode_t (enum). The question is,
should I add that parameter to the state hash ? I think I shouldn't since the
params is also given to the apply function anyways, and it's not
'state'.
You want to write _two_ different filters: a RunLength Encoding filter
and a RunLength Decoding filter.
Of course the best option would be to have a lot of generic code
working for both cases, but each filter should provide the init/apply
pair.
OTOH, regarding,
##
pdf_status_t
pdf_text_new_from_host (const pdf_char_t *str,
const pdf_size_t size,
const pdf_text_host_encoding_t enc,
pdf_text_t *text);
###
Do we need to give the host encoding as argument ? I thought that
the function itself would get it doing
"pdf_text_get_host_encoding()". Am I wrong ?
Just use pdf_text_get_host_encoding() as the third parameter. See
'pdf-fsys-disk.c' to find some examples of its use.