Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use drawing functions? #69

Open
TonalidadeHidrica opened this issue Aug 27, 2020 · 3 comments
Open

How can I use drawing functions? #69

TonalidadeHidrica opened this issue Aug 27, 2020 · 3 comments

Comments

@TonalidadeHidrica
Copy link

What is the equivalent functions of --draw , --fill or --stroke commands and so on? I looked up the source code but didn't understand how can I use it.

@nlfiedler
Copy link
Owner

I did not add the functions, and I have not tried using them, but there are whole bunch defined (using macros) in src/wand/drawing.rs that might be what you are looking for. These map directly to functions within MagickWand that have similar names. Sorry there is no example to speak of, but if you are familiar with the MagickWand API, then it should be reasonably straightforward to use the magick-rust API.

@TonalidadeHidrica
Copy link
Author

Thank you for your reply. After I posted this I looked up by myself and found a MagicWand example in C that draws shapes. Seems that I can use set_fill_color and set_stroke_color, which correspond to DrawSetFillColor and DrawSetStrokeColor respectively. However I couldn't find how to draw a rectangle, since there were no binding defined in drawing.rs. The corresponding function seems to be DrawRectangle, which I couldn't find this string in the source code at all. Maybe I should make an unsafe call to this function, or make a safe wrapper by myself?

@nlfiedler
Copy link
Owner

For now, I would say write your own unsafe call and if that proves to work, paste a code snippet here and we can try to work it into this library. I imagine the best place for it would be in wand/magick.rs as another wrapper function on the MagickWand type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants