mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-31 00:32:48 +00:00
Added Sprite::remapImages().
This commit is contained in:
parent
4ce6b2866d
commit
1320ad7b61
@ -272,6 +272,30 @@ public:
|
|||||||
getFolder()->get_cels(cels);
|
getFolder()->get_cels(cels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void remapImages(int frame_from, int frame_to, const std::vector<int>& mapping) {
|
||||||
|
assert(m_imgtype == IMAGE_INDEXED);
|
||||||
|
assert(mapping.size() == 256);
|
||||||
|
|
||||||
|
CelList cels;
|
||||||
|
getCels(cels);
|
||||||
|
|
||||||
|
for (CelIterator it = cels.begin(); it != cels.end(); ++it) {
|
||||||
|
Cel* cel = *it;
|
||||||
|
|
||||||
|
// Remap this Cel because is inside the specified range
|
||||||
|
if (cel->frame >= frame_from &&
|
||||||
|
cel->frame <= frame_to) {
|
||||||
|
Image* image = stock_get_image(getStock(), cel->image);
|
||||||
|
|
||||||
|
for (int y=0; y<image->h; ++y) {
|
||||||
|
IndexedTraits::address_t ptr = image_address_fast<IndexedTraits>(image, 0, y);
|
||||||
|
for (int x=0; x<image->w; ++x, ++ptr)
|
||||||
|
*ptr = mapping[*ptr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Undo* getUndo() const {
|
const Undo* getUndo() const {
|
||||||
return m_undo;
|
return m_undo;
|
||||||
}
|
}
|
||||||
@ -1358,6 +1382,11 @@ void Sprite::getCels(CelList& cels)
|
|||||||
m_impl->getCels(cels);
|
m_impl->getCels(cels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sprite::remapImages(int frame_from, int frame_to, const std::vector<int>& mapping)
|
||||||
|
{
|
||||||
|
m_impl->remapImages(frame_from, frame_to, mapping);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Undo
|
// Undo
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "jinete/jbase.h"
|
#include "jinete/jbase.h"
|
||||||
#include "raster/gfxobj.h"
|
#include "raster/gfxobj.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct FormatOptions;
|
struct FormatOptions;
|
||||||
class Image;
|
class Image;
|
||||||
@ -152,6 +153,8 @@ public:
|
|||||||
|
|
||||||
void getCels(CelList& cels);
|
void getCels(CelList& cels);
|
||||||
|
|
||||||
|
void remapImages(int frame_from, int frame_to, const std::vector<int>& mapping);
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Undo
|
// Undo
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user