如何将图片(图像)加载到smalltalk中
如何将图片加载到smalltalk 中?我找到了几个如何在图像成为类资源后显示图像的示例,但找不到将图片导入我的smalltalk环境的方法。 (我使用图片一词以避免与smalltalk图像混淆)
How do you load a picture into smalltalk? I have found several examples of how to display an image once it is a class resource, but can't find a way to import the picture into my smalltalk environment. (I use the word picture to avoid confusion with the smalltalk image)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要将图像加载为类资源,应在工作区中执行以下代码。
在哪里
'picture.bmp' 是您要加载的图像文件,
NameSpace.MyClass 是您希望文件成为资源的类,
AccessMethod 是返回图片所调用的方法的名称。
To load an image as a class resource, the following code should be executed in the workspace.
where
'picture.bmp' is the image file you want to load,
NameSpace.MyClass is the class you want the file to be a resource to,
AccessMethod is the name of the method called to return the picture.
Squeak 的一种可能性是:(
这曾经也适用于 Pharo,但似乎已被删除。)
One possibility for Squeak would be:
(This used to work for Pharo, too, but seems to have been removed.)
来自 Pharo Mooc:
From the Pharo Mooc:
这在 Pharo 7.0 中对我有用:
之后可以使用
asMorph
对其进行转换。This worked for me in Pharo 7.0:
Afterwards it can be transformed with
asMorph
.