mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-07 09:56:59 +00:00
Add support for sprite slicing
This commit is contained in:
parent
174ec28638
commit
b1d8da925c
@ -11,6 +11,7 @@
|
||||
#include "doc/image_impl.h"
|
||||
#include "doc/layer.h"
|
||||
#include "doc/palette.h"
|
||||
#include "doc/slice.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "psd/psd.h"
|
||||
|
||||
@ -118,6 +119,25 @@ public:
|
||||
m_layerHasTransparentChannel = hasTransparency(header.nchannels);
|
||||
}
|
||||
|
||||
void onSlicesData(const psd::Slices& slices) override
|
||||
{
|
||||
auto& spriteSlices = m_sprite->slices();
|
||||
for (const auto& slice : slices.slices) {
|
||||
const gfx::Rect rect(slice.bound.left,
|
||||
slice.bound.top,
|
||||
slice.bound.right - slice.bound.left,
|
||||
slice.bound.bottom - slice.bound.top);
|
||||
if (!rect.isEmpty() && slice.groupID > 0) {
|
||||
auto slice = new doc::Slice;
|
||||
slice->insert(0, doc::SliceKey(rect));
|
||||
|
||||
// TO-DO: the slices color should come from the app preference
|
||||
slice->userData().setColor(doc::rgba(0, 0, 255, 255));
|
||||
spriteSlices.add(slice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onFramesData(const std::vector<psd::FrameInformation>& frameInfo,
|
||||
const uint32_t activeFrameIndex) override
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user