RTS API Documentation  1.10.11
switch_core_video.h
Go to the documentation of this file.
1 /*
2  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
3  * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
4  *
5  * Version: MPL 1.1
6  *
7  * The contents of this file are subject to the Mozilla Public License Version
8  * 1.1 (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  * http://www.mozilla.org/MPL/
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
18  *
19  * The Initial Developer of the Original Code is
20  * Seven Du <dujinfang@gmail.com>
21  * Portions created by the Initial Developer are Copyright (C)
22  * the Initial Developer. All Rights Reserved.
23  *
24  * Contributor(s):
25  * Anthony Minessale II <anthm@freeswitch.org>
26  *
27  *
28  * switch_core_video.h -- Core Video header
29  *
30  */
31 /*! \file switch_core_video.h
32  \brief video includes header
33 
34  The things powered by libvpx are renamed into the switch_ namespace to provide a cleaner
35  look to things and helps me to document what parts of video I am using I'd like to take this
36  opportunity to thank libvpx for all the awesome stuff it does and for making my life much easier.
37 
38 */
39 
40 #ifndef SWITCH_VIDEO_H
41 #define SWITCH_VIDEO_H
42 
43 #include <switch.h>
44 
46 
47 #define CHROMAKEY_MAX_MASK 25
48 
49 typedef enum {
50  SCV_FILTER_GRAY_FG = (1 << 0),
51  SCV_FILTER_GRAY_BG = (1 << 1),
52  SCV_FILTER_SEPIA_FG = (1 << 2),
53  SCV_FILTER_SEPIA_BG = (1 << 3),
54  SCV_FILTER_8BIT_FG = (1 << 4)
56 
57 
58 typedef enum {
65 
66 typedef enum {
78 
79 typedef enum {
86 
87 typedef struct switch_yuv_color_s {
88  uint8_t y;
89  uint8_t u;
90  uint8_t v;
92 
93 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
94 typedef struct switch_rgb_color_s {
95  uint8_t a;
96  uint8_t r;
97  uint8_t g;
98  uint8_t b;
100 #else
101 typedef struct switch_rgb_color_s {
102  uint8_t b;
103  uint8_t g;
104  uint8_t r;
105  uint8_t a;
107 #endif
108 
109 typedef struct switch_hsl_color_s {
110  double h;
111  double s;
112  double l;
114 
115 typedef struct {
116  double l;
117  double a;
118  double b;
120 
121 typedef struct {
122  double x;
123  double y;
124  double z;
126 
127 /**\brief Representation of a rectangle on a surface */
128 typedef struct switch_image_rect {
129  unsigned int x; /**< leftmost column */
130  unsigned int y; /**< topmost row */
131  unsigned int w; /**< width */
132  unsigned int h; /**< height */
134 
135 typedef enum {
138 
139 struct switch_png_opaque_s;
140 typedef struct switch_png_opaque_s switch_png_opaque_t;
141 typedef struct switch_png_s {
143  int w;
144  int h;
145 } switch_png_t;
146 
147 typedef enum {
148  SRM_NONE = 0, // No rotation.
149  SRM_90 = 90, // Rotate 90 degrees clockwise.
150  SRM_180 = 180, // Rotate 180 degrees.
151  SRM_270 = 270, // Rotate 270 degrees clockwise.
153 
154 
155 /*!\brief Open a descriptor, allocating storage for the underlying image
156 *
157 * Returns a descriptor for storing an image of the given format. The
158 * storage for the descriptor is allocated on the heap.
159 *
160 * \param[in] img Pointer to storage for descriptor. If this parameter
161 * is NULL, the storage for the descriptor will be
162 * allocated on the heap.
163 * \param[in] fmt Format for the image
164 * \param[in] d_w Width of the image
165 * \param[in] d_h Height of the image
166 * \param[in] align Alignment, in bytes, of the image buffer and
167 * each row in the image(stride).
168 *
169 * \return Returns a pointer to the initialized image descriptor. If the img
170 * parameter is non-null, the value of the img parameter will be
171 * returned.
172 */
175  unsigned int d_w,
176  unsigned int d_h,
177  unsigned int align);
178 
179 /*!\brief Open a descriptor, using existing storage for the underlying image
180 *
181 * Returns a descriptor for storing an image of the given format. The
182 * storage for descriptor has been allocated elsewhere, and a descriptor is
183 * desired to "wrap" that storage.
184 *
185 * \param[in] img Pointer to storage for descriptor. If this parameter
186 * is NULL, the storage for the descriptor will be
187 * allocated on the heap.
188 * \param[in] fmt Format for the image
189 * \param[in] d_w Width of the image
190 * \param[in] d_h Height of the image
191 * \param[in] align Alignment, in bytes, of each row in the image.
192 * \param[in] img_data Storage to use for the image
193 *
194 * \return Returns a pointer to the initialized image descriptor. If the img
195 * parameter is non-null, the value of the img parameter will be
196 * returned.
197 */
200  unsigned int d_w,
201  unsigned int d_h,
202  unsigned int align,
203  unsigned char *img_data);
204 
205 
206 /*!\brief Set the rectangle identifying the displayed portion of the image
207 *
208 * Updates the displayed rectangle (aka viewport) on the image surface to
209 * match the specified coordinates and size.
210 *
211 * \param[in] img Image descriptor
212 * \param[in] x leftmost column
213 * \param[in] y topmost row
214 * \param[in] w width
215 * \param[in] h height
216 *
217 * \return 0 if the requested rectangle is valid, nonzero otherwise.
218 */
220  unsigned int x,
221  unsigned int y,
222  unsigned int w,
223  unsigned int h);
224 
225 /*!\brief patch a small img to a big IMG at position x,y
226 *
227 * Both IMG and img must be non-NULL
228 *
229 * \param[in] IMG The BIG Image descriptor
230 * \param[in] img The small Image descriptor
231 * \param[in] x Leftmost pos to patch to
232 * \param[in] y Topmost pos to patch to
233 */
234 SWITCH_DECLARE(void) switch_img_patch(switch_image_t *IMG, switch_image_t *img, int x, int y);
235 
237 
238 /*!\brief patch a small img to a big IMG at position x,y
239 *
240 * Both IMG and img must be non-NULL
241 *
242 * \param[in] IMG The BIG Image descriptor
243 * \param[in] img The small Image descriptor
244 * \param[in] x Leftmost pos to patch to
245 * \param[in] y Topmost pos to patch to
246 * \param[in] noalpha skip writing to non-transparent pixels
247 */
248 SWITCH_DECLARE(void) switch_img_patch_rgb(switch_image_t *IMG, switch_image_t *img, int x, int y, switch_bool_t noalpha);
249 
250 /*!\brief patch part of a small img (x,y,w,h) to a big IMG at position X,Y
251 *
252 * Both IMG and img must be non-NULL
253 *
254 * \param[in] IMG The BIG Image descriptor
255 * \param[in] X Leftmost pos to patch to IMG
256 * \param[in] Y Topmost pos to patch to IMG
257 * \param[in] img The small Image descriptor
258 * \param[in] x Leftmost pos to be read from img
259 * \param[in] y Topmost pos to be read from
260 * \param[in] w Max width to be read from img
261 * \param[in] h Max height to be read from img
262 */
263 
264 SWITCH_DECLARE(void) switch_img_patch_rect(switch_image_t *IMG, int X, int Y, switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
265 
266 /*!\brief Copy image to a new image
267 *
268 * if new_img is NULL, a new image is allocated
269 * if new_img is not NULL but not the same size as img,
270 * new_img is destroyed and a new new_img is allocated
271 * else, copy the img data to the new_img
272 *
273 * \param[in] img Image descriptor
274 * \param[out] new_img New Image descriptor, NULL if out of memory
275 */
276 
279 
280 /*!\brief Flip the image vertically (top for bottom)
281 *
282 * Adjusts the image descriptor's pointers and strides to make the image
283 * be referenced upside-down.
284 *
285 * \param[in] img Image descriptor
286 *
287 * \return 0 if the requested rectangle is valid, nonzero otherwise.
288 */
290 
291 /*!\brief Close an image descriptor
292 *
293 * Frees all allocated storage associated with an image descriptor.
294 *
295 * \param[in] img pointer to pointer of Image descriptor
296 */
298 
299 SWITCH_DECLARE(void) switch_img_draw_text(switch_image_t *IMG, int x, int y, switch_rgb_color_t color, uint16_t font_size, char *text);
300 
301 SWITCH_DECLARE(void) switch_img_add_text(void *buffer, int w, int x, int y, char *s);
302 
303 /*!\brief Copy part of an image to a new image
304 *
305 *
306 * \param[in] img Image descriptor
307 * \param[in] x Leftmost pos to be read from
308 * \param[in] y Topmost pos to be read from
309 * \param[in] w Max width to be read from
310 * \param[in] h Max height to be read from
311 *
312 * \return NULL if failed to copy, otherwise a valid image descriptor.
313 */
314 SWITCH_DECLARE(switch_image_t *) switch_img_copy_rect(switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
315 
316 /*!\brief Fill image with color
317 *
318 * \param[in] img Image descriptor
319 * \param[in] x Leftmost pos to be read from
320 * \param[in] y Topmost pos to be read from
321 * \param[in] w Max width to be read from
322 * \param[in] h Max height to be read from
323 * \param[in] color RGB color
324 */
325 SWITCH_DECLARE(void) switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color);
327 
328 SWITCH_DECLARE(void) switch_img_gray(switch_image_t *img, int x, int y, int w, int h);
329 SWITCH_DECLARE(void) switch_img_sepia(switch_image_t *img, int x, int y, int w, int h);
330 
331 SWITCH_DECLARE(void) switch_img_fill_noalpha(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color);
332 
333 /*!\brief Set RGB color with a string
334 *
335 * Color string should be in #RRGGBB format
336 *
337 * \param[out] color RGB color pointer
338 * \param[in] color_str Color string in #RRGGBB format
339 */
340 SWITCH_DECLARE(void) switch_color_set_rgb(switch_rgb_color_t *color, const char *color_str);
341 
342 /*!\brief Set YUV color with a string
343 *
344 * Color string should be in #RRGGBB format
345 *
346 * \param[out] color YUV color pointer
347 * \param[in] color_str Color string in #RRGGBB format
348 */
349 SWITCH_DECLARE(void) switch_color_set_yuv(switch_yuv_color_t *color, const char *color_str);
350 
351 /*!\brief Created a text handle
352 *
353 * \param[out] handleP Pointer to the text handle pointer
354 * \param[in] font_family Font family
355 * \param[in] font_color Font color in #RRGGBB format
356 * \param[in] bgcolor Background color in #RRGGBB format
357 * \param[in] font_size Font size in point
358 * \param[in] angle Angle to rotate
359 * \param[in] pool APR memory pool
360 */
362  const char *font_color, const char *bgcolor, uint16_t font_size, double angle, switch_memory_pool_t *pool);
363 
364 /*!\brief Free a text handle
365 *
366 * \param[in] handleP Pointer to the text handle pointer
367 */
369 
370 /*!\brief Render text to an img
371 *
372 * \param[in] handle Pointer to the text handle pointer
373 * \param[in] img The image to be render text on
374 * \param[in] x Leftmost position
375 * \param[in] y Topmost position
376 * \param[in] text Text to render
377 * \param[in] font_family Font to use, NULL to use the handle font
378 * \param[in] font_color Font color, NULL to use the handle color
379 * \param[in] bgcolor Background color, NULL for transparency
380 * \param[in] font_size Font size in point
381 * \param[in] angle Angle to rotate
382 */
383 
385  int x, int y, const char *text,
386  const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle);
387 
388 
390 
392 SWITCH_DECLARE(switch_image_t *) switch_img_read_png(const char *file_name, switch_img_fmt_t img_fmt);
395 SWITCH_DECLARE(switch_status_t) switch_png_open(switch_png_t **pngP, const char *file_name);
398 SWITCH_DECLARE(switch_status_t) switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality);
399 
400 /*!\brief Read an image file to switch_image_t */
402 /*!\brief Write an image file, supported formats png,jpg,bmp,tga,hdr
403 * \param[in] img The image descriptor
404 * \param[in] file_name The file_name to write
405 * \param[in] quality Only used in jpg, 1 ~ 100
406 */
407 SWITCH_DECLARE(switch_status_t) switch_img_write_to_file(switch_image_t *img, const char* file_name, int quality);
408 
409 /*!\brief put a small img over a big IMG at position x,y, with alpha transparency
410 *
411 * Both IMG and img must be non-NULL
412 *
413 * \param[in] IMG The BIG Image descriptor
414 * \param[in] img The small Image descriptor
415 * \param[in] x Leftmost pos
416 * \param[in] y Topmost pos
417 * \param[in] percent Alaha value from 0(completely transparent) to 100(opaque)
418 */
419 SWITCH_DECLARE(void) switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent);
420 
422 SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_image_t **destP, int width, int height);
423 SWITCH_DECLARE(switch_status_t) switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit);
424 SWITCH_DECLARE(void) switch_img_calc_fit(switch_image_t *src, int width, int height, int *new_wP, int *new_hP);
425 SWITCH_DECLARE(switch_img_position_t) parse_img_position(const char *name);
426 SWITCH_DECLARE(switch_img_fit_t) parse_img_fit(const char *name);
427 SWITCH_DECLARE(void) switch_img_find_position(switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP);
428 
429 /*!\brief convert img to raw format
430 *
431 * dest should be pre-allocated and big enough for the target fmt
432 *
433 * \param[in] src The image descriptor
434 * \param[in] dest The target memory address
435 * \param[in] stride Bytes in a row for the destination. Pass 0 if the buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
436 * \param[in] fmt The target format
437 */
439 /*!\brief convert raw memory to switch_img_t
440 *
441 * if dest is NULL then a new img is created, user should destroy it later,
442 * otherwize it will re-used the dest img, and the dest img size must match the src width and height,
443 * width and height can be 0 in the latter case and it will figure out according to the dest img
444 *
445 * \param[in] dest The image descriptor
446 * \param[in] src The raw data memory address
447 * \param[in] fmt The raw data format
448 * \param[in] width The raw data width
449 * \param[in] height The raw data height
450 */
451 SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t** destP, void *src, switch_img_fmt_t fmt, int width, int height);
452 SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_bool_t full, const char *text);
453 
454 SWITCH_DECLARE(switch_image_t *) switch_img_read_file(const char* file_name);
455 SWITCH_DECLARE(switch_status_t) switch_img_letterbox(switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color);
457 
458 /*!\brief I420 to I420 Copy*/
459 
460 SWITCH_DECLARE(switch_status_t) switch_I420_copy(const uint8_t* src_y, int src_stride_y,
461  const uint8_t* src_u, int src_stride_u,
462  const uint8_t* src_v, int src_stride_v,
463  uint8_t* dst_y, int dst_stride_y,
464  uint8_t* dst_u, int dst_stride_u,
465  uint8_t* dst_v, int dst_stride_v,
466  int width, int height);
467 SWITCH_DECLARE(switch_status_t) switch_I420_copy2(uint8_t *src_planes[], int src_stride[],
468  uint8_t *dst_planes[], int dst_stride[],
469  int width, int height);
470 
471 /*!\brief I420 to ARGB Convertion*/
472 
473 SWITCH_DECLARE(switch_status_t) switch_I420ToARGB(const uint8_t *src_y, int src_stride_y,
474  const uint8_t *src_u, int src_stride_u,
475  const uint8_t *src_v, int src_stride_v,
476  uint8_t *dst_argb, int dst_stride_argb,
477  int width, int height);
478 
479 SWITCH_DECLARE(switch_status_t) switch_RGBAToARGB(const uint8_t* src_frame, int src_stride_frame,
480  uint8_t* dst_argb, int dst_stride_argb,
481  int width, int height);
482 SWITCH_DECLARE(switch_status_t) switch_ABGRToARGB(const uint8_t* src_frame, int src_stride_frame,
483  uint8_t* dst_argb, int dst_stride_argb,
484  int width, int height);
485 SWITCH_DECLARE(switch_status_t) switch_ARGBToARGB(const uint8_t* src_frame, int src_stride_frame,
486  uint8_t* dst_argb, int dst_stride_argb,
487  int width, int height);
488 
489 /*!\brief chromakey an img, img must be RGBA and return modified img */
490 
491 SWITCH_DECLARE(void) switch_img_chromakey(switch_image_t *img, switch_rgb_color_t *mask, int threshold);
493 
494 SWITCH_DECLARE(switch_status_t) switch_chromakey_autocolor(switch_chromakey_t *ck, switch_shade_t autocolor, uint32_t threshold);
501 SWITCH_DECLARE(switch_shade_t) switch_chromakey_str2shade(switch_chromakey_t *ck, const char *shade_name);
502 
504 
506 #endif
507 /* For Emacs:
508  * Local Variables:
509  * mode:c
510  * indent-tabs-mode:t
511  * tab-width:4
512  * c-basic-offset:4
513  * End:
514  * For VIM:
515  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
516  */
void switch_img_gray(switch_image_t *img, int x, int y, int w, int h)
switch_status_t switch_I420_copy2(uint8_t *src_planes[], int src_stride[], uint8_t *dst_planes[], int dst_stride[], int width, int height)
Image Descriptor.
Definition: switch_image.h:88
void switch_img_patch(switch_image_t *IMG, switch_image_t *img, int x, int y)
patch a small img to a big IMG at position x,y
void switch_img_chromakey(switch_image_t *img, switch_rgb_color_t *mask, int threshold)
chromakey an img, img must be RGBA and return modified img
void switch_core_video_parse_filter_string(switch_core_video_filter_t *filters, const char *filter_str)
switch_status_t switch_img_data_url(switch_image_t *img, char **urlP, const char *type, int quality)
void switch_img_patch_rect(switch_image_t *IMG, int X, int Y, switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h)
patch part of a small img (x,y,w,h) to a big IMG at position X,Y
switch_img_position_t parse_img_position(const char *name)
void switch_img_free(switch_image_t **img)
Close an image descriptor.
void switch_chromakey_process(switch_chromakey_t *ck, switch_image_t *img)
#define SWITCH_END_EXTERN_C
Definition: switch.h:43
void switch_color_set_yuv(switch_yuv_color_t *color, const char *color_str)
Set YUV color with a string.
switch_bool_t switch_core_has_video(void)
struct switch_png_s switch_png_t
switch_status_t switch_ARGBToARGB(const uint8_t *src_frame, int src_stride_frame, uint8_t *dst_argb, int dst_stride_argb, int width, int height)
switch_status_t switch_I420ToARGB(const uint8_t *src_y, int src_stride_y, const uint8_t *src_u, int src_stride_u, const uint8_t *src_v, int src_stride_v, uint8_t *dst_argb, int dst_stride_argb, int width, int height)
I420 to ARGB Convertion.
switch_bool_t
Definition: switch_types.h:437
const cJSON *const b
Definition: switch_cJSON.h:243
switch_memory_pool_t * pool
Representation of a rectangle on a surface.
void switch_img_calc_fit(switch_image_t *src, int width, int height, int *new_wP, int *new_hP)
switch_status_t switch_img_txt_handle_create(switch_img_txt_handle_t **handleP, const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle, switch_memory_pool_t *pool)
Created a text handle.
void switch_img_fill_noalpha(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
void switch_img_find_position(switch_img_position_t pos, int sw, int sh, int iw, int ih, int *xP, int *yP)
switch_image_t * switch_chromakey_cache_image(switch_chromakey_t *ck)
void switch_chromakey_set_default_threshold(switch_chromakey_t *ck, uint32_t threshold)
switch_image_t * switch_img_alloc(switch_image_t *img, switch_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align)
Open a descriptor, allocating storage for the underlying image.
void switch_png_free(switch_png_t **pngP)
int cJSON_bool fmt
Definition: switch_cJSON.h:150
struct switch_image_rect switch_image_rect_t
Representation of a rectangle on a surface.
switch_png_opaque_t * pvt
switch_img_fit_t parse_img_fit(const char *name)
void switch_img_rotate_copy(switch_image_t *img, switch_image_t **new_img, switch_image_rotation_mode_t mode)
switch_status_t switch_img_mirror(switch_image_t *src, switch_image_t **destP)
switch_status_t switch_chromakey_autocolor(switch_chromakey_t *ck, switch_shade_t autocolor, uint32_t threshold)
switch_img_fit_t
struct switch_hsl_color_s switch_hsl_color_t
void switch_img_draw_text(switch_image_t *IMG, int x, int y, switch_rgb_color_t color, uint16_t font_size, char *text)
switch_img_position_t
void switch_img_copy(switch_image_t *img, switch_image_t **new_img)
Copy image to a new image.
switch_status_t switch_img_fit(switch_image_t **srcP, int width, int height, switch_img_fit_t fit)
switch_status_t switch_img_to_raw(switch_image_t *src, void *dest, int stride, switch_img_fmt_t fmt)
convert img to raw format
switch_byte_t switch_byte_t uint32_t switch_bitpack_mode_t mode
switch_image_t * switch_img_read_png(const char *file_name, switch_img_fmt_t img_fmt)
void switch_img_patch_rgb(switch_image_t *IMG, switch_image_t *img, int x, int y, switch_bool_t noalpha)
patch a small img to a big IMG at position x,y
switch_shade_t switch_chromakey_str2shade(switch_chromakey_t *ck, const char *shade_name)
switch_status_t switch_png_patch_img(switch_png_t *use_png, switch_image_t *img, int x, int y)
switch_image_t * switch_img_copy_rect(switch_image_t *img, uint32_t x, uint32_t y, uint32_t w, uint32_t h)
Copy part of an image to a new image.
struct switch_png_opaque_s switch_png_opaque_t
switch_status_t switch_img_scale(switch_image_t *src, switch_image_t **destP, int width, int height)
void switch_img_patch_hole(switch_image_t *IMG, switch_image_t *img, int x, int y, switch_image_rect_t *rect)
switch_status_t switch_img_letterbox(switch_image_t *img, switch_image_t **imgP, int width, int height, const char *color)
void switch_img_attenuate(switch_image_t *img)
void switch_color_set_rgb(switch_rgb_color_t *color, const char *color_str)
Set RGB color with a string.
vpx_img_fmt_t switch_img_fmt_t
Definition: switch_vpx.h:91
switch_status_t switch_I420_copy(const uint8_t *src_y, int src_stride_y, const uint8_t *src_u, int src_stride_u, const uint8_t *src_v, int src_stride_v, uint8_t *dst_y, int dst_stride_y, uint8_t *dst_u, int dst_stride_u, uint8_t *dst_v, int dst_stride_v, int width, int height)
I420 to I420 Copy.
switch_status_t switch_img_from_raw(switch_image_t **destP, void *src, switch_img_fmt_t fmt, int width, int height)
convert raw memory to switch_img_t
void switch_img_sepia(switch_image_t *img, int x, int y, int w, int h)
struct switch_rgb_color_s switch_rgb_color_t
switch_status_t
Common return values.
switch_status_t switch_chromakey_clear_colors(switch_chromakey_t *ck)
void switch_img_fill(switch_image_t *img, int x, int y, int w, int h, switch_rgb_color_t *color)
Fill image with color.
switch_status_t switch_png_open(switch_png_t **pngP, const char *file_name)
void switch_img_8bit(switch_image_t *img)
Main Library Header.
void switch_img_txt_handle_destroy(switch_img_txt_handle_t **handleP)
Free a text handle.
#define SWITCH_DECLARE(type)
switch_convert_fmt_t
switch_status_t switch_chromakey_create(switch_chromakey_t **ckP)
switch_status_t switch_ABGRToARGB(const uint8_t *src_frame, int src_stride_frame, uint8_t *dst_argb, int dst_stride_argb, int width, int height)
switch_status_t switch_img_write_to_file(switch_image_t *img, const char *file_name, int quality)
Write an image file, supported formats png,jpg,bmp,tga,hdr.
char * buffer
Definition: switch_cJSON.h:153
switch_status_t switch_img_data_url_png(switch_image_t *img, char **urlP)
switch_status_t switch_img_write_png(switch_image_t *img, char *file_name)
switch_image_t * switch_img_read_from_file(const char *file_name, switch_img_fmt_t img_fmt)
Read an image file to switch_image_t.
switch_image_t * switch_img_read_file(const char *file_name)
switch_image_rotation_mode_t
void switch_img_overlay(switch_image_t *IMG, switch_image_t *img, int x, int y, uint8_t percent)
put a small img over a big IMG at position x,y, with alpha transparency
struct fspr_pool_t switch_memory_pool_t
const char *const name
Definition: switch_cJSON.h:250
switch_status_t switch_chromakey_add_color(switch_chromakey_t *ck, switch_rgb_color_t *color, uint32_t threshold)
switch_image_t * switch_img_write_text_img(int w, int h, switch_bool_t full, const char *text)
switch_status_t switch_RGBAToARGB(const uint8_t *src_frame, int src_stride_frame, uint8_t *dst_argb, int dst_stride_argb, int width, int height)
void switch_img_add_text(void *buffer, int w, int x, int y, char *s)
struct switch_yuv_color_s switch_yuv_color_t
void switch_img_rotate(switch_image_t **img, switch_image_rotation_mode_t mode)
Flip the image vertically (top for bottom)
switch_status_t switch_chromakey_destroy(switch_chromakey_t **ckP)
switch_image_t * switch_img_read_png_from_memory(void *mem, size_t size, switch_img_fmt_t img_fmt)
switch_image_t * switch_img_wrap(switch_image_t *img, switch_img_fmt_t fmt, unsigned int d_w, unsigned int d_h, unsigned int align, unsigned char *img_data)
Open a descriptor, using existing storage for the underlying image.
uint32_t switch_img_txt_handle_render(switch_img_txt_handle_t *handle, switch_image_t *img, int x, int y, const char *text, const char *font_family, const char *font_color, const char *bgcolor, uint16_t font_size, double angle)
Render text to an img.
switch_shade_t
int switch_img_set_rect(switch_image_t *img, unsigned int x, unsigned int y, unsigned int w, unsigned int h)
Set the rectangle identifying the displayed portion of the image.
#define SWITCH_BEGIN_EXTERN_C
Definition: switch.h:42
switch_core_video_filter_t