summaryrefslogtreecommitdiff
path: root/ext/pango/gsttextrender.h
blob: 66d37dbf8bec1be0e06dadc1e7f71e7d37df3b32 (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
#ifndef __GST_TEXT_RENDER_H__
#define __GST_TEXT_RENDER_H__

#include <gst/gst.h>
#include <pango/pangocairo.h>

G_BEGIN_DECLS

#define GST_TYPE_TEXT_RENDER            (gst_text_render_get_type())
#define GST_TEXT_RENDER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),\
                                        GST_TYPE_TEXT_RENDER, GstTextRender))
#define GST_TEXT_RENDER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),\
                                        GST_TYPE_TEXT_RENDER, GstTextRenderClass))
#define GST_TEXT_RENDER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),\
                                        GST_TYPE_TEXT_RENDER, GstTextRenderClass))
#define GST_IS_TEXT_RENDER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
                                        GST_TYPE_TEXT_RENDER))
#define GST_IS_TEXT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\
                                        GST_TYPE_TEXT_RENDER))

typedef struct _GstTextRender      GstTextRender;
typedef struct _GstTextRenderClass GstTextRenderClass;

/**
 * GstTextRenderVAlign:
 * @GST_TEXT_RENDER_VALIGN_BASELINE: draw text on the baseline
 * @GST_TEXT_RENDER_VALIGN_BOTTOM: draw text on the bottom
 * @GST_TEXT_RENDER_VALIGN_TOP: draw test on top
 *
 * Vertical alignment of the text.
 */
typedef enum {
    GST_TEXT_RENDER_VALIGN_BASELINE,
    GST_TEXT_RENDER_VALIGN_BOTTOM,
    GST_TEXT_RENDER_VALIGN_TOP
} GstTextRenderVAlign;

/**
 * GstTextRenderHAlign:
 * @GST_TEXT_RENDER_HALIGN_LEFT: align text left
 * @GST_TEXT_RENDER_HALIGN_CENTER: align text center
 * @GST_TEXT_RENDER_HALIGN_RIGHT: align text right
 *
 * Horizontal alignment of the text.
 */
typedef enum {
    GST_TEXT_RENDER_HALIGN_LEFT,
    GST_TEXT_RENDER_HALIGN_CENTER,
    GST_TEXT_RENDER_HALIGN_RIGHT
} GstTextRenderHAlign;

/**
 * GstTextRenderLineAlign:
 * @GST_TEXT_RENDER_LINE_ALIGN_LEFT: lines are left-aligned
 * @GST_TEXT_RENDER_LINE_ALIGN_CENTER: lines are center-aligned
 * @GST_TEXT_RENDER_LINE_ALIGN_RIGHT: lines are right-aligned
 *
 * Alignment of text lines relative to each other
 */
typedef enum {
    GST_TEXT_RENDER_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT,
    GST_TEXT_RENDER_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER,
    GST_TEXT_RENDER_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT
} GstTextRenderLineAlign;

/**
 * GstTextRender:
 *
 * Opaque textrender data structure.
 */
struct _GstTextRender {
    GstElement            element;

    GstPad               *sinkpad, *srcpad;
    gint                  width;
    gint                  height;
    PangoLayout          *layout;
    gdouble               shadow_offset;
    gdouble               outline_offset;
    guchar               *text_image;
    gint                  image_width;
    gint                  image_height;
    gint                  baseline_y;
    gboolean              use_ARGB;

    GstTextRenderVAlign     valign;
    GstTextRenderHAlign     halign;
    GstTextRenderLineAlign  line_align;

    gint xpad;
    gint ypad;
};

struct _GstTextRenderClass {
    GstElementClass parent_class;

    PangoContext *pango_context;
};

GType gst_text_render_get_type(void) G_GNUC_CONST;

G_END_DECLS

#endif /* __GST_TEXT_RENDER_H */