mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Add animation blend and disposal concepts
This commit is contained in:
1 parent
ba05d5beed
commit
6df342c60c
18 files changed
+762
-128
No files matched your search
@@ -1006,6 +1006,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1016,6 +1034,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1061,6 +1081,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1074,6 +1096,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1099,19 +1123,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1126,6 +1143,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
@@ -77,11 +77,14 @@ const baseHeader = "" +
|
||||
"l.num_loops = num_loops;\n return;\n }\n }\n *c = ((wuffs_base__image_config){});\n}\n\nstatic inline void wuffs_base__image_config__invalidate(\n wuffs_base__image_config* c) {\n if (c) {\n *c = ((wuffs_base__image_config){});\n }\n}\n\nstatic inline bool wuffs_base__image_config__is_valid(\n wuffs_base__image_config* c) {\n return c && c->private_impl.pixfmt;\n}\n\nstatic inline wuffs_base__pixel_format wuffs_base__image_config__pixel_format(\n wuffs_base__image_config* c) {\n return c ? c->private_impl.pixfmt : 0;\n}\n\nstatic inline wuffs_base__pixel_subsampling\nwuffs_base__image_config__pixel_subsampling(wuffs_base__image_config* c) {\n return c ? c->private_impl.pixsub : 0;\n}\n\nstatic inline uint32_t wuffs_base__image_config__width(\n wuffs_base__image_config* c) {\n return c ? c->private_impl.width : 0;\n}\n\nstatic inline uint32_t wuffs_base__image_config__height(\n wuffs_base__image_config* c) {\n return c ? c->private_impl.height : 0;\n}\n\nstatic inline uint32_t wuffs_base__image_config__num_loops(\n" +
|
||||
" wuffs_base__image_config* c) {\n return c ? c->private_impl.num_loops : 0;\n}\n\n// TODO: this is the right API for planar (not packed) pixbufs? Should it allow\n// decoding into a color model different from the format's intrinsic one? For\n// example, decoding a JPEG image straight to RGBA instead of to YCbCr?\nstatic inline size_t wuffs_base__image_config__pixbuf_size(\n wuffs_base__image_config* c) {\n if (c) {\n uint64_t wh =\n ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height);\n // TODO: handle things other than 1 byte per pixel.\n return (size_t)wh;\n }\n return 0;\n}\n\n" +
|
||||
"" +
|
||||
"// --------\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__image_config config;\n uint32_t loop_count; // 0-based count of the current loop.\n wuffs_base__pixel_buffer pixbuf;\n // TODO: color spaces.\n wuffs_base__rect_ie_u32 dirty_rect;\n wuffs_base__flicks duration;\n bool palette_changed;\n uint8_t palette[1024];\n } private_impl;\n} wuffs_base__image_buffer;\n\nstatic inline void wuffs_base__image_buffer__set_from_pixbuf(\n wuffs_base__image_buffer* b,\n wuffs_base__image_config config,\n wuffs_base__pixel_buffer pixbuf) {\n if (!b) {\n return;\n }\n *b = ((wuffs_base__image_buffer){});\n b->private_impl.config = config;\n b->private_impl.pixbuf = pixbuf;\n}\n\n// TODO: Should this function return bool? An error type?\nstatic inline void wuffs_base__image_buffer__set_from_slice(\n wuffs_base__image_buffer* b,\n wuffs_base__image_config config,\n wuffs_base__s" +
|
||||
"lice_u8 pixbuf_memory) {\n if (!b) {\n return;\n }\n *b = ((wuffs_base__image_buffer){});\n // TODO: don't assume 1 byte per pixel. Don't assume packed.\n uint64_t wh = ((uint64_t)config.private_impl.width) *\n ((uint64_t)config.private_impl.height);\n if (wh > pixbuf_memory.len) {\n return;\n }\n b->private_impl.config = config;\n wuffs_base__table_u8* tab = &b->private_impl.pixbuf.planes[0];\n tab->ptr = pixbuf_memory.ptr;\n tab->width = config.private_impl.width;\n tab->height = config.private_impl.height;\n tab->stride = config.private_impl.width;\n}\n\n// The palette argument is ignored unless its length is exactly 1024.\nstatic inline void wuffs_base__image_buffer__update(\n wuffs_base__image_buffer* b,\n wuffs_base__rect_ie_u32 dirty_rect,\n wuffs_base__flicks duration,\n wuffs_base__slice_u8 palette) {\n if (!b) {\n return;\n }\n\n // Clip the dirty_rect to the image bounds.\n dirty_rect.max_exclusive_x = wuffs_base__u32__min(\n dirty_rect.max_exclusive_x, b->private_impl.co" +
|
||||
"nfig.private_impl.width);\n dirty_rect.max_exclusive_y = wuffs_base__u32__min(\n dirty_rect.max_exclusive_y, b->private_impl.config.private_impl.height);\n b->private_impl.dirty_rect = dirty_rect;\n\n b->private_impl.duration = duration;\n b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);\n if (b->private_impl.palette_changed) {\n memmove(b->private_impl.palette, palette.ptr, 1024);\n }\n}\n\n// wuffs_base__image_buffer__loop returns whether the image decoder should loop\n// back to the beginning of the animation, assuming that we've reached the end\n// of the encoded stream. If so, it increments b's count of the animation loops\n// played so far.\nstatic inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {\n if (!b) {\n return false;\n }\n uint32_t n = b->private_impl.config.private_impl.num_loops;\n if (n == 0) {\n return true;\n }\n if (b->private_impl.loop_count < n - 1) {\n b->private_impl.loop_count++;\n return true;\n }\n return false;\n}\n\nstatic inline w" +
|
||||
"uffs_base__image_config* wuffs_base__image_buffer__image_config(\n wuffs_base__image_buffer* b) {\n return b ? &b->private_impl.config : NULL;\n}\n\n// wuffs_base__image_buffer__palette_changed returns whether this frame's\n// palette differs from the previous frame. It is conservative and may return\n// false positives (but never false negatives).\nstatic inline bool wuffs_base__image_buffer__palette_changed(\n wuffs_base__image_buffer* b) {\n return b && b->private_impl.palette_changed;\n}\n\n// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of\n// this frame's pixels differs from the previous frame.\nstatic inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(\n wuffs_base__image_buffer* b) {\n return b ? b->private_impl.dirty_rect : ((wuffs_base__rect_ie_u32){0});\n}\n\n// wuffs_base__image_buffer__duration returns the amount of time to display\n// this frame. Zero means to display forever - a still (non-animated) image.\nstatic inline wuffs_base__flicks wuffs_base__image_b" +
|
||||
"uffer__duration(\n wuffs_base__image_buffer* b) {\n return b ? b->private_impl.duration : 0;\n}\n\n// wuffs_base__image_buffer__palette returns the palette that the pixel data\n// can index. The backing array is inside b and has length 1024.\nstatic inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(\n wuffs_base__image_buffer* b) {\n return b ? ((wuffs_base__slice_u8){.ptr = b->private_impl.palette,\n .len = 1024})\n : ((wuffs_base__slice_u8){});\n}\n\nstatic inline wuffs_base__table_u8 wuffs_base__image_buffer__plane(\n wuffs_base__image_buffer* b,\n uint32_t p) {\n return (b && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX))\n ? b->private_impl.pixbuf.planes[p]\n : ((wuffs_base__table_u8){});\n}\n\n#endif // WUFFS_BASE_HEADER_H\n" +
|
||||
"// --------\n\n// wuffs_base__animation_disposal encodes, for an animated image, how to\n// dispose of a frame after displaying it:\n// - None means to draw the next frame on top of this one.\n// - Restore Background means to clear the frame's dirty rectangle to \"the\n// background color\" (in practice, this means transparent black) before\n// drawing the next frame.\n// - Restore Previous means to undo the current frame, so that the next frame\n// is drawn on top of the previous one.\ntypedef uint8_t wuffs_base__animation_disposal;\n\n#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)\n#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \\\n ((wuffs_base__animation_disposal)1)\n#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \\\n ((wuffs_base__animation_disposal)2)\n\n" +
|
||||
"" +
|
||||
"// --------\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__image_config config;\n uint32_t loop_count; // 0-based count of the current loop.\n wuffs_base__pixel_buffer pixbuf;\n // TODO: color spaces.\n wuffs_base__rect_ie_u32 dirty_rect;\n wuffs_base__flicks duration;\n bool blend;\n wuffs_base__animation_disposal disposal;\n bool palette_changed;\n uint8_t palette[1024];\n } private_impl;\n} wuffs_base__image_buffer;\n\nstatic inline void wuffs_base__image_buffer__set_from_pixbuf(\n wuffs_base__image_buffer* b,\n wuffs_base__image_config config,\n wuffs_base__pixel_buffer pixbuf) {\n if (!b) {\n return;\n }\n *b = ((wuffs_base__image_buffer){});\n b->private_impl.config = config;\n b->private_impl.pixbuf = pixbuf;\n}\n\n// TODO: Should this function return bool? An error type?\nstatic inline void wuffs_base__image_buffer__set_from_slice(\n wuffs_base__image_buff" +
|
||||
"er* b,\n wuffs_base__image_config config,\n wuffs_base__slice_u8 pixbuf_memory) {\n if (!b) {\n return;\n }\n *b = ((wuffs_base__image_buffer){});\n // TODO: don't assume 1 byte per pixel. Don't assume packed.\n uint64_t wh = ((uint64_t)config.private_impl.width) *\n ((uint64_t)config.private_impl.height);\n if (wh > pixbuf_memory.len) {\n return;\n }\n b->private_impl.config = config;\n wuffs_base__table_u8* tab = &b->private_impl.pixbuf.planes[0];\n tab->ptr = pixbuf_memory.ptr;\n tab->width = config.private_impl.width;\n tab->height = config.private_impl.height;\n tab->stride = config.private_impl.width;\n}\n\n// The palette argument is ignored unless its length is exactly 1024.\nstatic inline void wuffs_base__image_buffer__update(\n wuffs_base__image_buffer* b,\n wuffs_base__rect_ie_u32 dirty_rect,\n wuffs_base__flicks duration,\n bool blend,\n wuffs_base__animation_disposal disposal,\n wuffs_base__slice_u8 palette) {\n if (!b) {\n return;\n }\n\n // Clip the dirty_rect to t" +
|
||||
"he image bounds.\n dirty_rect.max_exclusive_x = wuffs_base__u32__min(\n dirty_rect.max_exclusive_x, b->private_impl.config.private_impl.width);\n dirty_rect.max_exclusive_y = wuffs_base__u32__min(\n dirty_rect.max_exclusive_y, b->private_impl.config.private_impl.height);\n b->private_impl.dirty_rect = dirty_rect;\n\n b->private_impl.duration = duration;\n b->private_impl.blend = blend;\n b->private_impl.disposal = disposal;\n b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);\n if (b->private_impl.palette_changed) {\n memmove(b->private_impl.palette, palette.ptr, 1024);\n }\n}\n\n// wuffs_base__image_buffer__loop returns whether the image decoder should loop\n// back to the beginning of the animation, assuming that we've reached the end\n// of the encoded stream. If so, it increments b's count of the animation loops\n// played so far.\nstatic inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {\n if (!b) {\n return false;\n }\n uint32_t n = b->private_impl.config." +
|
||||
"private_impl.num_loops;\n if (n == 0) {\n return true;\n }\n if (b->private_impl.loop_count < n - 1) {\n b->private_impl.loop_count++;\n return true;\n }\n return false;\n}\n\n// wuffs_base__image_config returns the overall configuration for this frame.\nstatic inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(\n wuffs_base__image_buffer* b) {\n return b ? &b->private_impl.config : NULL;\n}\n\n// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of\n// this frame's pixels differs from the previous frame.\nstatic inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(\n wuffs_base__image_buffer* b) {\n return b ? b->private_impl.dirty_rect : ((wuffs_base__rect_ie_u32){0});\n}\n\n// wuffs_base__image_buffer__duration returns the amount of time to display\n// this frame. Zero means to display forever - a still (non-animated) image.\nstatic inline wuffs_base__flicks wuffs_base__image_buffer__duration(\n wuffs_base__image_buffer* b) {\n return b ? b->private" +
|
||||
"_impl.duration : 0;\n}\n\n// wuffs_base__image_buffer__blend returns, for a transparent image, whether to\n// blend this frame with the existing canvas.\n//\n// In Porter-Duff compositing operator terminology, false means \"src\" and true\n// means \"src over dst\".\nstatic inline bool wuffs_base__image_buffer__blend(\n wuffs_base__image_buffer* b) {\n return b && b->private_impl.blend;\n}\n\n// wuffs_base__image_buffer__disposal returns, for an animated image, how to\n// dispose of this frame after displaying it.\nstatic inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(\n wuffs_base__image_buffer* b) {\n return b ? b->private_impl.disposal : 0;\n}\n\n// wuffs_base__image_buffer__palette_changed returns whether this frame's\n// palette differs from the previous frame. It is conservative and may return\n// false positives (but never false negatives).\nstatic inline bool wuffs_base__image_buffer__palette_changed(\n wuffs_base__image_buffer* b) {\n return b && b->private_impl.palette_changed;\n}\n\n// wuffs_" +
|
||||
"base__image_buffer__palette returns the palette that the pixel data\n// can index. The backing array is inside b and has length 1024.\nstatic inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(\n wuffs_base__image_buffer* b) {\n return b ? ((wuffs_base__slice_u8){.ptr = b->private_impl.palette,\n .len = 1024})\n : ((wuffs_base__slice_u8){});\n}\n\nstatic inline wuffs_base__table_u8 wuffs_base__image_buffer__plane(\n wuffs_base__image_buffer* b,\n uint32_t p) {\n return (b && (p < WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX))\n ? b->private_impl.pixbuf.planes[p]\n : ((wuffs_base__table_u8){});\n}\n\n#endif // WUFFS_BASE_HEADER_H\n" +
|
||||
""
|
||||
|
||||
const baseImpl = "" +
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+51
-9
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
@@ -3640,7 +3682,7 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id_part1(
|
||||
.ptr = self->private_impl.f_palettes[0], .len = 1024});
|
||||
}
|
||||
wuffs_base__image_buffer__update(a_dst, self->private_impl.f_frame_rect,
|
||||
self->private_impl.f_gc_duration,
|
||||
self->private_impl.f_gc_duration, true, 0,
|
||||
v_palette);
|
||||
self->private_impl.f_previous_use_global_palette = !v_use_local_palette;
|
||||
self->private_impl.f_seen_graphic_control = false;
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
+50
-8
@@ -1009,6 +1009,24 @@ static inline size_t wuffs_base__image_config__pixbuf_size(
|
||||
|
||||
// --------
|
||||
|
||||
// wuffs_base__animation_disposal encodes, for an animated image, how to
|
||||
// dispose of a frame after displaying it:
|
||||
// - None means to draw the next frame on top of this one.
|
||||
// - Restore Background means to clear the frame's dirty rectangle to "the
|
||||
// background color" (in practice, this means transparent black) before
|
||||
// drawing the next frame.
|
||||
// - Restore Previous means to undo the current frame, so that the next frame
|
||||
// is drawn on top of the previous one.
|
||||
typedef uint8_t wuffs_base__animation_disposal;
|
||||
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \
|
||||
((wuffs_base__animation_disposal)1)
|
||||
#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \
|
||||
((wuffs_base__animation_disposal)2)
|
||||
|
||||
// --------
|
||||
|
||||
typedef struct {
|
||||
// Do not access the private_impl's fields directly. There is no API/ABI
|
||||
// compatibility or safety guarantee if you do so.
|
||||
@@ -1019,6 +1037,8 @@ typedef struct {
|
||||
// TODO: color spaces.
|
||||
wuffs_base__rect_ie_u32 dirty_rect;
|
||||
wuffs_base__flicks duration;
|
||||
bool blend;
|
||||
wuffs_base__animation_disposal disposal;
|
||||
bool palette_changed;
|
||||
uint8_t palette[1024];
|
||||
} private_impl;
|
||||
@@ -1064,6 +1084,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
wuffs_base__image_buffer* b,
|
||||
wuffs_base__rect_ie_u32 dirty_rect,
|
||||
wuffs_base__flicks duration,
|
||||
bool blend,
|
||||
wuffs_base__animation_disposal disposal,
|
||||
wuffs_base__slice_u8 palette) {
|
||||
if (!b) {
|
||||
return;
|
||||
@@ -1077,6 +1099,8 @@ static inline void wuffs_base__image_buffer__update(
|
||||
b->private_impl.dirty_rect = dirty_rect;
|
||||
|
||||
b->private_impl.duration = duration;
|
||||
b->private_impl.blend = blend;
|
||||
b->private_impl.disposal = disposal;
|
||||
b->private_impl.palette_changed = palette.ptr && (palette.len == 1024);
|
||||
if (b->private_impl.palette_changed) {
|
||||
memmove(b->private_impl.palette, palette.ptr, 1024);
|
||||
@@ -1102,19 +1126,12 @@ static inline bool wuffs_base__image_buffer__loop(wuffs_base__image_buffer* b) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wuffs_base__image_config returns the overall configuration for this frame.
|
||||
static inline wuffs_base__image_config* wuffs_base__image_buffer__image_config(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? &b->private_impl.config : NULL;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__dirty_rect returns an upper bound for what part of
|
||||
// this frame's pixels differs from the previous frame.
|
||||
static inline wuffs_base__rect_ie_u32 wuffs_base__image_buffer__dirty_rect(
|
||||
@@ -1129,6 +1146,31 @@ static inline wuffs_base__flicks wuffs_base__image_buffer__duration(
|
||||
return b ? b->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__blend returns, for a transparent image, whether to
|
||||
// blend this frame with the existing canvas.
|
||||
//
|
||||
// In Porter-Duff compositing operator terminology, false means "src" and true
|
||||
// means "src over dst".
|
||||
static inline bool wuffs_base__image_buffer__blend(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.blend;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal wuffs_base__image_buffer__disposal(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b ? b->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette_changed returns whether this frame's
|
||||
// palette differs from the previous frame. It is conservative and may return
|
||||
// false positives (but never false negatives).
|
||||
static inline bool wuffs_base__image_buffer__palette_changed(
|
||||
wuffs_base__image_buffer* b) {
|
||||
return b && b->private_impl.palette_changed;
|
||||
}
|
||||
|
||||
// wuffs_base__image_buffer__palette returns the palette that the pixel data
|
||||
// can index. The backing array is inside b and has length 1024.
|
||||
static inline wuffs_base__slice_u8 wuffs_base__image_buffer__palette(
|
||||
|
||||
@@ -123,7 +123,7 @@ var Funcs = []string{
|
||||
// ---- image_buffer
|
||||
|
||||
"image_buffer.plane(p u32[..3])(ret table u8)",
|
||||
"image_buffer.update!(dirty_rect rect_ie_u32, duration u64, palette slice u8)()",
|
||||
"image_buffer.update!(dirty_rect rect_ie_u32, duration u64, blend bool, disposal u8, palette slice u8)()",
|
||||
|
||||
// ---- image_config
|
||||
|
||||
|
||||
@@ -488,7 +488,8 @@ pri func decoder.decode_id_part1?(dst ptr base.image_buffer, src base.io_reader)
|
||||
// Both this frame and the previous one used the global palette. No
|
||||
// palette update is necessary.
|
||||
}
|
||||
in.dst.update!(dirty_rect:this.frame_rect, duration:this.gc_duration, palette:palette)
|
||||
in.dst.update!(dirty_rect:this.frame_rect, duration:this.gc_duration,
|
||||
blend:true, disposal:0, palette:palette)
|
||||
|
||||
this.previous_use_global_palette = not use_local_palette
|
||||
|
||||
|
||||
Reference in new issue
Block a user