明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2462|回复: 7

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

[复制链接]
发表于 2010-8-27 17:24:00 | 显示全部楼层 |阅读模式
 
      一般CAD中插入栅格图像都是需要设置路径的,直接操作(“插入”->“光栅图像参照”)或者用代码实现(RastImage、RasterImageDef),
都需要指定路径,然后调用硬盘上对应用的图像文件。

如果在程序代码中自己生成了一个图像,数据存在数组里面了,没有保存在硬盘上,只是在内存中,这样的图像能不能在CAD中显示出来呢?难道必须
先存到硬盘再调用?这样会很慢。。。
发表于 2010-8-27 18:36:00 | 显示全部楼层
RasterImageDef.SetImage Method
 楼主| 发表于 2010-8-27 19:05:00 | 显示全部楼层

回复:(lzh741206)RasterImageDef.SetImage Method

 你好,飞狐
SetImage(IntPtr image, IntPtr fileDescription, bool modifyDatabase);

中的IntPtr fileDescription表示是什么呢?文件描述?这个参数如何设置呢?
IntPtr image应该是图像数据的句柄了。。。
发表于 2010-8-27 19:10:00 | 显示全部楼层

文档里的解释

 

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. 

This function is intended for use by raster editing application developers. 

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. 

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. 

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. 

If modifyDatabase is true, undo recording will be done for changes made to the RasterImageDef object. 

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.

 楼主| 发表于 2010-8-27 21:06:00 | 显示全部楼层

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

汗一个。。。请问在什么“文档”查到的?以后自己也学着用这些文档,多谢!
发表于 2010-8-27 22:46:00 | 显示全部楼层

下载官方的ObjectArx Sdk

解压后的docs目录下

 楼主| 发表于 2010-9-7 11:31:00 | 显示全部楼层

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

 这个问题还是没有解决。。。
在Autodesk论坛里面提问,有人回答的:

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.

 

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.

 

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.

 

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.




意思大概是说不行,不能插入非文件(file)形式的图像,后面又说了反应器(reactor),不太懂。。。不知道什么意思,能说说吗?

~~~~~~~~~~~~~
不知道到底能不能实现。SetImage()试了试,总调试不过,不知道怎么用,苦恼。。。
发表于 2011-9-28 21:23:30 | 显示全部楼层
,我也有同样的疑惑,不知道楼主此问题解决了否?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 21:21 , Processed in 0.196427 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表