dm-script - CleanImage() 的相反命令是什么
问题描述
CleanImage( BasicImage ) 允许在不出现对话框的情况下删除图像:“你想保存...”
除了向整个图像(8k x 8k)添加零之外,还有对应的部分吗?像:
脏图像(基本图像)
谢谢!
解决方案
不,这样的命令不存在,但它也不是真的有用。对 imageDocument 的
任何操作都会自动将其标记为脏(即需要保存),因此您可以通过添加/删除标签轻松地做到这一点;临时设置一个像素值;移动窗户等
该命令CleanImage()
实际上只是一个便利功能。实际属性“与存储的文件不同”是ImageDocument的属性,即保存到磁盘的内容。
因此,该命令实际上并没有对没有ImageDocument的图像做任何事情,即从未显示、保存或ImageGetOrCreateImageDocument()
调用过它们的图像变量。你可以在这里看到这个:
image img := RealImage( "test", 4, 100, 100 )
If ( TwoButtonDialog("Show?","Yes","No") )
img.ShowImage()
If ( TwoButtonDialog("Try closing before cleaning?","Yes","No") )
img.CloseImage()
else
{
img.CleanImage()
img.CloseImage()
}
该命令真正匹配:
void ImageDocumentClean( ImageDocument imgDoc )
检查 imageDocument 是否需要保存的命令是
Boolean ImageDocumentIsDirty( ImageDocument img_doc )
因此,更典型的是,人们会使用这些命令,就像我在下面的脚本中所做的那样。
The following script shows how you can easily "dirty" an imageDocument just by re-setting one of the pixels value. Note that this script works independently of having the image displayed, because we explicitly create the ImageDocument.
Result( "\n Create Image... ")
image img := RealImage( "test", 4, 100, 100 )
Result( "\n Get it's ImageDocument... ")
imageDocument doc = img.ImageGetOrCreateImageDocument()
Result( "\n Is it dirty? --> " + (doc.ImageDocumentIsDirty()?"Yes, dirty":"No, clean"))
Result( "\n Clean it!" )
doc.ImageDocumentClean()
Result( "\n Is it dirty? --> " + (doc.ImageDocumentIsDirty()?"Yes, dirty":"No, clean"))
Result( "\n Make it dirty by setting the first pixel value to the value it has..." )
img.SetPixel(0,0,img.GetPixel(0,0))
Result( "\n Is it dirty? --> " + (doc.ImageDocumentIsDirty()?"Yes, dirty":"No, clean"))
However, I am curious in when such a functionality would ever be needed?
推荐阅读
- java - 删除 BST 中范围之间的叶节点
- c++ - 如何使用 OpenMP 以正确的方式并行化这个数组?
- oauth-2.0 - 从后端到前端的 OAuth2 代码不起作用
- angular - 如何以角度传递带有路由的数组
- vue.js - 将当前日期与 Vue 中的 API 日期进行比较
- javascript - 如何避免Chatview在收到新消息时默认自动打开叠加显示
- google-chrome-extension - 表情符号不是由 chrome 扩展呈现的吗?
- r - Merge 2 data frame with respect to columns
- javascript - why page reload when posting or updating and item using fake rest api with json server
- c++ - C++ create Clone of vector
with right Child constructor