mirror of
https://github.com/mpv-player/mpv
synced 2025-01-11 17:39:38 +00:00
mp_image: add helper for clearing regions outside of a rectangle
Not sure if generally useful; the following commit uses it.
This commit is contained in:
parent
1be32529b1
commit
77f730f63c
@ -678,6 +678,20 @@ void mp_image_clear(struct mp_image *img, int x0, int y0, int x1, int y1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mp_image_clear_rc(struct mp_image *mpi, struct mp_rect rc)
|
||||||
|
{
|
||||||
|
mp_image_clear(mpi, rc.x0, rc.y0, rc.x1, rc.y1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the are of the image _not_ covered by rc.
|
||||||
|
void mp_image_clear_rc_inv(struct mp_image *mpi, struct mp_rect rc)
|
||||||
|
{
|
||||||
|
struct mp_rect clr[4];
|
||||||
|
int cnt = mp_rect_subtract(&(struct mp_rect){0, 0, mpi->w, mpi->h}, &rc, clr);
|
||||||
|
for (int n = 0; n < cnt; n++)
|
||||||
|
mp_image_clear_rc(mpi, clr[n]);
|
||||||
|
}
|
||||||
|
|
||||||
void mp_image_vflip(struct mp_image *img)
|
void mp_image_vflip(struct mp_image *img)
|
||||||
{
|
{
|
||||||
for (int p = 0; p < img->num_planes; p++) {
|
for (int p = 0; p < img->num_planes; p++) {
|
||||||
|
@ -137,6 +137,8 @@ void mp_image_setrefp(struct mp_image **p_img, struct mp_image *new_value);
|
|||||||
void mp_image_unrefp(struct mp_image **p_img);
|
void mp_image_unrefp(struct mp_image **p_img);
|
||||||
|
|
||||||
void mp_image_clear(struct mp_image *mpi, int x0, int y0, int x1, int y1);
|
void mp_image_clear(struct mp_image *mpi, int x0, int y0, int x1, int y1);
|
||||||
|
void mp_image_clear_rc(struct mp_image *mpi, struct mp_rect rc);
|
||||||
|
void mp_image_clear_rc_inv(struct mp_image *mpi, struct mp_rect rc);
|
||||||
void mp_image_crop(struct mp_image *img, int x0, int y0, int x1, int y1);
|
void mp_image_crop(struct mp_image *img, int x0, int y0, int x1, int y1);
|
||||||
void mp_image_crop_rc(struct mp_image *img, struct mp_rect rc);
|
void mp_image_crop_rc(struct mp_image *img, struct mp_rect rc);
|
||||||
void mp_image_vflip(struct mp_image *img);
|
void mp_image_vflip(struct mp_image *img);
|
||||||
|
Loading…
Reference in New Issue
Block a user