1 #ifndef __GST_TEXT_RENDER_H__ 2 #define __GST_TEXT_RENDER_H__ 3 4 #include <gst/gst.h> 5 #include <pango/pangocairo.h> 6 7 G_BEGIN_DECLS 8 9 #define GST_TYPE_TEXT_RENDER (gst_text_render_get_type()) 10 #define GST_TEXT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\ 11 GST_TYPE_TEXT_RENDER, GstTextRender)) 12 #define GST_TEXT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\ 13 GST_TYPE_TEXT_RENDER, GstTextRenderClass)) 14 #define GST_TEXT_RENDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\ 15 GST_TYPE_TEXT_RENDER, GstTextRenderClass)) 16 #define GST_IS_TEXT_RENDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\ 17 GST_TYPE_TEXT_RENDER)) 18 #define GST_IS_TEXT_RENDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),\ 19 GST_TYPE_TEXT_RENDER)) 20 21 typedef struct _GstTextRender GstTextRender; 22 typedef struct _GstTextRenderClass GstTextRenderClass; 23 24 /** 25 * GstTextRenderVAlign: 26 * @GST_TEXT_RENDER_VALIGN_BASELINE: draw text on the baseline 27 * @GST_TEXT_RENDER_VALIGN_BOTTOM: draw text on the bottom 28 * @GST_TEXT_RENDER_VALIGN_TOP: draw test on top 29 * 30 * Vertical alignment of the text. 31 */ 32 typedef enum { 33 GST_TEXT_RENDER_VALIGN_BASELINE, 34 GST_TEXT_RENDER_VALIGN_BOTTOM, 35 GST_TEXT_RENDER_VALIGN_TOP 36 } GstTextRenderVAlign; 37 38 /** 39 * GstTextRenderHAlign: 40 * @GST_TEXT_RENDER_HALIGN_LEFT: align text left 41 * @GST_TEXT_RENDER_HALIGN_CENTER: align text center 42 * @GST_TEXT_RENDER_HALIGN_RIGHT: align text right 43 * 44 * Horizontal alignment of the text. 45 */ 46 typedef enum { 47 GST_TEXT_RENDER_HALIGN_LEFT, 48 GST_TEXT_RENDER_HALIGN_CENTER, 49 GST_TEXT_RENDER_HALIGN_RIGHT 50 } GstTextRenderHAlign; 51 52 /** 53 * GstTextRenderLineAlign: 54 * @GST_TEXT_RENDER_LINE_ALIGN_LEFT: lines are left-aligned 55 * @GST_TEXT_RENDER_LINE_ALIGN_CENTER: lines are center-aligned 56 * @GST_TEXT_RENDER_LINE_ALIGN_RIGHT: lines are right-aligned 57 * 58 * Alignment of text lines relative to each other 59 */ 60 typedef enum { 61 GST_TEXT_RENDER_LINE_ALIGN_LEFT = PANGO_ALIGN_LEFT, 62 GST_TEXT_RENDER_LINE_ALIGN_CENTER = PANGO_ALIGN_CENTER, 63 GST_TEXT_RENDER_LINE_ALIGN_RIGHT = PANGO_ALIGN_RIGHT 64 } GstTextRenderLineAlign; 65 66 /** 67 * GstTextRender: 68 * 69 * Opaque textrender data structure. 70 */ 71 struct _GstTextRender { 72 GstElement element; 73 74 GstPad *sinkpad, *srcpad; 75 gint width; 76 gint height; 77 PangoLayout *layout; 78 gdouble shadow_offset; 79 gdouble outline_offset; 80 guchar *text_image; 81 gint image_width; 82 gint image_height; 83 gint baseline_y; 84 gboolean use_ARGB; 85 86 PangoContext *pango_context; 87 88 GstTextRenderVAlign valign; 89 GstTextRenderHAlign halign; 90 GstTextRenderLineAlign line_align; 91 92 gint xpad; 93 gint ypad; 94 95 GstEvent *segment_event; 96 }; 97 98 struct _GstTextRenderClass { 99 GstElementClass parent_class; 100 }; 101 102 GType gst_text_render_get_type(void) G_GNUC_CONST; 103 104 G_END_DECLS 105 106 #endif /* __GST_TEXT_RENDER_H */ 107