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

Implement all Shape variants #13

Closed
wants to merge 1 commit into from

Conversation

Lustmored
Copy link

@Lustmored Lustmored commented Sep 14, 2020

I want to give vips a spin on my project, so I'm doing my best to implement missing functionality.

This PR introduces all shape variants. After previous attempts I have decided to go with creating string with correct SVG representation of shape to be created and use vips to import it and composite over original image.

It gives the same or even nicer results than draw_* results while being way simpler and less "hacky" (creating ellipses or polygons with arbitrary border width would be a nightmare in pure vips).

[OUTDATED - original description]
This PR introduces simple RectangleShape, EllipseShape and CircleShape.

I'm afraid remaining shapes will not be as easy as those because I see no way to control border width in vips. I'm torn between trying to implement them correctly (that would probably be difficult and complex in case of Polygon and Line) or implementing them with only support for single pixel border, ignoring this attribute at all.

@bonzai
Copy link
Member

bonzai commented Sep 14, 2020

Thanks! I'll check it out in my free time.

@Lustmored Lustmored changed the title Implement RectangleShape and CircleShape Implement RectangleShape, CircleShape and EllipseShape Sep 15, 2020
@Lustmored Lustmored force-pushed the shapes branch 3 times, most recently from 0b17951 to 662d642 Compare September 16, 2020 12:58
@Lustmored Lustmored changed the title Implement RectangleShape, CircleShape and EllipseShape Implement all Shape variants Sep 16, 2020
@Lustmored
Copy link
Author

I've chosen different, more efficient approach to shape problems - since vips can understand SVG perfectly I've simply created SNG representations of shapes to be drawn and left everything else to processing engine itself. The code is much cleaner and the possibilities much better.

Also this avouds calls to vips drawing module which advertises itself as being slow and to be used only when really necessary.

@Lustmored
Copy link
Author

This PR is superseded by #14 so I'm closing it myself.

@Lustmored Lustmored closed this Sep 18, 2020
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

Successfully merging this pull request may close these issues.

2 participants