summaryrefslogtreecommitdiff
path: root/src/eom-transform.h
blob: 7df2df438394d6f1d221ea5020214ee34c363573 (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
#ifndef _EOM_TRANSFORM_H_
#define _EOM_TRANSFORM_H_

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

G_BEGIN_DECLS

#ifndef __EOM_JOB_DECLR__
#define __EOM_JOB_DECLR__
typedef struct _EomJob EomJob;
#endif

typedef enum {
	EOM_TRANSFORM_NONE,
	EOM_TRANSFORM_ROT_90,
	EOM_TRANSFORM_ROT_180,
	EOM_TRANSFORM_ROT_270,
	EOM_TRANSFORM_FLIP_HORIZONTAL,
	EOM_TRANSFORM_FLIP_VERTICAL,
	EOM_TRANSFORM_TRANSPOSE,
	EOM_TRANSFORM_TRANSVERSE
} EomTransformType;

#define EOM_TYPE_TRANSFORM          (eom_transform_get_type ())
#define EOM_TRANSFORM(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), EOM_TYPE_TRANSFORM, EomTransform))
#define EOM_TRANSFORM_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), EOM_TYPE_TRANSFORM, EomTransformClass))
#define EOM_IS_TRANSFORM(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOM_TYPE_TRANSFORM))
#define EOM_IS_TRANSFORM_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), EOM_TYPE_TRANSFORM))
#define EOM_TRANSFORM_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), EOM_TYPE_TRANSFORM, EomTransformClass))

/* =========================================

    GObjecat wrapper around an affine transformation

   ----------------------------------------*/

typedef struct _EomTransform EomTransform;
typedef struct _EomTransformClass EomTransformClass;
typedef struct _EomTransformPrivate EomTransformPrivate;

struct _EomTransform {
	GObject parent;

	EomTransformPrivate *priv;
};

struct _EomTransformClass {
	GObjectClass parent_klass;
};

GType         eom_transform_get_type (void) G_GNUC_CONST;

GdkPixbuf*    eom_transform_apply   (EomTransform *trans, GdkPixbuf *pixbuf, EomJob *job);
EomTransform* eom_transform_reverse (EomTransform *trans);
EomTransform* eom_transform_compose (EomTransform *trans, EomTransform *compose);
gboolean      eom_transform_is_identity (EomTransform *trans);

EomTransform* eom_transform_identity_new (void);
EomTransform* eom_transform_rotate_new (int degree);
EomTransform* eom_transform_flip_new   (EomTransformType type /* only EOM_TRANSFORM_FLIP_* are valid */);
#if 0
EomTransform* eom_transform_scale_new  (double sx, double sy);
#endif
EomTransform* eom_transform_new (EomTransformType trans);

EomTransformType eom_transform_get_transform_type (EomTransform *trans);

gboolean         eom_transform_get_affine (EomTransform *trans, cairo_matrix_t *affine);

G_END_DECLS

#endif /* _EOM_TRANSFORM_H_ */