几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-04, 05:14 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】byte data from a oddbrasterimage

byte data from a oddbrasterimage
byte data from a oddbrasterimage
hi
i'm trying to extract the byte data from a raster contained in a dwg file. the image is being passed to me as a oddbrasterimage, but i can't see any obvious way to get access to the byte data.
any clues, anyone?
thanks
peter.
see examples\odreadex\exprotocolextension.cpp, 1445
dumprasterimagedef()
vladimir
byte data from a oddbrasterimage
hi
yes i saw that example, thanks. it describes how to get all sorts of metadata about the image ie size, resolution, clipping window etc, but i still can't see how to get access to the byte data?
thanks,
peter.
there is a file name in metadata.
image is not stored inside the drawing.
vladimir
you also can get the contents of raster file using odgirasterimageptr oddbrasterimagedef::image().
it loads and converts the raster to bmp like data using rxrasterservices.drx.
its default implementation supports only bmp and jpg. but you can use your own one which supports other raster formats. extensions/exservices/exgirasterimage besides default implementation contains code using snowbound library.
sergey slezkin
hi
i'm still having trouble getting the image bits out from a oddbrasterimage.
some context:
i'm handling a database created by your dwf7import library from a dwf file containing embedded images. if i call database::write on the database created by the library i can see that jpeg and png images are being written to the file system. this makes me confident that i have everything i need compiled and linked to get image data, including the jpeg library and exgirasterimage.
i have confirmed that the raster is in the raster dictionary, but calling oddbrasterimagedef::sourcefilename() returns a empty string. therefore the raster data must be present in the database itself.
i've tried calling odgirasterimageptr oddbrasterimagedef::image(), and i can get the width and height of the image from this.
odgirasterimage::scanlines() returns null, as does casting it to a odexgirasterimageptr and calling bits().
what am i doing wrong?
peter.
look at the function extensions\exservices\exgirasterimage.cpp
code:
odgirasterimageptr exrastermodule::loadrasterimage(odstreambuf *pbuf)
when imported dwf is not yet saved, this function is used to load images.
if you use jpeg6b (not sb), then this function won't load image.
vladimir
i'm confused. how does this apply to handling a oddbrasterimage?
where do i get the odstreambuf from and what is it reading from?
peter.
image is stored as binary stream when read from dwf. (that's the reason why file name is null, until the file is saved). to get gi interface from that stream, loadrasterimage() is called.
raster handling functions are user supplied. (by implementing a module with a name equal to rx_raster_services_appname)
a sample implementation is available in extensions\exservices\exgirasterimage.cpp
dd internally calls
code:
odrxrasterservicesptr prassvcs = odrxdynamiclinker()->loadapp(rx_raster_services_appname);
prassvcs->loadrasterimage(
vladimir
ok, so how do i get a odstreambuf stream from a oddbrasterimage?
thanks
peter.
actually, i've just seen a getcompounddocument(odstreambuf& streambuf) method in odoleitemhandler. so i think that will do what i'm wanting.
thanks,
peter.
last edited by peter.aberline@cadcorp.com; 10th october 2007 at 06:42 amfff">.
sorry, i'm getting myself tied up in knots here. i've been working on handling embedded rasters as oddbole2frame objects as well as oddbrasterimage's and i mistook the two when i made my last post.
i don't think i can use odoleitemhandler to get the stream as i've only got a oddbrasterimage. so my questions still stands, how do i go from oddbrasterimage to odstreambuf?
thanks
peter.
ole is irrelevant in the case.
you should either implement exrastermodule::loadrasterimage, and then take the way that sergey suggested, or save the drawing to some temp location, and obtain the image file name from the image descriptor.
vladimir
hi
all i need is the raw bits from the image, without any decoding/uncompression.
shouldn't the default, oda supplied implementation of exrastermodule::loadrasterimage be able to give me this for a jpeg based oddbraster at the very least? i have jpeg-6b linked in. i don't understand why i need my own implementation of exrastermodule::loadrasterimage.
using the oda implementation i always get an empty bits set back from:
odgirasterimageptr ptrimagedata = ptrimgdef->image();
assert(!ptrimagedata.isnull());
odexgirasterimage& bitmap = (odexgirasterimage&)*ptrimagedata.get();
oduint32 bitsize = bitmap.bitdatasize();
// bitssize is 0 here.
odbinarydata& bindata = bitmap.bits();
// bindata is empty here.
thanks
peter.
last edited by peter.aberline@cadcorp.com; 11th october 2007 at 02:59 amfff">.
hi
has there been any progress with this query?
thanks
peter.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】acis data garbled yang686526 DirectDWG 0 2009-05-04 03:37 PM
【转帖】accessing autocad map object data yang686526 DirectDWG 0 2009-05-04 03:32 PM
【转帖】哪位高手指点一下下边lisp的怎么用 yang686526 数据库ObjectDBX 0 2009-04-28 12:13 PM
哪位高手指点一下下边lisp的怎么用 yang686526 ObjectARX(AutoLISP) 0 2009-04-26 06:19 PM
【转帖】data storage in sw docs yang686526 SolidWorks二次开发 0 2009-04-13 10:11 AM


所有的时间均为北京时间。 现在的时间是 12:06 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多