mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +00:00
Rename docio to dio
This commit is contained in:
parent
e98e7de615
commit
43db106db0
@ -95,7 +95,7 @@ add_subdirectory(gen)
|
|||||||
add_subdirectory(gfx)
|
add_subdirectory(gfx)
|
||||||
add_subdirectory(net)
|
add_subdirectory(net)
|
||||||
add_subdirectory(render)
|
add_subdirectory(render)
|
||||||
add_subdirectory(docio)
|
add_subdirectory(dio)
|
||||||
add_subdirectory(ft)
|
add_subdirectory(ft)
|
||||||
add_subdirectory(she)
|
add_subdirectory(she)
|
||||||
add_subdirectory(ui)
|
add_subdirectory(ui)
|
||||||
|
@ -46,11 +46,11 @@ because they don't depend on any other component.
|
|||||||
|
|
||||||
## Level 4
|
## Level 4
|
||||||
|
|
||||||
* [docio](docio/) (base, flic): Load/save documents.
|
* [dio](dio/) (base, flic): Load/save documents.
|
||||||
|
|
||||||
## Level 5
|
## Level 5
|
||||||
|
|
||||||
* [app](app/) (allegro, base, doc, docio, filters, fixmath, flic, gfx, pen, render, scripting, she, ui, undo, updater, webserver)
|
* [app](app/) (allegro, base, doc, dio, filters, fixmath, flic, gfx, pen, render, scripting, she, ui, undo, updater, webserver)
|
||||||
|
|
||||||
## Level 6
|
## Level 6
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ target_link_libraries(app-lib
|
|||||||
cfg-lib
|
cfg-lib
|
||||||
clip
|
clip
|
||||||
doc-lib
|
doc-lib
|
||||||
docio-lib
|
dio-lib
|
||||||
filters-lib
|
filters-lib
|
||||||
fixmath-lib
|
fixmath-lib
|
||||||
flic-lib
|
flic-lib
|
||||||
|
@ -174,7 +174,7 @@ private:
|
|||||||
class AseFormat : public FileFormat {
|
class AseFormat : public FileFormat {
|
||||||
const char* onGetName() const override { return "ase"; }
|
const char* onGetName() const override { return "ase"; }
|
||||||
const char* onGetExtensions() const override { return "ase,aseprite"; }
|
const char* onGetExtensions() const override { return "ase,aseprite"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::ASE_ANIMATION; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::ASE_ANIMATION; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -45,7 +45,7 @@ class BmpFormat : public FileFormat {
|
|||||||
|
|
||||||
const char* onGetName() const override { return "bmp"; }
|
const char* onGetName() const override { return "bmp"; }
|
||||||
const char* onGetExtensions() const override { return "bmp"; }
|
const char* onGetExtensions() const override { return "bmp"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::BMP_IMAGE; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::BMP_IMAGE; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
#include "base/scoped_lock.h"
|
#include "base/scoped_lock.h"
|
||||||
#include "base/shared_ptr.h"
|
#include "base/shared_ptr.h"
|
||||||
#include "base/string.h"
|
#include "base/string.h"
|
||||||
|
#include "dio/detect_format.h"
|
||||||
#include "doc/doc.h"
|
#include "doc/doc.h"
|
||||||
#include "docio/detect_format.h"
|
|
||||||
#include "render/quantization.h"
|
#include "render/quantization.h"
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
#include "ui/alert.h"
|
#include "ui/alert.h"
|
||||||
@ -128,7 +128,7 @@ bool is_static_image_format(const std::string& filename)
|
|||||||
// Get the format through the extension of the filename
|
// Get the format through the extension of the filename
|
||||||
FileFormat* format =
|
FileFormat* format =
|
||||||
FileFormatsManager::instance()
|
FileFormatsManager::instance()
|
||||||
->getFileFormat(docio::detect_format_by_file_extension(filename));
|
->getFileFormat(dio::detect_format_by_file_extension(filename));
|
||||||
|
|
||||||
return (format && format->support(FILE_SUPPORT_SEQUENCES));
|
return (format && format->support(FILE_SUPPORT_SEQUENCES));
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ FileOp* FileOp::createLoadDocumentOperation(Context* context, const std::string&
|
|||||||
|
|
||||||
// Get the format through the extension of the filename
|
// Get the format through the extension of the filename
|
||||||
fop->m_format = FileFormatsManager::instance()->getFileFormat(
|
fop->m_format = FileFormatsManager::instance()->getFileFormat(
|
||||||
docio::detect_format(filename));
|
dio::detect_format(filename));
|
||||||
if (!fop->m_format ||
|
if (!fop->m_format ||
|
||||||
!fop->m_format->support(FILE_SUPPORT_LOAD)) {
|
!fop->m_format->support(FILE_SUPPORT_LOAD)) {
|
||||||
fop->setError("%s can't load \"%s\" file (\"%s\")\n", PACKAGE,
|
fop->setError("%s can't load \"%s\" file (\"%s\")\n", PACKAGE,
|
||||||
@ -329,7 +329,7 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
|
|
||||||
// Get the format through the extension of the filename
|
// Get the format through the extension of the filename
|
||||||
fop->m_format = FileFormatsManager::instance()->getFileFormat(
|
fop->m_format = FileFormatsManager::instance()->getFileFormat(
|
||||||
docio::detect_format_by_file_extension(filename));
|
dio::detect_format_by_file_extension(filename));
|
||||||
if (!fop->m_format ||
|
if (!fop->m_format ||
|
||||||
!fop->m_format->support(FILE_SUPPORT_SAVE)) {
|
!fop->m_format->support(FILE_SUPPORT_SAVE)) {
|
||||||
fop->setError("%s can't save \"%s\" file (\"%s\")\n", PACKAGE,
|
fop->setError("%s can't save \"%s\" file (\"%s\")\n", PACKAGE,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -33,9 +33,9 @@ const char* FileFormat::extensions() const
|
|||||||
return onGetExtensions();
|
return onGetExtensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
docio::FileFormat FileFormat::docioFormat() const
|
dio::FileFormat FileFormat::dioFormat() const
|
||||||
{
|
{
|
||||||
return onGetDocioFormat();
|
return onGetDioFormat();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileFormat::load(FileOp* fop)
|
bool FileFormat::load(FileOp* fop)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/shared_ptr.h"
|
#include "base/shared_ptr.h"
|
||||||
#include "docio/file_format.h"
|
#include "dio/file_format.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ namespace app {
|
|||||||
|
|
||||||
const char* name() const; // File format name
|
const char* name() const; // File format name
|
||||||
const char* extensions() const; // Extensions (e.g. "jpeg,jpg")
|
const char* extensions() const; // Extensions (e.g. "jpeg,jpg")
|
||||||
docio::FileFormat docioFormat() const;
|
dio::FileFormat dioFormat() const;
|
||||||
|
|
||||||
bool load(FileOp* fop);
|
bool load(FileOp* fop);
|
||||||
#ifdef ENABLE_SAVE
|
#ifdef ENABLE_SAVE
|
||||||
@ -73,7 +73,7 @@ namespace app {
|
|||||||
protected:
|
protected:
|
||||||
virtual const char* onGetName() const = 0;
|
virtual const char* onGetName() const = 0;
|
||||||
virtual const char* onGetExtensions() const = 0;
|
virtual const char* onGetExtensions() const = 0;
|
||||||
virtual docio::FileFormat onGetDocioFormat() const = 0;
|
virtual dio::FileFormat onGetDioFormat() const = 0;
|
||||||
virtual int onGetFlags() const = 0;
|
virtual int onGetFlags() const = 0;
|
||||||
|
|
||||||
virtual bool onLoad(FileOp* fop) = 0;
|
virtual bool onLoad(FileOp* fop) = 0;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "app/file/file_format.h"
|
#include "app/file/file_format.h"
|
||||||
#include "app/file/format_options.h"
|
#include "app/file/format_options.h"
|
||||||
#include "base/string.h"
|
#include "base/string.h"
|
||||||
#include "docio/detect_format.h"
|
#include "dio/detect_format.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -92,10 +92,10 @@ FileFormatsList::iterator FileFormatsManager::end()
|
|||||||
return m_formats.end();
|
return m_formats.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
FileFormat* FileFormatsManager::getFileFormat(const docio::FileFormat docioFormat) const
|
FileFormat* FileFormatsManager::getFileFormat(const dio::FileFormat dioFormat) const
|
||||||
{
|
{
|
||||||
for (FileFormat* ff : m_formats)
|
for (FileFormat* ff : m_formats)
|
||||||
if (ff->docioFormat() == docioFormat)
|
if (ff->dioFormat() == dioFormat)
|
||||||
return ff;
|
return ff;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -8,7 +8,7 @@
|
|||||||
#define APP_FILE_FILE_FORMATS_MANAGER_H_INCLUDED
|
#define APP_FILE_FILE_FORMATS_MANAGER_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "docio/file_format.h"
|
#include "dio/file_format.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ namespace app {
|
|||||||
FileFormatsList::iterator begin();
|
FileFormatsList::iterator begin();
|
||||||
FileFormatsList::iterator end();
|
FileFormatsList::iterator end();
|
||||||
|
|
||||||
FileFormat* getFileFormat(const docio::FileFormat docioFormat) const;
|
FileFormat* getFileFormat(const dio::FileFormat dioFormat) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileFormatsManager();
|
FileFormatsManager();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -27,7 +27,7 @@ using namespace base;
|
|||||||
class FliFormat : public FileFormat {
|
class FliFormat : public FileFormat {
|
||||||
const char* onGetName() const override { return "flc"; }
|
const char* onGetName() const override { return "flc"; }
|
||||||
const char* onGetExtensions() const override{ return "flc,fli"; }
|
const char* onGetExtensions() const override{ return "flc,fli"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::FLIC_ANIMATION; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::FLIC_ANIMATION; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -64,7 +64,7 @@ class GifFormat : public FileFormat {
|
|||||||
|
|
||||||
const char* onGetName() const override { return "gif"; }
|
const char* onGetName() const override { return "gif"; }
|
||||||
const char* onGetExtensions() const override { return "gif"; }
|
const char* onGetExtensions() const override { return "gif"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::GIF_ANIMATION; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::GIF_ANIMATION; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -26,7 +26,7 @@ using namespace base;
|
|||||||
class IcoFormat : public FileFormat {
|
class IcoFormat : public FileFormat {
|
||||||
const char* onGetName() const override { return "ico"; }
|
const char* onGetName() const override { return "ico"; }
|
||||||
const char* onGetExtensions() const override { return "ico"; }
|
const char* onGetExtensions() const override { return "ico"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::ICO_IMAGES; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::ICO_IMAGES; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -42,7 +42,7 @@ class JpegFormat : public FileFormat {
|
|||||||
|
|
||||||
const char* onGetName() const override { return "jpeg"; }
|
const char* onGetName() const override { return "jpeg"; }
|
||||||
const char* onGetExtensions() const override { return "jpeg,jpg"; }
|
const char* onGetExtensions() const override { return "jpeg,jpg"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::JPEG_IMAGE; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::JPEG_IMAGE; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -24,7 +24,7 @@
|
|||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "docio/detect_format.h"
|
#include "dio/detect_format.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
@ -48,29 +48,29 @@ std::string get_writable_palette_extensions()
|
|||||||
|
|
||||||
Palette* load_palette(const char* filename)
|
Palette* load_palette(const char* filename)
|
||||||
{
|
{
|
||||||
docio::FileFormat docioFormat = docio::detect_format(filename);
|
dio::FileFormat dioFormat = dio::detect_format(filename);
|
||||||
Palette* pal = nullptr;
|
Palette* pal = nullptr;
|
||||||
|
|
||||||
switch (docioFormat) {
|
switch (dioFormat) {
|
||||||
|
|
||||||
case docio::FileFormat::COL_PALETTE:
|
case dio::FileFormat::COL_PALETTE:
|
||||||
pal = doc::file::load_col_file(filename);
|
pal = doc::file::load_col_file(filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case docio::FileFormat::GPL_PALETTE:
|
case dio::FileFormat::GPL_PALETTE:
|
||||||
pal = doc::file::load_gpl_file(filename);
|
pal = doc::file::load_gpl_file(filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case docio::FileFormat::HEX_PALETTE:
|
case dio::FileFormat::HEX_PALETTE:
|
||||||
pal = doc::file::load_hex_file(filename);
|
pal = doc::file::load_hex_file(filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case docio::FileFormat::PAL_PALETTE:
|
case dio::FileFormat::PAL_PALETTE:
|
||||||
pal = doc::file::load_pal_file(filename);
|
pal = doc::file::load_pal_file(filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
FileFormat* ff = FileFormatsManager::instance()->getFileFormat(docioFormat);
|
FileFormat* ff = FileFormatsManager::instance()->getFileFormat(dioFormat);
|
||||||
if (!ff || !ff->support(FILE_SUPPORT_LOAD))
|
if (!ff || !ff->support(FILE_SUPPORT_LOAD))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -106,29 +106,29 @@ Palette* load_palette(const char* filename)
|
|||||||
|
|
||||||
bool save_palette(const char* filename, const Palette* pal, int columns)
|
bool save_palette(const char* filename, const Palette* pal, int columns)
|
||||||
{
|
{
|
||||||
docio::FileFormat docioFormat = docio::detect_format_by_file_extension(filename);
|
dio::FileFormat dioFormat = dio::detect_format_by_file_extension(filename);
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
switch (docioFormat) {
|
switch (dioFormat) {
|
||||||
|
|
||||||
case docio::FileFormat::COL_PALETTE:
|
case dio::FileFormat::COL_PALETTE:
|
||||||
success = doc::file::save_col_file(pal, filename);
|
success = doc::file::save_col_file(pal, filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case docio::FileFormat::GPL_PALETTE:
|
case dio::FileFormat::GPL_PALETTE:
|
||||||
success = doc::file::save_gpl_file(pal, filename);
|
success = doc::file::save_gpl_file(pal, filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case docio::FileFormat::HEX_PALETTE:
|
case dio::FileFormat::HEX_PALETTE:
|
||||||
success = doc::file::save_hex_file(pal, filename);
|
success = doc::file::save_hex_file(pal, filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case docio::FileFormat::PAL_PALETTE:
|
case dio::FileFormat::PAL_PALETTE:
|
||||||
success = doc::file::save_pal_file(pal, filename);
|
success = doc::file::save_pal_file(pal, filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
FileFormat* ff = FileFormatsManager::instance()->getFileFormat(docioFormat);
|
FileFormat* ff = FileFormatsManager::instance()->getFileFormat(dioFormat);
|
||||||
if (!ff || !ff->support(FILE_SUPPORT_SAVE))
|
if (!ff || !ff->support(FILE_SUPPORT_SAVE))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -24,7 +24,7 @@ using namespace base;
|
|||||||
class PcxFormat : public FileFormat {
|
class PcxFormat : public FileFormat {
|
||||||
const char* onGetName() const override { return "pcx"; }
|
const char* onGetName() const override { return "pcx"; }
|
||||||
const char* onGetExtensions() const override { return "pcx,pcc"; }
|
const char* onGetExtensions() const override { return "pcx,pcc"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::PCX_IMAGE; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::PCX_IMAGE; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -29,7 +29,7 @@ using namespace base;
|
|||||||
class PngFormat : public FileFormat {
|
class PngFormat : public FileFormat {
|
||||||
const char* onGetName() const override { return "png"; }
|
const char* onGetName() const override { return "png"; }
|
||||||
const char* onGetExtensions() const override { return "png"; }
|
const char* onGetExtensions() const override { return "png"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::PNG_IMAGE; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::PNG_IMAGE; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -25,7 +25,7 @@ using namespace base;
|
|||||||
class TgaFormat : public FileFormat {
|
class TgaFormat : public FileFormat {
|
||||||
const char* onGetName() const override { return "tga"; }
|
const char* onGetName() const override { return "tga"; }
|
||||||
const char* onGetExtensions() const override { return "tga"; }
|
const char* onGetExtensions() const override { return "tga"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::TARGA_IMAGE; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::TARGA_IMAGE; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2015-2017 David Capello
|
||||||
// Copyright (C) 2015 Gabriel Rauter
|
// Copyright (C) 2015 Gabriel Rauter
|
||||||
// Copyright (C) 2015-2016 David Capello
|
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
@ -41,7 +41,7 @@ class WebPFormat : public FileFormat {
|
|||||||
|
|
||||||
const char* onGetName() const override { return "webp"; }
|
const char* onGetName() const override { return "webp"; }
|
||||||
const char* onGetExtensions() const override { return "webp"; }
|
const char* onGetExtensions() const override { return "webp"; }
|
||||||
docio::FileFormat onGetDocioFormat() const override { return docio::FileFormat::WEBP_ANIMATION; }
|
dio::FileFormat onGetDioFormat() const override { return dio::FileFormat::WEBP_ANIMATION; }
|
||||||
int onGetFlags() const override {
|
int onGetFlags() const override {
|
||||||
return
|
return
|
||||||
FILE_SUPPORT_LOAD |
|
FILE_SUPPORT_LOAD |
|
||||||
|
9
src/dio/CMakeLists.txt
Normal file
9
src/dio/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Aseprite Document IO Library
|
||||||
|
# Copyright (c) 2016-2017 David Capello
|
||||||
|
|
||||||
|
add_library(dio-lib
|
||||||
|
detect_format.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(dio-lib
|
||||||
|
flic-lib
|
||||||
|
laf-base)
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016 David Capello
|
Copyright (c) 2016-2017 David Capello
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
@ -1,4 +1,4 @@
|
|||||||
# Aseprite Document IO Library
|
# Aseprite Document IO Library
|
||||||
*Copyright (C) 2016 David Capello*
|
*Copyright (C) 2016-2017 David Capello*
|
||||||
|
|
||||||
> Distributed under [MIT license](LICENSE.txt)
|
> Distributed under [MIT license](LICENSE.txt)
|
@ -4,7 +4,7 @@
|
|||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
|
|
||||||
#include "docio/detect_format.h"
|
#include "dio/detect_format.h"
|
||||||
|
|
||||||
#include "base/file_handle.h"
|
#include "base/file_handle.h"
|
||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#define PNG_MAGIC_DWORD1 0x474E5089
|
#define PNG_MAGIC_DWORD1 0x474E5089
|
||||||
#define PNG_MAGIC_DWORD2 0x0A1A0A0D
|
#define PNG_MAGIC_DWORD2 0x0A1A0A0D
|
||||||
|
|
||||||
namespace docio {
|
namespace dio {
|
||||||
|
|
||||||
FileFormat detect_format(const std::string& filename)
|
FileFormat detect_format(const std::string& filename)
|
||||||
{
|
{
|
||||||
@ -135,4 +135,4 @@ FileFormat detect_format_by_file_extension(const std::string& filename)
|
|||||||
return FileFormat::UNKNOWN;
|
return FileFormat::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace docio
|
} // namespace dio
|
@ -1,23 +1,23 @@
|
|||||||
// Aseprite Document IO Library
|
// Aseprite Document IO Library
|
||||||
// Copyright (c) 2016 David Capello
|
// Copyright (c) 2016-2017 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
|
|
||||||
#ifndef DOCIO_DETECT_FORMAT_H_INCLUDED
|
#ifndef DIO_DETECT_FORMAT_H_INCLUDED
|
||||||
#define DOCIO_DETECT_FORMAT_H_INCLUDED
|
#define DIO_DETECT_FORMAT_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "docio/file_format.h"
|
#include "dio/file_format.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace docio {
|
namespace dio {
|
||||||
|
|
||||||
FileFormat detect_format(const std::string& filename);
|
FileFormat detect_format(const std::string& filename);
|
||||||
FileFormat detect_format_by_file_content(const std::string& filename);
|
FileFormat detect_format_by_file_content(const std::string& filename);
|
||||||
FileFormat detect_format_by_file_extension(const std::string& filename);
|
FileFormat detect_format_by_file_extension(const std::string& filename);
|
||||||
|
|
||||||
} // namespace docio
|
} // namespace dio
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -4,11 +4,11 @@
|
|||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
|
|
||||||
#ifndef DOCIO_FILE_FORMAT_H_INCLUDED
|
#ifndef DIO_FILE_FORMAT_H_INCLUDED
|
||||||
#define DOCIO_FILE_FORMAT_H_INCLUDED
|
#define DIO_FILE_FORMAT_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace docio {
|
namespace dio {
|
||||||
|
|
||||||
enum class FileFormat {
|
enum class FileFormat {
|
||||||
ERROR = -1,
|
ERROR = -1,
|
||||||
@ -31,6 +31,6 @@ enum class FileFormat {
|
|||||||
WEBP_ANIMATION,
|
WEBP_ANIMATION,
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace docio
|
} // namespace dio
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,9 +0,0 @@
|
|||||||
# Aseprite Document IO Library
|
|
||||||
# Copyright (c) 2016 David Capello
|
|
||||||
|
|
||||||
add_library(docio-lib
|
|
||||||
detect_format.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(docio-lib
|
|
||||||
flic-lib
|
|
||||||
laf-base)
|
|
Loading…
x
Reference in New Issue
Block a user