user arrays and VARIANT *



Hi all

I've got nearly 2 years experience programming in C and image
processing. Now I have to migrate one of my applications to a MFC
interface. I am having problems with the VARIANT variable. Let's see.

I have been using Matrox Imaging Lybrary (MIL). With this library, I
can load an image and pass this image into a C array using the function
MbufGet() and perform all my calculations using C.

If my image is 256 pixels wide and 192 pixels high, I need to create a
two dimensions array. If my image is 8 bits depth, I have to use an 8
bits variable, that is, I use unsigned char.

So I declare my array:

unsigned char myArray[192][256]

and I have my image loaded: myImageBuffer

So I use the function MbufGet(myImageBuffer, myArray) and just it, the
value of each pixel is transferred to each element of myArray.

Now I have to do exactly the same in my MFC interface. I have to use
now ActiveMIL instead of MIL. Now my imageBuffer is an object of the
class CImage1 with a method Get().

So I load my image from a file:

imageBuffer.Load("myfile.tif");

and when I use the Get() method, like:

imageBuffer.Get(myArray, ...)

I get errors like:

CImage1::Get : cannot convert parameter 1 from 'unsigned char
[192][256]' to 'VARIANT *'

I check the declaration of the Get() method and it looks like:

void Get(VARIANT * UserArray, ...

I have spent several days trying to get information about VARIANT but I
haven't got any clue, I still don't know how to transfer my image
from a buffer to an array.

Any hint? Any help of suggestion is welcomed.

Many thanks

.



Relevant Pages

  • user arrays and VARIANT *
    ... If my image is 256 pixels wide and 192 pixels high, ... two dimensions array. ... Now I have to do exactly the same in my MFC interface. ...
    (microsoft.public.vc.mfc)
  • Re: user arrays and VARIANT *
    ... Note that VARIANT is not really anything to do with MFC. ... MFC has some array classes that may or may not make ... If my image is 256 pixels wide and 192 pixels high, ...
    (microsoft.public.vc.mfc)
  • Re: passing a NULL pointer from vb6 to an ATL method
    ... COBJINTERFACES and use the C macro for calling into the interface. ... local/call_as is necessary fior marshaling. ... Dim array as Double ... Then you need to write two shim functions in C to link with the ...
    (microsoft.public.vc.atl)
  • Re: Anders Hejlsberg comment on immutable objects
    ... > example of a situation where a read interface does help out. ... > able to read the byte array, ... > and trust the server method, you simply pass the full blown object. ... what is a violation of a const contract. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: .NET and COM Interop
    ... > I added a function that sets the array and it worked, ... To implement the interface properly you have to be a bit sneaky. ... try to implement the property properly, the compiler will complain. ... AssemblyInfo file whereas C# does not. ...
    (microsoft.public.dotnet.framework.interop)

Loading