tahoma2d/toonz/sources/image/sprite/tiio_sprite.h
Jeremy Bullock 764038cd1a Spritesheet Export (#752)
Added 'spritesheet' for the output format options, supporting as follows:
- Crops transparent area from images
- Set output format (Grid, Vertical, Horizontal)
- Scale output
- Set padding
- Export text file along with spritesheet with info about image sizes, padding etc. . .
The result is compatible with Game Maker Studio.
2016-11-24 11:08:30 +09:00

63 lines
1.6 KiB
C++

#pragma once
#ifndef TTIO_SPRITE_INCLUDED
#define TTIO_SPRITE_INCLUDED
#include "tproperty.h"
#include "tlevel_io.h"
#include "trasterimage.h"
#include <QVector>
#include <QStringList>
#include <QtGui/QImage>
//===========================================================
//
// TLevelWriterSprite
//
//===========================================================
class TLevelWriterSprite : public TLevelWriter {
public:
TLevelWriterSprite(const TFilePath &path, TPropertyGroup *winfo);
~TLevelWriterSprite();
void setFrameRate(double fps);
TImageWriterP getFrameWriter(TFrameId fid) override;
void save(const TImageP &image, int frameIndex);
void saveSoundTrack(TSoundTrack *st);
static TLevelWriter *create(const TFilePath &path, TPropertyGroup *winfo) {
return new TLevelWriterSprite(path, winfo);
}
private:
int m_lx, m_ly;
int m_scale;
int m_topPadding, m_bottomPadding, m_leftPadding, m_rightPadding;
int m_left = 0, m_right = 0, m_top = 0, m_bottom = 0;
std::vector<QImage *> m_images;
std::vector<QImage> m_imagesResized;
bool m_firstPass = true;
QString m_format;
// void *m_buffer;
};
//===========================================================================
namespace Tiio {
//===========================================================================
class SpriteWriterProperties : public TPropertyGroup {
public:
TEnumProperty m_format;
TIntProperty m_topPadding, m_bottomPadding, m_leftPadding, m_rightPadding;
TIntProperty m_scale;
SpriteWriterProperties();
};
//===========================================================================
} // namespace
#endif