1 /*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg 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 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #ifndef AVFILTER_DRAWUTILS_H
20 #define AVFILTER_DRAWUTILS_H
21
22 /**
23 * @file
24 * misc drawing utilities
25 */
26
27 #include <stdint.h>
30
32
34
47
50 union {
56
57 /**
58 * Process alpha pixel component.
59 */
60 #define FF_DRAW_PROCESS_ALPHA 1
61
62 /**
63 * Init a draw context.
64 *
65 * Only a limited number of pixel formats are supported, if format is not
66 * supported the function will return an error.
67 * flags is combination of FF_DRAW_* flags.
68 * @return 0 for success, < 0 for error
69 */
71
72 /**
73 * Prepare a color.
74 */
76
77 /**
78 * Copy a rectangle from an image to another.
79 *
80 * The coordinates must be as even as the subsampling requires.
81 */
83 uint8_t *dst[], int dst_linesize[],
84 uint8_t *
src[],
int src_linesize[],
85 int dst_x, int dst_y, int src_x, int src_y,
87
88 /**
89 * Fill a rectangle with an uniform color.
90 *
91 * The coordinates must be as even as the subsampling requires.
92 * The color needs to be inited with ff_draw_color.
93 */
95 uint8_t *dst[], int dst_linesize[],
96 int dst_x,
int dst_y,
int w,
int h);
97
98 /**
99 * Blend a rectangle with an uniform color.
100 */
102 uint8_t *dst[], int dst_linesize[],
103 int dst_w, int dst_h,
104 int x0,
int y0,
int w,
int h);
105
106 /**
107 * Blend an alpha mask with an uniform color.
108 *
109 * @param draw draw context
110 * @param color color for the overlay;
111 * @param dst destination image
112 * @param dst_linesize line stride of the destination
113 * @param dst_w width of the destination image
114 * @param dst_h height of the destination image
115 * @param mask mask
116 * @param mask_linesize line stride of the mask
117 * @param mask_w width of the mask
118 * @param mask_h height of the mask
119 * @param l2depth log2 of depth of the mask (0 for 1bpp, 3 for 8bpp)
120 * @param endianness bit order of the mask (0: MSB to the left)
121 * @param x0 horizontal position of the overlay
122 * @param y0 vertical position of the overlay
123 */
125 uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h,
126 const uint8_t *
mask,
int mask_linesize,
int mask_w,
int mask_h,
127 int l2depth, unsigned endianness, int x0, int y0);
128
129 /**
130 * Round a dimension according to subsampling.
131 *
132 * @param draw draw context
133 * @param sub_dir 0 for horizontal, 1 for vertical
134 * @param round_dir 0 nearest, -1 round down, +1 round up
135 * @param value value to round
136 * @return the rounded value
137 */
140
141 /**
142 * Return the list of pixel formats supported by the draw functions.
143 *
144 * The flags are the same as ff_draw_init, i.e., none currently.
145 */
147
148 #endif /* AVFILTER_DRAWUTILS_H */