710ec7dad00f02bb08669365cdbb9554797933c9
[platform/upstream/gstreamer.git] / gst / compositor / blend.h
1 /*
2  * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 #ifndef __BLEND_H__
21 #define __BLEND_H__
22
23 #include <gst/gst.h>
24 #include <gst/video/video.h>
25
26 /**
27  * GstCompositorBlendMode:
28  * @COMPOSITOR_BLEND_MODE_SOURCE: Copy source
29  * @COMPOSITOR_BLEND_MODE_OVER: Normal blending
30  * @COMPOSITOR_BLEND_MODE_ADD: Alphas are simply added,
31  *
32  * The different modes compositor can use for blending.
33  */
34 typedef enum
35 {
36   COMPOSITOR_BLEND_MODE_SOURCE,
37   COMPOSITOR_BLEND_MODE_OVER,
38   COMPOSITOR_BLEND_MODE_ADD,
39 } GstCompositorBlendMode;
40
41 typedef void (*BlendFunction) (GstVideoFrame *srcframe, gint xpos, gint ypos, gdouble src_alpha, GstVideoFrame * destframe,
42     GstCompositorBlendMode mode);
43 typedef void (*FillCheckerFunction) (GstVideoFrame * frame);
44 typedef void (*FillColorFunction) (GstVideoFrame * frame, gint c1, gint c2, gint c3);
45
46 extern BlendFunction gst_compositor_blend_argb;
47 extern BlendFunction gst_compositor_blend_bgra;
48 #define gst_compositor_blend_ayuv gst_compositor_blend_argb
49 #define gst_compositor_blend_abgr gst_compositor_blend_argb
50 #define gst_compositor_blend_rgba gst_compositor_blend_bgra
51
52 extern BlendFunction gst_compositor_overlay_argb;
53 extern BlendFunction gst_compositor_overlay_bgra;
54 #define gst_compositor_overlay_ayuv gst_compositor_overlay_argb
55 #define gst_compositor_overlay_abgr gst_compositor_overlay_argb
56 #define gst_compositor_overlay_rgba gst_compositor_overlay_bgra
57 extern BlendFunction gst_compositor_blend_i420;
58 #define gst_compositor_blend_yv12 gst_compositor_blend_i420
59 extern BlendFunction gst_compositor_blend_nv12;
60 extern BlendFunction gst_compositor_blend_nv21;
61 extern BlendFunction gst_compositor_blend_y41b;
62 extern BlendFunction gst_compositor_blend_y42b;
63 extern BlendFunction gst_compositor_blend_y444;
64 extern BlendFunction gst_compositor_blend_rgb;
65 #define gst_compositor_blend_bgr gst_compositor_blend_rgb
66 extern BlendFunction gst_compositor_blend_rgbx;
67 #define gst_compositor_blend_bgrx gst_compositor_blend_rgbx
68 #define gst_compositor_blend_xrgb gst_compositor_blend_rgbx
69 #define gst_compositor_blend_xbgr gst_compositor_blend_rgbx
70 extern BlendFunction gst_compositor_blend_yuy2;
71 #define gst_compositor_blend_uyvy gst_compositor_blend_yuy2;
72 #define gst_compositor_blend_yvyu gst_compositor_blend_yuy2;
73
74 extern FillCheckerFunction gst_compositor_fill_checker_argb;
75 #define gst_compositor_fill_checker_abgr gst_compositor_fill_checker_argb
76 extern FillCheckerFunction gst_compositor_fill_checker_bgra;
77 #define gst_compositor_fill_checker_rgba gst_compositor_fill_checker_bgra
78 extern FillCheckerFunction gst_compositor_fill_checker_ayuv;
79 extern FillCheckerFunction gst_compositor_fill_checker_i420;
80 #define gst_compositor_fill_checker_yv12 gst_compositor_fill_checker_i420
81 extern FillCheckerFunction gst_compositor_fill_checker_nv12;
82 extern FillCheckerFunction gst_compositor_fill_checker_nv21;
83 extern FillCheckerFunction gst_compositor_fill_checker_y41b;
84 extern FillCheckerFunction gst_compositor_fill_checker_y42b;
85 extern FillCheckerFunction gst_compositor_fill_checker_y444;
86 extern FillCheckerFunction gst_compositor_fill_checker_rgb;
87 #define gst_compositor_fill_checker_bgr gst_compositor_fill_checker_rgb
88 extern FillCheckerFunction gst_compositor_fill_checker_rgbx;
89 #define gst_compositor_fill_checker_bgrx gst_compositor_fill_checker_rgbx
90 #define gst_compositor_fill_checker_xrgb gst_compositor_fill_checker_rgbx
91 #define gst_compositor_fill_checker_xbgr gst_compositor_fill_checker_rgbx
92 extern FillCheckerFunction gst_compositor_fill_checker_yuy2;
93 #define gst_compositor_fill_checker_yvyu gst_compositor_fill_checker_yuy2;
94 extern FillCheckerFunction gst_compositor_fill_checker_uyvy;
95
96 extern FillColorFunction gst_compositor_fill_color_argb;
97 extern FillColorFunction gst_compositor_fill_color_abgr;
98 extern FillColorFunction gst_compositor_fill_color_bgra;
99 extern FillColorFunction gst_compositor_fill_color_rgba;
100 extern FillColorFunction gst_compositor_fill_color_ayuv;
101 extern FillColorFunction gst_compositor_fill_color_i420;
102 extern FillColorFunction gst_compositor_fill_color_yv12;
103 extern FillColorFunction gst_compositor_fill_color_nv12;
104 #define gst_compositor_fill_color_nv21 gst_compositor_fill_color_nv12;
105 extern FillColorFunction gst_compositor_fill_color_y41b;
106 extern FillColorFunction gst_compositor_fill_color_y42b;
107 extern FillColorFunction gst_compositor_fill_color_y444;
108 extern FillColorFunction gst_compositor_fill_color_rgb;
109 extern FillColorFunction gst_compositor_fill_color_bgr;
110 extern FillColorFunction gst_compositor_fill_color_xrgb;
111 extern FillColorFunction gst_compositor_fill_color_xbgr;
112 extern FillColorFunction gst_compositor_fill_color_rgbx;
113 extern FillColorFunction gst_compositor_fill_color_bgrx;
114 extern FillColorFunction gst_compositor_fill_color_yuy2;
115 extern FillColorFunction gst_compositor_fill_color_yvyu;
116 extern FillColorFunction gst_compositor_fill_color_uyvy;
117
118 void gst_compositor_init_blend (void);
119
120 #endif /* __BLEND_H__ */