forked from old/legacy-imlib2
Updates for animated image handling
This commit is contained in:
parent
3a93e9a92a
commit
2bbd3dc7f9
|
@ -227,7 +227,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (finfo.frame_flags & IMLIB_FRAME_CLEAR)
|
if (finfo.frame_flags & IMLIB_FRAME_DISPOSE_CLEAR)
|
||||||
{
|
{
|
||||||
bg_pm_init(0);
|
bg_pm_init(0);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y,
|
||||||
update_w, update_h,
|
update_w, update_h,
|
||||||
up_wx, up_wy, up_ww, up_wh);
|
up_wx, up_wy, up_ww, up_wh);
|
||||||
|
|
||||||
if (finfo.frame_flags & IMLIB_FRAME_CLEAR)
|
if (finfo.frame_flags & IMLIB_FRAME_DISPOSE_CLEAR)
|
||||||
XClearWindow(disp, win);
|
XClearWindow(disp, win);
|
||||||
else
|
else
|
||||||
XClearArea(disp, win, up_wx, up_wy, up_ww, up_wh, False);
|
XClearArea(disp, win, up_wx, up_wy, up_ww, up_wh, False);
|
||||||
|
|
|
@ -613,8 +613,9 @@ typedef struct {
|
||||||
} Imlib_Frame_Info;
|
} Imlib_Frame_Info;
|
||||||
|
|
||||||
/* frame info flags */
|
/* frame info flags */
|
||||||
#define IMLIB_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
|
#define IMLIB_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
|
||||||
#define IMLIB_FRAME_CLEAR (1 << 1) /* Clear before rendering frame */
|
#define IMLIB_FRAME_DISPOSE_CLEAR (1 << 1) /* Clear before rendering next frame */
|
||||||
|
#define IMLIB_FRAME_BLEND (1 << 2) /* Blend current onto previous frame */
|
||||||
|
|
||||||
EAPI Imlib_Image imlib_load_image_frame(const char *file, int frame);
|
EAPI Imlib_Image imlib_load_image_frame(const char *file, int frame);
|
||||||
EAPI void imlib_image_get_frame_info(Imlib_Frame_Info * info);
|
EAPI void imlib_image_get_frame_info(Imlib_Frame_Info * info);
|
||||||
|
|
|
@ -30,8 +30,9 @@ enum _iflags {
|
||||||
typedef enum _iflags ImlibImageFlags;
|
typedef enum _iflags ImlibImageFlags;
|
||||||
|
|
||||||
/* Must match the ones in Imlib2.h.in */
|
/* Must match the ones in Imlib2.h.in */
|
||||||
#define FF_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
|
#define FF_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
|
||||||
#define FF_FRAME_CLEAR (1 << 1) /* Clear before rendering frame */
|
#define FF_FRAME_DISPOSE_CLEAR (1 << 1) /* Clear before rendering next frame */
|
||||||
|
#define FF_FRAME_BLEND (1 << 2) /* Blend current onto previous frame */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int left, right, top, bottom;
|
int left, right, top, bottom;
|
||||||
|
|
|
@ -197,8 +197,8 @@ load2(ImlibImage * im, int load_data)
|
||||||
if (bits & 1)
|
if (bits & 1)
|
||||||
transp = ext[4];
|
transp = ext[4];
|
||||||
disp = (bits >> 2) & 0x7;
|
disp = (bits >> 2) & 0x7;
|
||||||
if (disp == 2)
|
if (disp == 2 || disp == 3)
|
||||||
im->frame_flags |= FF_FRAME_CLEAR;
|
im->frame_flags |= FF_FRAME_DISPOSE_CLEAR;
|
||||||
D(" Frame %d: disp=%d ui=%d tr=%d, delay=%d transp = #%02x\n", //
|
D(" Frame %d: disp=%d ui=%d tr=%d, delay=%d transp = #%02x\n", //
|
||||||
gif->ImageCount + 1, disp, (bits >> 1) & 1, bits & 1,
|
gif->ImageCount + 1, disp, (bits >> 1) & 1, bits & 1,
|
||||||
im->frame_delay, transp);
|
im->frame_delay, transp);
|
||||||
|
|
|
@ -61,6 +61,10 @@ load2(ImlibImage * im, int load_data)
|
||||||
im->frame_x = iter.x_offset;
|
im->frame_x = iter.x_offset;
|
||||||
im->frame_y = iter.y_offset;
|
im->frame_y = iter.y_offset;
|
||||||
im->frame_delay = iter.duration;
|
im->frame_delay = iter.duration;
|
||||||
|
if (iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND)
|
||||||
|
im->frame_flags |= FF_FRAME_DISPOSE_CLEAR;
|
||||||
|
if (iter.blend_method == WEBP_MUX_BLEND)
|
||||||
|
im->frame_flags |= FF_FRAME_BLEND;
|
||||||
|
|
||||||
D("Canvas WxH=%dx%d frame=%d/%d X,Y=%d,%d WxH=%dx%d alpha=%d T=%d dm=%d co=%d bl=%d\n", //
|
D("Canvas WxH=%dx%d frame=%d/%d X,Y=%d,%d WxH=%dx%d alpha=%d T=%d dm=%d co=%d bl=%d\n", //
|
||||||
im->canvas_w, im->canvas_h, iter.frame_num, im->frame_count,
|
im->canvas_w, im->canvas_h, iter.frame_num, im->frame_count,
|
||||||
|
|
Loading…
Reference in New Issue