howto convert void* to picture?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xyligan
    New Member
    • May 2010
    • 1

    howto convert void* to picture?

    i`m trying to get image from scanner throw dll (c++), which returns data in void * type.

    so googled.. i found:

    Code:
    Marshal.Copy(new IntPtr((byte*)result.buffer), byte_arr,0, size);
    How can i get size of this ?

    thx
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    i`m trying to get image from scanner throw dll (c++), which returns data in void * type.
    I'm going to suggest you stop right now, and read up on C++. It's going to be very hard for you to do this if you don't understand the language you are trying to work with.

    * is not a type. * is a pointer to the memory space of the variable.

    int bob = 5;
    *bob is a pointer to bob

    so googled.. i found:
    Code:
    Marshal.Copy(new IntPtr((byte*)result.buffer), byte_arr,0, size);
    You found some random piece of code that happens to have an * in it? Is this random line of code actually related to your scanner, or just something from someplace that seemed promising but totally unrelated?

    Have you read up on what Marshal is or does? Or are you hoping it works without understanding?

    Comment

    • RedSon
      Recognized Expert Expert
      • Jan 2007
      • 4980

      #3
      Here is how it probably works: This is a complete guess because the information in your question is almost totally useless.

      The scanner's driver will manipulate the scanner hardware to scan your image or paper or whatever you put on it. The driver probably takes that data and puts it in a byte array buffer. The bytes probably represent some kind of color and pixel position data. The scanner driver puts this information in a buffer somewhere and then goes "hey, programmer, here is a *pointer* to the location in memory where I stuffed that data that describes whatever you just put on my scanner bed."

      It is then your job as the programmer to use that *pointer* (now keep in mind a pointer is just an address location to somewhere in memory) to access that area in memory and then do whatever you want to do with it. Make a copy, change some bits around, save it to a database, whatever you want.

      If you don't know how to access that pointer, or area in memory, and you don't know what to do with the data once you have that pointer then it's going to be real hard to continue.

      Comment

      Working...