malasky 发表于 2010-8-27 17:24:00

[讨论][求助]能否在cad中显示内存中的图像?

&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一般CAD中插入栅格图像都是需要设置路径的,直接操作(“插入”-&gt;“光栅图像参照”)或者用代码实现(RastImage、RasterImageDef),<br/>都需要指定路径,然后调用硬盘上对应用的图像文件。<br/><br/>如果在程序代码中自己生成了一个图像,数据存在数组里面了,没有保存在硬盘上,只是在内存中,这样的图像能不能在CAD中显示出来呢?难道必须<br/>先存到硬盘再调用?这样会很慢。。。<br/>

雪山飞狐_lzh 发表于 2010-8-27 18:36:00

<div class="Element5">RasterImageDef.SetImage Method</div>

malasky 发表于 2010-8-27 19:05:00

回复:(lzh741206)RasterImageDef.SetImage Method

&nbsp;你好,飞狐<br/>SetImage(IntPtr image, IntPtr fileDescription, bool modifyDatabase);<br/><br/>中的IntPtr fileDescription表示是什么呢?文件描述?这个参数如何设置呢?<br/>IntPtr image应该是图像数据的句柄了。。。<br/>

雪山飞狐_lzh 发表于 2010-8-27 19:10:00

<p>文档里的解释</p>
<p>&nbsp;</p>
<p class="Element10">Directly specifies an in-memory Atil.Image or a custom Atil.FileReadDescriptor to be used. Either image or fileDescription can be null, but not both. Copies of the Atil.Image and Atil.FileReadDescriptor are retained by the RasterImageDef, so the caller's copy of these objects may be deleted at any time.&nbsp;</p>
<p class="Element10">This function is intended for use by raster editing application developers.&nbsp;</p>
<p class="Element10">The Loaded status must be false when this function is called. It can be used to construct an RasterImageDef object in lieu of calling ActiveFileName.&nbsp;</p>
<p class="Element10">If image is not null and is valid, the "loaded" status is set true. Otherwise, "loaded" status is set to false. If image is null, then fileDescription must be a valid read or write Atil.FileReadDescriptor from which an image can be read on demand.&nbsp;</p>
<p class="Element10">If fileDescription is not null and is valid, resolution and file type information is extracted from it. If fileDescription has a valid file path, it is used as the "active path." Otherwise, "active path" is set to the null string.&nbsp;</p>
<p class="Element10">If modifyDatabase is true, undo recording will be done for changes made to the RasterImageDef object.&nbsp;</p>
<p class="Element10">Use ImageModified and the RasterImageDefReactor mechanism to be notified of attempts to delete this image. Otherwise, the user may be able to Unload or Reload the image through the user interface, possibly losing image data that hasn't been saved to disk.</p>

malasky 发表于 2010-8-27 21:06:00

回复:(lzh741206)文档里的解释 Directly ...

汗一个。。。请问在什么“文档”查到的?以后自己也学着用这些文档,多谢!

雪山飞狐_lzh 发表于 2010-8-27 22:46:00

<p>下载官方的ObjectArx Sdk</p>
<p>解压后的docs目录下</p>

malasky 发表于 2010-9-7 11:31:00

回复:(lzh741206)下载官方的ObjectArx Sdk解压后...

&nbsp;这个问题还是没有解决。。。<br/>在Autodesk论坛里面提问,有人回答的:<br/><br/><p>Just a general comment... I don't believe there is any way to embed
an image that is not a file. All AutoCAD raster images are basically
xref'd files.</p><p>&nbsp;</p><p>You may be able to draw an image on the
AutoCAD graphics screen using a custom draw routine but I believe your
application would be responsible for rendering the graphic and
refreshing it.</p><p>&nbsp;</p><p>You could probably go as far as creating
reactors to refresh the image as the user zoom/pans/etc. Basically you
would be creating a custom object to embed images in a drawing. Object
enabler type stuff.</p><p>&nbsp;</p><p>The ability to embed raster images and
control the plotting color would be a very nice addition to AutoCAD
rather than all these 3D tools they keep adding.</p><br/><br/><br/>意思大概是说不行,不能插入非文件(file)形式的图像,后面又说了反应器(reactor),不太懂。。。不知道什么意思,能说说吗?<br/><br/>~~~~~~~~~~~~~<br/>不知道到底能不能实现。SetImage()试了试,总调试不过,不知道怎么用,苦恼。。。<br/>

家在湾里 发表于 2011-9-28 21:23:30

,我也有同样的疑惑,不知道楼主此问题解决了否?
页: [1]
查看完整版本: [讨论][求助]能否在cad中显示内存中的图像?