Flex 中图像处理的撤消、重做功能
因此,我设法学习了一些 Flex 并创建了一个小应用程序:
- 将图像加载到图像组件
- 转换图像(旋转、翻转)
- 使用矩阵应用滤镜
现在我正在考虑创建一些撤消重做功能。 每次我进行转换/添加过滤器时,我都希望能够返回到上一个图像(在操作之前)。
我的想法是拥有一个数组并将前一个位图添加到堆栈中。 但我发现转换和过滤器之间存在一些差异 我还看到了 ImageSnapshot 以及我能做什么,它看起来就像我所追求的。
总的来说,我对 Flex 有点陌生,我希望这里有人能给我任何建议,并希望能提供一些指导。
感谢您的任何建议! 最好的问候,
兰
So I managed to learn some Flex and created a small app that:
- Loads an image to an Image component
- Transform the image (rotate, flip) with the Matrix
- Apply filter(s)
Now I am thinking about to create some undo redo functionality.
Each time I do a transformation / add an filter I want to be able to go back to the previous image (before the action).
My thought is to have an Array and add the previous bitmap to the stack.
But I see that there are some differences between transformations and filters
I have also seen the ImageSnapshot and whot i can do and it looks like what I am after.
I am a bit new to Flex in general and I hope someone here can give me any advice on this and hopefully som directions.
Thanks for any advice!
Best regards,
Ran
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议研究命令设计模式。
本质上,您的数组将不包含图像,而是包含表示对图像进行的操作的标记。每个令牌都有足够的信息来撤消(和重做?)其操作。
然后在命令中,大致:
I suggest looking into the Command design pattern.
Essentially, your array would contain not the image, but tokens representing the operation taken on the image. Each token would have enough information to undo (and redo?) its operation.
then in the commands, roughly: