mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
videotestsrc: add gradient pattern
Makes a gradient between background and foreground color.
This commit is contained in:
parent
e115e5059b
commit
042b25542c
4 changed files with 33 additions and 1 deletions
|
@ -151,6 +151,7 @@ gst_video_test_src_pattern_get_type (void)
|
|||
{GST_VIDEO_TEST_SRC_BAR, "Bar", "bar"},
|
||||
{GST_VIDEO_TEST_SRC_PINWHEEL, "Pinwheel", "pinwheel"},
|
||||
{GST_VIDEO_TEST_SRC_SPOKES, "Spokes", "spokes"},
|
||||
{GST_VIDEO_TEST_SRC_GRADIENT, "Gradient", "gradient"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
|
@ -423,6 +424,9 @@ gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
|
|||
case GST_VIDEO_TEST_SRC_SPOKES:
|
||||
videotestsrc->make_image = gst_video_test_src_spokes;
|
||||
break;
|
||||
case GST_VIDEO_TEST_SRC_GRADIENT:
|
||||
videotestsrc->make_image = gst_video_test_src_gradient;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
|
|
@ -107,7 +107,8 @@ typedef enum {
|
|||
GST_VIDEO_TEST_SRC_SMPTE100,
|
||||
GST_VIDEO_TEST_SRC_BAR,
|
||||
GST_VIDEO_TEST_SRC_PINWHEEL,
|
||||
GST_VIDEO_TEST_SRC_SPOKES
|
||||
GST_VIDEO_TEST_SRC_SPOKES,
|
||||
GST_VIDEO_TEST_SRC_GRADIENT
|
||||
} GstVideoTestSrcPattern;
|
||||
|
||||
typedef struct _GstVideoTestSrc GstVideoTestSrc;
|
||||
|
|
|
@ -1336,3 +1336,29 @@ gst_video_test_src_spokes (GstVideoTestSrc * v, GstVideoFrame * frame)
|
|||
videotestsrc_convert_tmpline (p, frame, j);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_video_test_src_gradient (GstVideoTestSrc * v, GstVideoFrame * frame)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
paintinfo pi = PAINT_INFO_INIT;
|
||||
paintinfo *p = π
|
||||
struct vts_color_struct color;
|
||||
int w = frame->info.width, h = frame->info.height;
|
||||
|
||||
videotestsrc_setup_paintinfo (v, p, w, h);
|
||||
|
||||
color = p->colors[COLOR_BLACK];
|
||||
p->color = &color;
|
||||
|
||||
for (j = 0; j < h; j++) {
|
||||
int y = j * 255.0 / h;
|
||||
for (i = 0; i < w; i++) {
|
||||
p->tmpline_u8[i] = y;
|
||||
}
|
||||
videotestsrc_blend_line (v, p->tmpline, p->tmpline_u8,
|
||||
&p->foreground_color, &p->background_color, w);
|
||||
videotestsrc_convert_tmpline (p, frame, j);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,5 +82,6 @@ void gst_video_test_src_smpte100 (GstVideoTestSrc * v, GstVideoFrame *fra
|
|||
void gst_video_test_src_bar (GstVideoTestSrc * v, GstVideoFrame *frame);
|
||||
void gst_video_test_src_pinwheel (GstVideoTestSrc * v, GstVideoFrame * frame);
|
||||
void gst_video_test_src_spokes (GstVideoTestSrc * v, GstVideoFrame * frame);
|
||||
void gst_video_test_src_gradient (GstVideoTestSrc * v, GstVideoFrame * frame);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue