4 * Copyright 2013 Samsung Electronics Co., Ltd
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
10 * http://floralicense.org/license/
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.
20 #ifndef _PREVIEW_ENGINE_H_INCLUDED_
21 #define _PREVIEW_ENGINE_H_INCLUDED_
23 struct preview_engine;
24 struct initial_preview_data;
25 enum preview_engine_event_status;
29 #include <paper_size.h>
32 #include "preview_model.h"
33 #include "preview_task_model.h"
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
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? */
56 struct preview_engine_event {
58 enum preview_engine_event_status status;
61 struct initial_preview_data {
62 struct preview_conf conf;
64 struct preview_engine *engine; /* not for use in thread */
67 struct preview_engine {
68 enum preview_engine_state state;
69 struct preview_task_model task_model;
70 struct preview_model p_model;
72 struct initial_preview_data *next_preview_data;
74 int page_ready_event_type;
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,
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);
92 #endif /* _PREVIEW_ENGINE_H_INCLUDED_ */