summaryrefslogtreecommitdiff
path: root/libavfilter/drawutils.h
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-03-28 15:26:45 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-04-04 16:16:09 +0200
commite8497a338ef50dec2cbd93f9b69bab33273a3611 (patch)
treefe9a31dd86c271eae31bd633db112f5e852b5b14 /libavfilter/drawutils.h
parente3e89b6d8b6c7a67fcde4c8ad6f4ad9155d14e6f (diff)
drawutils: implement uniform and mask blending.
Diffstat (limited to 'libavfilter/drawutils.h')
-rw-r--r--libavfilter/drawutils.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/libavfilter/drawutils.h b/libavfilter/drawutils.h
index 9e98f4e7a1..29aa94b0fb 100644
--- a/libavfilter/drawutils.h
+++ b/libavfilter/drawutils.h
@@ -50,6 +50,7 @@ typedef struct FFDrawContext {
enum PixelFormat format;
unsigned nb_planes;
int pixelstep[MAX_PLANES]; /*< offset between pixels */
+ uint8_t comp_mask[MAX_PLANES]; /*< bitmask of used non-alpha components */
uint8_t hsub[MAX_PLANES]; /*< horizontal subsamling */
uint8_t vsub[MAX_PLANES]; /*< vertical subsamling */
uint8_t hsub_max;
@@ -57,6 +58,7 @@ typedef struct FFDrawContext {
} FFDrawContext;
typedef struct FFDrawColor {
+ uint8_t rgba[4];
union {
uint32_t u32;
uint16_t u16;
@@ -101,6 +103,37 @@ void ff_fill_rectangle(FFDrawContext *draw, FFDrawColor *color,
int dst_x, int dst_y, int w, int h);
/**
+ * Blend a rectangle with an uniform color.
+ */
+void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color,
+ uint8_t *dst[], int dst_linesize[],
+ int dst_w, int dst_h,
+ int x0, int y0, int w, int h);
+
+/**
+ * Blend an alpha mask with an uniform color.
+ *
+ * @param draw draw context
+ * @param color color for the overlay;
+ * @param dst destination image
+ * @param dst_linesize line stride of the destination
+ * @param dst_w width of the destination image
+ * @param dst_h height of the destination image
+ * @param mask mask
+ * @param mask_linesize line stride of the mask
+ * @param mask_w width of the mask
+ * @param mask_h height of the mask
+ * @param l2depth log2 of depth of the mask (0 for 1bpp, 3 for 8bpp)
+ * @param endianness bit order of the mask (0: MSB to the left)
+ * @param x0 horizontal position of the overlay
+ * @param y0 vertical position of the overlay
+ */
+void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color,
+ uint8_t *dst[], int dst_linesize[], int dst_w, int dst_h,
+ uint8_t *mask, int mask_linesize, int mask_w, int mask_h,
+ int l2depth, unsigned endianness, int x0, int y0);
+
+/**
* Round a dimension according to subsampling.
*
* @param draw draw context