1 #ifndef MPLAYER_DRAW_BMP_H 2 #define MPLAYER_DRAW_BMP_H 3 4 #include "osd.h" 5 6 struct mp_rect; 7 struct mp_image; 8 struct mpv_global; 9 struct mp_draw_sub_cache; 10 11 struct mp_draw_sub_cache *mp_draw_sub_alloc(void *ta_parent, struct mpv_global *g); 12 13 // Render the sub-bitmaps in sbs_list to dst. sbs_list must have been rendered 14 // for an OSD resolution equivalent to dst's size (UB if not). 15 // Warning: if dst is a format with alpha, and dst is not set to MP_ALPHA_PREMUL 16 // (not done by default), this will be extremely slow. 17 // Warning: the caller is responsible for ensuring that dst is writable. 18 // cache: allocated instance; caches non-changing OSD parts etc. 19 // dst: image to draw to 20 // sbs_list: source sub-bitmaps 21 // returns: success 22 bool mp_draw_sub_bitmaps(struct mp_draw_sub_cache *cache, struct mp_image *dst, 23 struct sub_bitmap_list *sbs_list); 24 25 char *mp_draw_sub_get_dbg_info(struct mp_draw_sub_cache *c); 26 27 // Return a RGBA overlay with subtitles. The returned image uses IMGFMT_BGRA and 28 // premultiplied alpha, and the size specified by sbs_list.w/h. 29 // This can return a list of active (act_) and modified (mod_) rectangles. 30 // Active rectangles are regions that contain visible OSD pixels. Modified 31 // rectangles are regions that were changed since the last call. This function 32 // always makes the act region a subset of the mod region. Rectangles within a 33 // list never overlap with rectangles within the same list. 34 // If num_mod_rcs==0 is returned, this function guarantees that the act region 35 // did not change since the last call. 36 // If the user-provided lists are too small (max_*_rcs too small), multiple 37 // rectangles are merged until they fit in the list. 38 // You can pass max_act_rcs=0, which implies you render the whole overlay. 39 // cache: allocated instance; keeps track of changed regions 40 // sbs_list: source sub-bitmaps 41 // act_rcs: caller allocated list of non-transparent rectangles 42 // max_act_rcs: number of allocated items in act_rcs 43 // num_act_rcs: set to the number of valid items in act_rcs 44 // mod_rcs, max_mod_rcs, num_mod_rcs: modified rectangles 45 // returns: internal OSD overlay owned by cache, NULL on error 46 // read only, valid until the next call on cache 47 struct mp_image *mp_draw_sub_overlay(struct mp_draw_sub_cache *cache, 48 struct sub_bitmap_list *sbs_list, 49 struct mp_rect *act_rcs, 50 int max_act_rcs, 51 int *num_act_rcs, 52 struct mp_rect *mod_rcs, 53 int max_mod_rcs, 54 int *num_mod_rcs); 55 56 extern const bool mp_draw_sub_formats[SUBBITMAP_COUNT]; 57 58 #endif /* MPLAYER_DRAW_BMP_H */ 59 60 // vim: ts=4 sw=4 et tw=80 61