1. Changed license year
[apps/home/mobileprint.git] / mobileprint / preview_engine / include / preview_engine.h
1 /*
2 *  Mobileprint
3 *
4 * Copyright 2013  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.1 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9
10 * http://floralicense.org/license/
11
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 */
19
20 #ifndef _PREVIEW_ENGINE_H_INCLUDED_
21 #define _PREVIEW_ENGINE_H_INCLUDED_
22
23 struct preview_engine;
24 struct initial_preview_data;
25 enum preview_engine_event_status;
26
27 #include <Ecore.h>
28
29 #include <paper_size.h>
30 #include <pdfgen.h>
31
32 #include "preview_model.h"
33 #include "preview_task_model.h"
34
35
36 enum preview_engine_state {
37         PREVIEW_ENGINE_STATE_INITIAL = 0,
38         PREVIEW_ENGINE_STATE_PROCESSING,
39         PREVIEW_ENGINE_STATE_ERROR,
40         PREVIEW_ENGINE_STATE_READY,
41         PREVIEW_ENGINE_STATE_STOPPING,
42         PREVIEW_ENGINE_STATE_DELETED
43 };
44
45 enum preview_engine_event_status {
46         PREVIEW_ENGINE_EVENT_INITIAL_ERROR = -2,
47         PREVIEW_ENGINE_EVENT_PAGE_ERROR = -1,
48         PREVIEW_ENGINE_EVENT_PAGE_PROCESSING,
49         PREVIEW_ENGINE_EVENT_PAGE_READY,
50         PREVIEW_ENGINE_EVENT_INITIAL_READY,
51         PREVIEW_ENGINE_EVENT_EMPTY_PAGE_PROCESSING,
52         PREVIEW_ENGINE_EVENT_EMPTY_PAGE_READY
53         /* add cancelled state? */
54 };
55
56 struct preview_engine_event {
57         int page;
58         enum preview_engine_event_status status;
59 };
60
61 struct initial_preview_data {
62         struct preview_conf conf;
63
64         struct preview_engine *engine; /* not for use in thread */
65 };
66
67 struct preview_engine {
68         enum preview_engine_state state;
69         struct preview_task_model task_model;
70         struct preview_model p_model;
71
72         struct initial_preview_data *next_preview_data;
73
74         int page_ready_event_type;
75 };
76
77
78 int init_preview_engine(struct preview_engine *engine);
79 int process_preview_engine_file(struct preview_engine *engine,
80                                 char **const fnames, int files_count,
81                                 const char *ppd,
82                                 const struct paper_size_pts *paper_size,
83                                 const struct size_px *max_available_size_px,
84                                 enum page_orientation orientation, int n_up,
85                                 const struct page_scale *scale, int is_grayscale);
86 void preview_engine_send_page_message(struct preview_engine *engine,
87                                                                           enum preview_engine_event_status status, int page);
88 int preview_engine_init_done(struct preview_engine *engine,
89                                                          const struct preview_conf *conf);
90
91
92 #endif /* _PREVIEW_ENGINE_H_INCLUDED_ */
93