
Aseprite是一款专业的像素艺术和动画制作软件,专注于为游戏开发者和像素艺术家提供完整的创作工具链。该项目采用C++编写,支持跨平台运行,拥有活跃的开源社区和持续的开发维护。
# 克隆仓库
git clone --recursive https://github.com/aseprite/aseprite.git
cd aseprite
# 自动构建(下载Skia/发布模式)
./build.sh --auto# 重置配置(如果需要)
./build.sh --reset
# 交互式构建
./build.shAseprite提供完整的像素艺术创作环境。以下是核心功能的使用概览:
// 创建颜色对象示例
app::Color color = app::Color::fromRgb(255, 0, 0, 255); // 红色
app::Color indexedColor = app::Color::fromIndex(16); // 调色板索引颜色
// 颜色选择器使用
app::ColorPicker picker;
Site site = context->activeSite();
picker.pickColor(site, pos, proj, ColorPicker::FromComposition);// 创建新文档
Doc* doc = new Doc(Sprite::MakeStdSprite(ImageSpec(colorMode, width, height), ncolors));
doc->setFilename("NewSprite");
// 添加文档到上下文
context->documents().add(doc);// Aseprite颜色系统核心实现
class Color {
public:
enum Type {
MaskType, RgbType, HsvType, HslType,
GrayType, IndexType, TileType
};
static Color fromRgb(int r, int g, int b, int a = 255);
static Color fromIndex(int index);
Color toRgb() const;
std::string toString() const;
private:
Type m_type;
union {
struct { int r, g, b, a; } rgb;
struct { double h, s, v; int a; } hsv;
int index;
doc::tile_t tile;
} m_value;
};// 文档撤销管理核心类
class DocUndo : public obs::observable<DocUndoObserver> {
public:
void add(CmdTransaction* cmd);
bool canUndo() const;
bool canRedo() const;
void undo();
void redo();
size_t totalUndoSize() const { return m_totalUndoSize; }
std::string nextUndoLabel() const;
std::string nextRedoLabel() const;
private:
undo::UndoHistory m_undoHistory;
size_t m_totalUndoSize = 0;
bool m_undoing = false;
};// 插件和主题扩展支持
class Extension {
public:
enum class Category {
None, Keys, Languages, Themes,
Scripts, Palettes, DitheringMatrices
};
struct ThemeInfo {
std::string path;
std::string variant;
};
using Themes = std::map<std::string, ThemeInfo>;
using DitheringMatrices = std::map<std::string, DitheringMatrixInfo>;
private:
std::string m_name;
std::string m_version;
std::string m_path;
Category m_category;
};// 精灵表和数据导出功能
class DocExporter {
public:
void setDataFormat(SpriteSheetDataFormat format);
void setSpriteSheetType(SpriteSheetType type);
void exportSpriteSheet(Doc* doc, const std::string& filename);
private:
SpriteSheetDataFormat m_dataFormat;
SpriteSheetType m_sheetType;
std::string m_filenameFormat;
};这些核心模块展示了Aseprite的强大功能架构,从基础的颜色管理到高级的动画导出,为像素艺术创作提供了完整的技术支持。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。