Rotating a Bitmap image with C4D's C++ SDK?
-
Hey everyone!
I have been developing a C++ plugin for Cinema 4D for the last 2 months and things are going reasonably well. I aim to distribute this plugin once I have completed it.
Recently, I wanted to "paste" a currently existing Bitmap image multiple times onto an object's UV texture, where, for every "pasting"' instance, I would rotate and scale said Bitmap image.
While I'm aware that Cinema 4D's C++ SDK has some image-related methods, I thought I would be better off by just embedding/static-linking an external library to my project, like OpenCV or CImg.
Well... this lead me down a 3-day long journey of relentless troubleshooting that I did not see coming. Compiling error after compiling error and nothing I did to fix/suppress said errors helped. I'll spare you the details
While I am fully aware that external C++ libraries are outside the scope of this forum, on this 4th day of troubleshooting, I can't help but be desperate for any outside support.
I guess my question is: has anyone successfully imported an external image processing C++ library within their C4D plugin?
Parallel question to the one above: by only using Cinema 4D's C++ SDK, would I be able to "paste" and rotate and scale a Bitmap image onto a UV texture... with anti-aliasing?
I'll take any tip or assistance you guys can give me. I'm really out of ideas at this point
Thank you so much!!
-
Hello @sasha_janvier , welcome to the Plugin Cafรฉ forum and the Cinema 4D development community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.
About your First Question
Please excuse the delay with the answer.
You're definitely right that support for 3rd party libs is out of scope for this forum.
There're interfaces to work with media data provided with our SDK. Namely, the maxon API Images Manual is the one you should first have a look at. Another point of interest for you would be classic API BaseBitmap Manual.
There's also a classic API GeClipMap Manual helper class that provides some drawing functionality for the BaseBitmaps, however, there's no specific rotating functions that you've addressed in you posting. For this I'd suggest implementing one yourself (please, have a look at the thread, where it was already discussed: Rotating a GeClipMap).
You might be also interested in exploring the Access Pixel Formats manual page, which is although not fully related, though contains a good set of example code snippets showing the usage of our interfaces for different use cases.
May I ask what do you mean by "UV texture" and what are you using it for? Is it how you call the UV-mapping, and then you need to process your image operation manually, or is it how you call generic textures (e.g. for materials) that follow objects UV-mapping? In second case, I would suggest using built-in functions for texture rotating rather than performing expensive operations yourself. For example, for redshift material you can use General -> UV -> Remap values for scaling, offsetting and rotating your texture.
Cheers,
IliaRedshift Texture node UV remapping attributes:
-
Hey Ilia!
Thank you very kindly for your support.
I'm happy to report that during this forum's downtime (and also after stepping away from my code for a few days, which did some good), I came back to my code and figured out how to rotate an image in C++. I then managed to get rid of the "holes" on the image produced by the rotation and added a bilinear interpolation as well.
So... I guess all is good for now?
I would be more than happy to read the suggested "Support Procedures: Asking Questions." page, but it seems like it's offline at the moment. I'll check back on it in a few days.
Thank you very much again!
-
Hi I've fixed the links, in any case you can reach the support procedure by clicking on Support
Cheers,
Maxime -
Thanks @m_adam. I read the page. Duly noted!