-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add gfx::RectT slicing methods #102
Conversation
clang-tidy review says "All clean, LGTM! 👍" |
@martincapello in which way these methods are used? probably a |
I'm using the nineSlice method to split Aseprite's 9-slices to get each rect that I have to use to split the image under the each part of the 9-slice slice. Also, I need it to split the 9-slice bounds while the user is modifying its center/size, so I can use each rect to scale each part of the original image according to the new size of each slice's part. |
I think that maybe I could try to use a gfx::Region...I'm not sure how convenient it would be, but I can try if you want. |
As I don't have the code at hand I cannot decide what is best for your case. In case
|
I will push it soon.
I have been playing around with https://fiddle.skia.org/ and trying the difference operator to subtract the center rect from a region...and it seems that it would not fit my case very well (it would make the code more complex actually). Alright, I will update the API. Also we can just move this to Aseprite if you are not sure that they belong to Laf. Mostly because nineSlice seems too specific to my use case...the sliceV and sliceH feels more generic or primitive...
Oh yeah, missed that one, thanks. |
431b53d
to
0380f7f
Compare
clang-tidy review says "All clean, LGTM! 👍" |
1 similar comment
clang-tidy review says "All clean, LGTM! 👍" |
Now all the slice methods are const and return *this. Also sliceV and sliceH now use two references to return the results
0380f7f
to
cbcb6cd
Compare
clang-tidy review says "All clean, LGTM! 👍" |
I have just pushed a commit with my use case: aseprite/aseprite@de6b337 These are the lines where I use the nineSlice method: |
I'll revert this commit force pushing laf beta, this commit should have gone to the main branch. |
I need these methods to implement aseprite/aseprite#4533
I have also added tests for them.
I'm not sure if you @dacap want this to be added here in laf. So let me know if you think I should move them to some aseprite utilities methods.
Maybe we can keep the sliceV and sliceH methods and move the nineSlice method. Idk whatever you say is okay.