Porting Some cpp to C#...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Samishii23
    New Member
    • Sep 2009
    • 246

    Porting Some cpp to C#...

    So yea... I Have a need to work with some image files in a .blp format.
    From what I understand is its some kinda altered jpeg format. Using RBGA. No idea why. But its what I have to work with...

    Anyways. I found some source for handling it, buts its in CPP, and I am no where close to being able to under stand it or be able to port it. I have consulted the author of said src, and he has helped me a little, though he has no time to assist...

    I have the Source in the attached files. Any help, or idea of how I may go about this... Would be awesomely apperciated!
    Attached Files
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    You know, you can build this source as a dll in C++ and then call it from C#... it'd save you the trouble of porting it.

    As for porting it, C# and C++ are similar in language structure. Your best bet would be to learn a bit of C++ (take an online tutorial or two) and then dive right in. Google will be your friend here since you'll need to find or write equivalents to various methods in here (such as std::memcpy and std::max). You'll also need to learn a bit about pointers and dynamic memory for C++ since it looks like it's used quite a bit here. You can use pointers in C# if you want (using an unsafe code block) but if you understand them, you can always do it without pointers.

    I hope that's enough to get you started, though I'd strongly recommend that unless you have a very good reason not to, just build the C++ code as a dll and call it from C#. You'll save yourself a ton of headache :)

    Comment

    Working...