ActiveX [message #30905] |
Wed, 22 May 2002 12:38 |
Aaron Powers
Messages: 1 Registered: May 2002
|
Junior Member |
|
|
I'm using the 2.0 version of the ActiveX control and calling it from VC++.
If I create a new VARIANT 2D array, image, where
image.parray->rgsabound[0].lLbound = 640
and
image.parray->rgsabound[1].lLbound = 480,
when I call
ActiveXObject.SetNamedArray("image", image, FALSE)
followed by
VARIANT result = ActiveXObject.CopyNamedArray("image")
I now find that
image.parray->rgsabound[0].lLbound = 480
and
image.parray->rgsabound[1].lLbound = 640
, i.e., the dimensions seem reversed. Furthermore, when I try to
SetDIBitsToDevice(pDC->m_hDC,0,0,640,480,0,0,0,480,
(BYTE *) image.parray->pvData,lpBitmapInfo,DIB_RGB_COLORS);
the image is incorrect. It looks similar, but not exactly the same, to
what you get if you try to tv, reform(image, 480, 640).
Also, if I display the original image or if I use the ActiveX control to
read a TIFF through IDL and then use CopyNamedArray to get the image data,
it looks fine, so I'm pretty sure the problem is with SetNamedArray.
Any ideas? Reforming the image once its in IDL doesn't work.
Also:
Does CopyNamedArray copy the data or just the VARIANT and/or SAFEARRAY
structures?
Why does the manual say that the VARIANT returned by CopyNamedArray is local
to the calling function only? So in order to use it elsewhere I need to
call VariantCopy(&image) ? Seems wasteful for large images.
The manual goes out of its way to state that when SetNamedArray is used, the
data is shared and the same array exists in VC++ and IDL. As far as I can
figure anything more complicated than image = image*3 results in IDL
creating a new variable. The VC++ VARIANT still exists but it still refers
to the old data. I would like to get something like
ActiveXObject.ExecuteStr("image = byte(abs(fft(image,-1)))")
to put its result in the original array so that I don't have to use
CopyNamedArray which seems too time consuming. Any way to do it?
Thanks,
--
Aaron Powers
Engineer
North Dancer Labs, Inc.
PO Box 99
Shelburne, VT 05482
802 985-1062 phone
802 985-8125 fax
|
|
|