twostraws / SwiftGD

A simple Swift wrapper for libgd
MIT License
454 stars 71 forks source link

swiftGD.Image isn't able to draw a tilted/rotated rectangle #27

Open vitalz opened 4 years ago

vitalz commented 4 years ago

swiftGD.Image isn't able to draw a titled/rotated rectangle (both 'stroke' and filled)

vitalz commented 4 years ago

It looks libgd doesn't have such ability itself but SwiftGD is a bridge and could add such feature out of box. Otherwise another options (graph libs) adapted to Swift have to be figured out.

deirdresm commented 3 years ago

The old school way to do this is simply to draw the filled rectangle, then draw the bordered (no fill) rectangle on top. Given that libgd is a very lightweight old school library, that's how I'd accomplish the task.

mcritz commented 3 years ago

@vitalz I wouldn’t expect SwiftGD to do this out of the box. It’s more of a direct port of gd and should behave like gd does.

Of course, you could write your own methods to accomplish what you’re after.

vitalz commented 3 years ago

The old school way to do this is simply to draw the filled rectangle, then draw the bordered (no fill) rectangle on top. Given that libgd is a very lightweight old school library, that's how I'd accomplish the task.

By tilted I meant a rotated rectangle. Wrongly used titled.