0

我将开发一个模拟 MS Paint 但在网络上运行的演示应用程序 (HTML5)。目前我已经实现了画笔功能(与 MS Paint 完全一样),但我想将每个画笔描边存储在数据库中。但是我还没有找到存储笔触的数据结构。你们认为一系列连续点(x,y)可以保存笔触信息吗?

class point
{
    float x, y;
}

class brush 
{
   List<point> data;
}

此致。

4

1 回答 1

0

是的,保存积分是一个很好的方法。

请记住,每行的第一个点是 context.moveTo。然后,您可以使用 context.lineTo 轻松重播剩余的笔画。

我假设您也需要每个笔触的颜色和宽度信息。

这是一个起始模式:

table: Points
pointId int [primary key]
strokeID int, [key to table Strokes]
pointX int,
pointY int

table: Strokes
strokeId int, [primary key]
fillStyle varchar,
strokeStyle varchar,
lineWidth int
于 2013-04-23T04:28:48.147 回答