summaryrefslogtreecommitdiff
path: root/src/page.h
blob: 993029f8352366a8f6f4e2ab2a2d519b319d7cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
 * Copyright (C) 2009 Canonical Ltd.
 * Author: Robert Ancell <robert.ancell@canonical.com>
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
 * license.
 */

#ifndef _PAGE_H_
#define _PAGE_H_

#include <glib-object.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "scanner.h"

G_BEGIN_DECLS

#define PAGE_TYPE  (page_get_type ())
#define PAGE(obj)  (G_TYPE_CHECK_INSTANCE_CAST ((obj), PAGE_TYPE, Page))
    
typedef enum
{
    TOP_TO_BOTTOM,
    LEFT_TO_RIGHT,
    BOTTOM_TO_TOP,
    RIGHT_TO_LEFT
} ScanDirection;


typedef struct PagePrivate PagePrivate;

typedef struct
{
    GObject      parent_instance;
    PagePrivate *priv;
} Page;

typedef struct
{
    GObjectClass parent_class;

    void (*pixels_changed) (Page *page);
    void (*size_changed) (Page *page);
    void (*scan_line_changed) (Page *page);
    void (*scan_direction_changed) (Page *page);
    void (*crop_changed) (Page *page);
} PageClass;


GType page_get_type (void);

Page *page_new (gint width, gint height, gint dpi, ScanDirection scan_direction);

void page_set_page_info (Page *page, ScanPageInfo *info);

gint page_get_dpi (Page *page);

gint page_get_width (Page *page);

gint page_get_height (Page *page);

gint page_get_depth (Page *page);

gint page_get_n_channels (Page *page);

gint page_get_rowstride (Page *page);

const guchar *page_get_pixels (Page *page);

guchar *page_get_pixel (Page *page, gint x, gint y);

gboolean page_is_landscape (Page *page);

gint page_get_scan_width (Page *page);

gint page_get_scan_height (Page *page);

void page_set_color_profile (Page *page, const gchar *color_profile);

const gchar *page_get_color_profile (Page *page);

void page_start (Page *page);

gboolean page_is_scanning (Page *page);

gboolean page_has_data (Page *page);

gboolean page_is_color (Page *page);

gint page_get_scan_line (Page *page);

void page_parse_scan_line (Page *page, ScanLine *line);

void page_finish (Page *page);

ScanDirection page_get_scan_direction (Page *page);

void page_rotate_left (Page *page);

void page_rotate_right (Page *page);

void page_set_no_crop (Page *page);

void page_set_custom_crop (Page *page, gint width, gint height);

void page_set_named_crop (Page *page, const gchar *name);

void page_move_crop (Page *page, gint x, gint y);

void page_rotate_crop (Page *page);

gboolean page_has_crop (Page *page);

void page_get_crop (Page *page, gint *x, gint *y, gint *width, gint *height);

gchar *page_get_named_crop (Page *page);

GdkPixbuf *page_get_image (Page *page, gboolean apply_crop);

gboolean page_save (Page *page, const gchar *type, GFile *file, GError **error);

#endif /* _PAGE_H_ */