00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef AVFILTER_DRAWUTILS_H
00020 #define AVFILTER_DRAWUTILS_H
00021
00027 #include <stdint.h>
00028 #include "avfilter.h"
00029 #include "libavutil/pixfmt.h"
00030
00031 int ff_fill_rgba_map(uint8_t *rgba_map, enum PixelFormat pix_fmt);
00032
00033 int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w,
00034 uint8_t dst_color[4],
00035 enum PixelFormat pix_fmt, uint8_t rgba_color[4],
00036 int *is_packed_rgba, uint8_t rgba_map[4]);
00037
00038 void ff_draw_rectangle(uint8_t *dst[4], int dst_linesize[4],
00039 uint8_t *src[4], int pixelstep[4],
00040 int hsub, int vsub, int x, int y, int w, int h);
00041
00042 void ff_copy_rectangle(uint8_t *dst[4], int dst_linesize[4],
00043 uint8_t *src[4], int src_linesize[4], int pixelstep[4],
00044 int hsub, int vsub, int x, int y, int y2, int w, int h);
00045
00046 #define MAX_PLANES 4
00047
00048 typedef struct FFDrawContext {
00049 const struct AVPixFmtDescriptor *desc;
00050 enum PixelFormat format;
00051 unsigned nb_planes;
00052 int pixelstep[MAX_PLANES];
00053 uint8_t comp_mask[MAX_PLANES];
00054 uint8_t hsub[MAX_PLANES];
00055 uint8_t vsub[MAX_PLANES];
00056 uint8_t hsub_max;
00057 uint8_t vsub_max;
00058 } FFDrawContext;
00059
00060 typedef struct FFDrawColor {
00061 uint8_t rgba[4];
00062 union {
00063 uint32_t u32;
00064 uint16_t u16;
00065 uint8_t u8[4];
00066 } comp[MAX_PLANES];
00067 } FFDrawColor;
00068
00077 int ff_draw_init(FFDrawContext *draw, enum PixelFormat format, unsigned flags);
00078
00082 void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4]);
00083
00089 void ff_copy_rectangle2(FFDrawContext *draw,
00090 uint8_t *dst[], int dst_linesize[],
00091 uint8_t *src[], int src_linesize[],
00092 int dst_x, int dst_y, int src_x, int src_y,
00093 int w, int h);
00094
00101 void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color,
00102 uint8_t *dst[], int dst_linesize[],
00103 int dst_x, int dst_y, int w, int h);
00104
00108 void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color,
00109 uint8_t *dst[], int dst_linesize[],
00110 int dst_w, int dst_h,
00111 int x0, int y0, int w, int h);
00112
00131 void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color,
00132 uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h,
00133 uint8_t *mask, int mask_linesize, int mask_w, int mask_h,
00134 int l2depth, unsigned endianness, int x0, int y0);
00135
00145 int ff_draw_round_to_sub(FFDrawContext *draw, int sub_dir, int round_dir,
00146 int value);
00147
00153 AVFilterFormats *ff_draw_supported_pixel_formats(unsigned flags);
00154
00155 #endif