Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WBGraphicsStroke的作用是什么? #1

Open
Aderversa opened this issue Aug 26, 2024 · 1 comment
Open

WBGraphicsStroke的作用是什么? #1

Aderversa opened this issue Aug 26, 2024 · 1 comment

Comments

@Aderversa
Copy link

我自己最近在写一个画图板的项目,想要参考一下本项目的橡皮擦是如何实现的,研究源码的过程中,我当前是追踪到WBGraphicsScene::eraseLineTo()这个函数中,发现该函数应该就是实现橡皮擦功能的关键,这里面涉及到碰撞检测相关东西我都能理解。唯独,无法理解的就是WBGraphicsStroke这个类对象的功能是什么?
Stroke应该是笔画的意思,但是为什么一个笔画会关联到多个WBGraphicsPolygonItem?

@Aderversa
Copy link
Author

我是这样看的:

  • WBGraphicsStroke更像是在设备按压-移动-释放过程中,收集设备移动所产生的Polygon们的一个临时变量。多个以直线为基础的Polygons组成了一个笔画本身。
  • WBGraphicsStrokesGroup是为了长期保存WBGraphicsStroke中所有的Polygons而存在的,它的目的是收集WBGraphicsStroke收集好的Polygons,让WBGraphicsStroke可以有进行下一轮的笔画收集。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant