Merge "raster" namespace into "doc" library

master
David Capello 2014-10-20 22:21:31 -03:00
parent d796256eef
commit 63995c6f0a
395 changed files with 2567 additions and 3511 deletions

View File

@ -28,7 +28,6 @@ set(aseprite_libraries
cfg-lib
css-lib
doc-lib
raster-lib
scripting-lib
undo-lib
filters-lib
@ -206,7 +205,6 @@ add_subdirectory(filters)
add_subdirectory(fixmath)
add_subdirectory(gen)
add_subdirectory(gfx)
add_subdirectory(raster)
add_subdirectory(scripting)
add_subdirectory(she)
add_subdirectory(ui)
@ -322,8 +320,7 @@ endfunction()
find_tests(base base-lib ${sys_libs})
find_tests(gfx gfx-lib base-lib ${sys_libs})
find_tests(raster raster-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
find_tests(doc doc-lib raster-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
find_tests(doc doc-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
find_tests(css css-lib gfx-lib base-lib ${libs3rdparty} ${sys_libs})
find_tests(ui ui-lib she gfx-lib base-lib ${libs3rdparty} ${sys_libs})
find_tests(app/file ${all_libs})

View File

@ -23,16 +23,15 @@ because they don't depend on any other component.
## Level 1
* [cfg](cfg/) (base): Library to load/save .ini files.
* [doc](doc/) (base, gfx): Document model library.
* [gen](gen/) (base): Helper utility to generate C++ files from different XMLs.
* [net](net/) (base): Networking library to send HTTP requests.
* [raster](raster/) (base, gfx): Library to handle graphics entities like sprites, images, frames.
* [she](she/) (base, gfx, allegro): A wrapper for the Allegro library.
* [webserver](webserver/) (base): HTTP web server (based on [mongoose](https://github.com/valenok/mongoose))
## Level 2
* [doc](doc/) (raster, base, gfx): Document model library.
* [filters](filters/) (base, gfx, raster): FX for raster images.
* [filters](filters/) (base, doc, gfx): Effects for images.
* [ui](ui/) (base, gfx, she): Portable UI library (buttons, windows, text fields, etc.)
* [updater](updater/) (base, net): Component to check for updates.
@ -42,7 +41,7 @@ because they don't depend on any other component.
## Level 4
* [app](app/) (allegro, base, doc, filters, gfx, iff, raster, scripting, she, ui, undo, updater, webserver)
* [app](app/) (allegro, base, doc, filters, gfx, iff, scripting, she, ui, undo, updater, webserver)
## Level 5

View File

@ -67,10 +67,10 @@
#include "base/path.h"
#include "base/unique_ptr.h"
#include "doc/document_observer.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/palette.h"
#include "doc/sprite.h"
#include "scripting/engine.h"
#include "she/display.h"
#include "she/error.h"

View File

@ -24,7 +24,7 @@
#include "base/string.h"
#include "base/system_console.h"
#include "base/unique_ptr.h"
#include "raster/pixel_format.h"
#include "doc/pixel_format.h"
#include <string>
#include <vector>
@ -35,7 +35,7 @@ namespace ui {
class Window;
}
namespace raster {
namespace doc {
class Layer;
}
@ -53,7 +53,7 @@ namespace app {
class ToolBox;
}
using namespace raster;
using namespace doc;
class App {
public:

View File

@ -26,9 +26,9 @@
#include "app/modules/palettes.h"
#include "gfx/hsv.h"
#include "gfx/rgb.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/primitives.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/primitives.h"
#include <cstdlib>
#include <iomanip>
@ -116,7 +116,7 @@ Color Color::fromImage(PixelFormat pixelFormat, color_t c)
Color Color::fromImageGetPixel(Image *image, int x, int y)
{
if ((x >= 0) && (y >= 0) && (x < image->width()) && (y < image->height()))
return Color::fromImage(image->pixelFormat(), raster::get_pixel(image, x, y));
return Color::fromImage(image->pixelFormat(), doc::get_pixel(image, x, y));
else
return Color::fromMask();
}

View File

@ -20,19 +20,19 @@
#define APP_COLOR_H_INCLUDED
#pragma once
#include "raster/color.h"
#include "raster/pixel_format.h"
#include "doc/color.h"
#include "doc/pixel_format.h"
#include <string>
namespace raster {
namespace doc {
class Image;
class Layer;
}
namespace app {
using namespace raster;
using namespace doc;
class Color {
public:

View File

@ -24,9 +24,9 @@
#include "app/document_location.h"
#include "gfx/point.h"
#include "raster/image.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
namespace app {
@ -48,18 +48,18 @@ void ColorPicker::pickColor(const DocumentLocation& location, int x, int y, Mode
}
else { // Pick from the current layer
int u, v;
raster::Image* image = location.image(&u, &v, NULL);
doc::Image* image = location.image(&u, &v, NULL);
gfx::Point pt(x-u, y-v);
if (image && image->bounds().contains(pt)) {
raster::color_t imageColor = get_pixel(image, pt.x, pt.y);
doc::color_t imageColor = get_pixel(image, pt.x, pt.y);
switch (image->pixelFormat()) {
case IMAGE_RGB:
m_alpha = raster::rgba_geta(imageColor);
m_alpha = doc::rgba_geta(imageColor);
break;
case IMAGE_GRAYSCALE:
m_alpha = raster::graya_geta(imageColor);
m_alpha = doc::graya_geta(imageColor);
break;
}

View File

@ -20,10 +20,10 @@
#define APP_COLOR_TARGET_H_INCLUDED
#pragma once
#include "raster/color.h"
#include "raster/layer.h"
#include "raster/pixel_format.h"
#include "raster/sprite.h"
#include "doc/color.h"
#include "doc/layer.h"
#include "doc/pixel_format.h"
#include "doc/sprite.h"
namespace app {
@ -35,13 +35,13 @@ namespace app {
TransparentLayer
};
ColorTarget(LayerType layerType, raster::PixelFormat pixelFormat, raster::color_t maskColor) :
ColorTarget(LayerType layerType, doc::PixelFormat pixelFormat, doc::color_t maskColor) :
m_layerType(layerType),
m_pixelFormat(pixelFormat),
m_maskColor(maskColor) {
}
ColorTarget(raster::Layer* layer) :
ColorTarget(doc::Layer* layer) :
m_layerType(layer->isBackground() ? BackgroundLayer: TransparentLayer),
m_pixelFormat(layer->sprite()->pixelFormat()),
m_maskColor(layer->sprite()->transparentColor()) {
@ -50,13 +50,13 @@ namespace app {
bool isBackground() const { return m_layerType == BackgroundLayer; }
bool isTransparent() const { return m_layerType == TransparentLayer; }
LayerType layerType() const { return m_layerType; }
raster::PixelFormat pixelFormat() const { return m_pixelFormat; }
raster::color_t maskColor() const { return m_maskColor; }
doc::PixelFormat pixelFormat() const { return m_pixelFormat; }
doc::color_t maskColor() const { return m_maskColor; }
private:
LayerType m_layerType;
raster::PixelFormat m_pixelFormat;
raster::color_t m_maskColor;
doc::PixelFormat m_pixelFormat;
doc::color_t m_maskColor;
};
} // namespace app

View File

@ -25,10 +25,10 @@
#include "app/modules/palettes.h"
#include "gfx/hsv.h"
#include "gfx/rgb.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/palette.h"
#include "doc/sprite.h"
namespace app {
@ -90,19 +90,19 @@ gfx::Color color_utils::color_for_ui(const app::Color& color)
return c;
}
raster::color_t color_utils::color_for_image(const app::Color& color, PixelFormat format)
doc::color_t color_utils::color_for_image(const app::Color& color, PixelFormat format)
{
if (color.getType() == app::Color::MaskType)
return 0;
raster::color_t c = -1;
doc::color_t c = -1;
switch (format) {
case IMAGE_RGB:
c = raster::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
c = doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
break;
case IMAGE_GRAYSCALE:
c = raster::graya(color.getGray(), 255);
c = doc::graya(color.getGray(), 255);
break;
case IMAGE_INDEXED:
c = color.getIndex();
@ -112,24 +112,24 @@ raster::color_t color_utils::color_for_image(const app::Color& color, PixelForma
return c;
}
raster::color_t color_utils::color_for_layer(const app::Color& color, Layer* layer)
doc::color_t color_utils::color_for_layer(const app::Color& color, Layer* layer)
{
return color_for_target(color, ColorTarget(layer));
}
raster::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget)
doc::color_t color_utils::color_for_target(const app::Color& color, const ColorTarget& colorTarget)
{
if (color.getType() == app::Color::MaskType)
return colorTarget.maskColor();
raster::color_t c = -1;
doc::color_t c = -1;
switch (colorTarget.pixelFormat()) {
case IMAGE_RGB:
c = raster::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
c = doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
break;
case IMAGE_GRAYSCALE:
c = raster::graya(color.getGray(), 255);
c = doc::graya(color.getGray(), 255);
break;
case IMAGE_INDEXED:
if (color.getType() == app::Color::IndexType) {

View File

@ -23,10 +23,10 @@
#include "app/color.h"
#include "app/color_target.h"
#include "gfx/color.h"
#include "raster/color.h"
#include "raster/pixel_format.h"
#include "doc/color.h"
#include "doc/pixel_format.h"
namespace raster {
namespace doc {
class Layer;
}
@ -37,9 +37,9 @@ namespace app {
gfx::Color blackandwhite_neg(gfx::Color color);
gfx::Color color_for_ui(const app::Color& color);
raster::color_t color_for_image(const app::Color& color, raster::PixelFormat format);
raster::color_t color_for_layer(const app::Color& color, raster::Layer* layer);
raster::color_t color_for_target(const app::Color& color, const ColorTarget& colorTarget);
doc::color_t color_for_image(const app::Color& color, doc::PixelFormat format);
doc::color_t color_for_layer(const app::Color& color, doc::Layer* layer);
doc::color_t color_for_target(const app::Color& color, const ColorTarget& colorTarget);
} // namespace color_utils
} // namespace app

View File

@ -28,8 +28,8 @@
#include "app/settings/settings.h"
#include "app/ui/color_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
namespace app {

View File

@ -36,9 +36,9 @@
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "base/unique_ptr.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/ui.h"
#include "generated_canvas_size.h"

View File

@ -29,11 +29,11 @@
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "base/mem_utils.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/ui.h"
namespace app {

View File

@ -28,9 +28,9 @@
#include "app/modules/gui.h"
#include "app/modules/palettes.h"
#include "app/undo_transaction.h"
#include "raster/dithering_method.h"
#include "raster/image.h"
#include "raster/sprite.h"
#include "doc/dithering_method.h"
#include "doc/image.h"
#include "doc/sprite.h"
namespace app {

View File

@ -31,8 +31,8 @@
#include "app/ui/main_window.h"
#include "app/ui/timeline.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "undo/undo_history.h"
namespace app {

View File

@ -28,9 +28,9 @@
#include "app/ui/main_window.h"
#include "app/ui/timeline.h"
#include "app/undo_transaction.h"
#include "raster/cel.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/sprite.h"
namespace app {

View File

@ -31,7 +31,7 @@
#include "app/ui/status_bar.h"
#include "app/ui/workspace.h"
#include "app/ui_context.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/ui.h"
#include <memory>

View File

@ -38,7 +38,7 @@
#include "base/bind.h"
#include "doc/context_observer.h"
#include "gfx/size.h"
#include "raster/mask.h"
#include "doc/mask.h"
#include "ui/ui.h"
namespace app {

View File

@ -27,9 +27,9 @@
#include "app/ui/timeline.h"
#include "app/util/clipboard.h"
#include "app/util/misc.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/base.h"
namespace app {

View File

@ -28,10 +28,10 @@
#include "app/undo_transaction.h"
#include "app/util/autocrop.h"
#include "app/util/misc.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/sprite.h"
namespace app {

View File

@ -24,9 +24,9 @@
#include "app/context_access.h"
#include "app/util/clipboard.h"
#include "app/util/misc.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/base.h"
namespace app {

View File

@ -25,8 +25,8 @@
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
namespace app {

View File

@ -32,8 +32,8 @@
#include "app/undo_transaction.h"
#include "app/undoers/add_layer.h"
#include "app/undoers/move_layer.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -29,7 +29,7 @@
#include "app/modules/editors.h"
#include "app/ui_context.h"
#include "base/path.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/ui.h"
#include "generated_duplicate_sprite.h"

View File

@ -39,13 +39,13 @@
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "base/convert_to.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/palette.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/ui.h"
#include "generated_export_sprite_sheet.h"
@ -329,7 +329,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
base::UniquePtr<Image> resultImage(Image::create(sprite->pixelFormat(), sheet_w, sheet_h));
base::UniquePtr<Image> tempImage(Image::create(sprite->pixelFormat(), sprite->width(), sprite->height()));
raster::clear_image(resultImage, 0);
doc::clear_image(resultImage, 0);
int column = 0, row = 0;
for (FrameNumber frame(0); frame<nframes; ++frame) {

View File

@ -33,8 +33,8 @@
#include "app/ui/color_bar.h"
#include "app/ui/editor/editor.h"
#include "app/ui_context.h"
#include "raster/image.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/sprite.h"
#include "ui/manager.h"
#include "ui/system.h"

View File

@ -26,7 +26,7 @@
#include "app/modules/gui.h"
#include "app/ui/color_bar.h"
#include "app/undo_transaction.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
namespace app {

View File

@ -33,13 +33,13 @@
#include "app/undo_transaction.h"
#include "app/util/range_utils.h"
#include "gfx/size.h"
#include "raster/algorithm/flip_image.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/algorithm/flip_image.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "doc/stock.h"
namespace app {
@ -49,7 +49,7 @@ FlipCommand::FlipCommand()
CmdRecordableFlag)
{
m_flipMask = false;
m_flipType = raster::algorithm::FlipHorizontal;
m_flipType = doc::algorithm::FlipHorizontal;
}
void FlipCommand::onLoadParams(Params* params)
@ -58,8 +58,8 @@ void FlipCommand::onLoadParams(Params* params)
m_flipMask = (target == "mask");
std::string orientation = params->get("orientation");
m_flipType = (orientation == "vertical" ? raster::algorithm::FlipVertical:
raster::algorithm::FlipHorizontal);
m_flipType = (orientation == "vertical" ? doc::algorithm::FlipVertical:
doc::algorithm::FlipHorizontal);
}
bool FlipCommand::onEnabled(Context* context)
@ -77,10 +77,10 @@ void FlipCommand::onExecute(Context* context)
{
UndoTransaction undoTransaction(writer.context(),
m_flipMask ?
(m_flipType == raster::algorithm::FlipHorizontal ?
(m_flipType == doc::algorithm::FlipHorizontal ?
"Flip Horizontal":
"Flip Vertical"):
(m_flipType == raster::algorithm::FlipHorizontal ?
(m_flipType == doc::algorithm::FlipHorizontal ?
"Flip Canvas Horizontal":
"Flip Canvas Vertical"));
@ -132,10 +132,10 @@ void FlipCommand::onExecute(Context* context)
if (!alreadyFlipped) {
api.setCelPosition
(sprite, cel,
(m_flipType == raster::algorithm::FlipHorizontal ?
(m_flipType == doc::algorithm::FlipHorizontal ?
sprite->width() - image->width() - cel->x():
cel->x()),
(m_flipType == raster::algorithm::FlipVertical ?
(m_flipType == doc::algorithm::FlipVertical ?
sprite->height() - image->height() - cel->y():
cel->y()));
@ -149,7 +149,7 @@ void FlipCommand::onExecute(Context* context)
// Create a flipped copy of the current mask.
base::UniquePtr<Mask> newMask(new Mask(*mask));
newMask->freeze();
raster::algorithm::flip_image(newMask->bitmap(),
doc::algorithm::flip_image(newMask->bitmap(),
maskBitmap->bounds(), m_flipType);
newMask->unfreeze();
@ -171,10 +171,10 @@ void FlipCommand::onExecute(Context* context)
api.setCelPosition
(sprite, cel,
(m_flipType == raster::algorithm::FlipHorizontal ?
(m_flipType == doc::algorithm::FlipHorizontal ?
sprite->width() - image->width() - cel->x():
cel->x()),
(m_flipType == raster::algorithm::FlipVertical ?
(m_flipType == doc::algorithm::FlipVertical ?
sprite->height() - image->height() - cel->y():
cel->y()));

View File

@ -21,7 +21,7 @@
#pragma once
#include "app/commands/command.h"
#include "raster/algorithm/flip_type.h"
#include "doc/algorithm/flip_type.h"
namespace app {
@ -30,7 +30,7 @@ namespace app {
FlipCommand();
Command* clone() const override { return new FlipCommand(*this); }
raster::algorithm::FlipType getFlipType() const { return m_flipType; }
doc::algorithm::FlipType getFlipType() const { return m_flipType; }
protected:
void onLoadParams(Params* params);
@ -39,7 +39,7 @@ namespace app {
private:
bool m_flipMask;
raster::algorithm::FlipType m_flipType;
doc::algorithm::FlipType m_flipType;
};
} // namespace app

View File

@ -31,7 +31,7 @@
#include "app/ui/timeline.h"
#include "app/undo_transaction.h"
#include "base/convert_to.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -27,7 +27,7 @@
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/ui/editor/editor.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/window.h"
namespace app {

View File

@ -27,8 +27,8 @@
#include "app/modules/gui.h"
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
namespace app {

View File

@ -39,13 +39,13 @@
#include "app/ui/workspace.h"
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/palette.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/ui.h"
namespace app {
@ -172,7 +172,7 @@ protected:
base::UniquePtr<Image> resultImage(Image::create(sprite->pixelFormat(), m_rect.w, m_rect.h));
// Clear the image with mask color.
raster::clear_image(resultImage, 0);
doc::clear_image(resultImage, 0);
// Render the portion of sheet.
sprite->render(resultImage, -x, -y, currentFrame);

View File

@ -27,10 +27,10 @@
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "base/unique_ptr.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/mask.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
namespace app {
@ -90,7 +90,7 @@ void InvertMaskCommand::onExecute(Context* context)
/* remove in the new mask the current sprite marked region */
const gfx::Rect& maskBounds = document->mask()->bounds();
raster::fill_rect(mask->bitmap(),
doc::fill_rect(mask->bitmap(),
maskBounds.x, maskBounds.y,
maskBounds.x + maskBounds.w-1,
maskBounds.y + maskBounds.h-1, 0);
@ -99,7 +99,7 @@ void InvertMaskCommand::onExecute(Context* context)
document->mask()->invert();
if (document->mask()->bitmap()) {
// Copy the inverted region in the new mask
raster::copy_image(mask->bitmap(),
doc::copy_image(mask->bitmap(),
document->mask()->bitmap(),
document->mask()->bounds().x,
document->mask()->bounds().y);

View File

@ -25,8 +25,8 @@
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -27,8 +27,8 @@
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/modules/gui.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "generated_layer_properties.h"

View File

@ -28,8 +28,8 @@
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "app/util/msk_file.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/alert.h"
namespace app {

View File

@ -27,7 +27,7 @@
#include "app/file/palette_file.h"
#include "app/file_selector.h"
#include "base/unique_ptr.h"
#include "raster/palette.h"
#include "doc/palette.h"
#include "ui/alert.h"
namespace app {
@ -57,7 +57,7 @@ void LoadPaletteCommand::onExecute(Context* context)
std::string filename = app::show_file_selector("Load Palette", "", exts);
if (!filename.empty()) {
base::UniquePtr<raster::Palette> palette(load_palette(filename.c_str()));
base::UniquePtr<doc::Palette> palette(load_palette(filename.c_str()));
if (!palette) {
Alert::show("Error<<Loading palette file||&Close");
}

View File

@ -25,8 +25,8 @@
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
namespace app {

View File

@ -37,9 +37,9 @@
#include "app/util/misc.h"
#include "base/bind.h"
#include "base/unique_ptr.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/label.h"

View File

@ -33,12 +33,12 @@
#include "app/undoers/replace_image.h"
#include "app/undoers/set_cel_position.h"
#include "base/unique_ptr.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/ui.h"
namespace app {
@ -150,15 +150,15 @@ void MergeDownLayerCommand::onExecute(Context* context)
y2 = MAX(src_cel->y()+src_image->height()-1, dst_cel->y()+dst_image->height()-1);
}
raster::color_t bgcolor = app_get_color_to_clear_layer(dst_layer);
doc::color_t bgcolor = app_get_color_to_clear_layer(dst_layer);
Image* new_image = raster::crop_image(dst_image,
Image* new_image = doc::crop_image(dst_image,
x1-dst_cel->x(),
y1-dst_cel->y(),
x2-x1+1, y2-y1+1, bgcolor);
// Merge src_image in new_image
raster::composite_image(new_image, src_image,
doc::composite_image(new_image, src_image,
src_cel->x()-x1,
src_cel->y()-y1,
src_cel->opacity(),

View File

@ -32,8 +32,8 @@
#include "app/ui/editor/editor.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_mask_position.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/view.h"
namespace app {

View File

@ -36,13 +36,13 @@
#include "app/ui_context.h"
#include "app/util/clipboard.h"
#include "base/unique_ptr.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/palette.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/ui.h"
#include "generated_new_sprite.h"
@ -75,7 +75,7 @@ NewFileCommand::NewFileCommand()
void NewFileCommand::onExecute(Context* context)
{
PixelFormat format;
int w, h, bg, ncolors = raster::Palette::MaxColors;
int w, h, bg, ncolors = doc::Palette::MaxColors;
char buf[1024];
app::Color bg_table[] = {
app::Color::fromMask(),
@ -179,7 +179,7 @@ void NewFileCommand::onExecute(Context* context)
layerImage->configureAsBackground();
Image* image = layerImage->getCel(FrameNumber(0))->image();
raster::clear_image(image,
doc::clear_image(image,
color_utils::color_for_target(color,
ColorTarget(
ColorTarget::BackgroundLayer,

View File

@ -31,10 +31,10 @@
#include "app/ui/main_window.h"
#include "app/ui/status_bar.h"
#include "app/undo_transaction.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "ui/ui.h"
#include <stdexcept>

View File

@ -31,8 +31,8 @@
#include "app/ui/main_window.h"
#include "app/ui/status_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "ui/ui.h"
#include <cstdio>

View File

@ -30,8 +30,8 @@
#include "app/modules/gui.h"
#include "app/ui/status_bar.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -36,7 +36,7 @@
#include "base/bind.h"
#include "base/thread.h"
#include "base/unique_ptr.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/ui.h"
#include <cstdio>

View File

@ -38,7 +38,7 @@
#include "app/util/render.h"
#include "base/bind.h"
#include "base/path.h"
#include "raster/image.h"
#include "doc/image.h"
#include "she/system.h"
#include "ui/ui.h"

View File

@ -52,11 +52,11 @@
#include "gfx/hsv.h"
#include "gfx/rgb.h"
#include "gfx/size.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/quantization.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/quantization.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/graphics.h"
#include "ui/ui.h"
@ -601,7 +601,7 @@ void PaletteEntryEditor::setPaletteEntry(const app::Color& color)
PaletteView::SelectedEntries entries;
palView->getSelectedEntries(entries);
color_t new_pal_color = raster::rgba(color.getRed(),
color_t new_pal_color = doc::rgba(color.getRed(),
color.getGreen(),
color.getBlue(), 255);
@ -697,7 +697,7 @@ void PaletteEntryEditor::setPaletteEntryChannel(const app::Color& color, ColorSl
break;
}
palette->setEntry(c, raster::rgba(r, g, b, 255));
palette->setEntry(c, doc::rgba(r, g, b, 255));
}
}
}

View File

@ -23,8 +23,8 @@
#include "app/commands/command.h"
#include "app/context.h"
#include "app/util/clipboard.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
namespace app {

View File

@ -35,9 +35,9 @@
#include "app/ui/editor/editor.h"
#include "app/ui/main_window.h"
#include "app/ui/mini_editor.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/sprite.h"
namespace app {

View File

@ -34,11 +34,11 @@
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "app/util/render.h"
#include "raster/conversion_she.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "doc/conversion_she.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "she/scoped_handle.h"
#include "she/surface.h"
#include "she/system.h"
@ -49,7 +49,7 @@
namespace app {
using namespace ui;
using namespace raster;
using namespace doc;
using namespace filters;
class PreviewWindow : public Window {
@ -207,7 +207,7 @@ protected:
if (m_index_bg_color == -1)
RenderEngine::renderCheckedBackground(m_doublebuf, -m_pos.x, -m_pos.y, m_zoom);
else
raster::clear_image(m_doublebuf, m_pal->getEntry(m_index_bg_color));
doc::clear_image(m_doublebuf, m_pal->getEntry(m_index_bg_color));
switch (m_tiled) {
case TILED_NONE:
@ -228,7 +228,7 @@ protected:
break;
}
raster::convert_image_to_surface(m_doublebuf, m_pal,
doc::convert_image_to_surface(m_doublebuf, m_pal,
m_doublesur, 0, 0, 0, 0, m_doublebuf->width(), m_doublebuf->height());
g->blit(m_doublesur, 0, 0, 0, 0, m_doublesur->width(), m_doublesur->height());
}

View File

@ -28,7 +28,7 @@
#include "app/ui/main_window.h"
#include "app/ui/timeline.h"
#include "app/undo_transaction.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -29,8 +29,8 @@
#include "app/ui/status_bar.h"
#include "app/ui/timeline.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "ui/alert.h"
#include "ui/widget.h"

View File

@ -25,8 +25,8 @@
#include "app/modules/gui.h"
#include "app/undo_transaction.h"
#include "app/undoers/set_mask.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
namespace app {

View File

@ -33,11 +33,11 @@
#include "app/ui/timeline.h"
#include "app/undo_transaction.h"
#include "app/util/range_utils.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/ui.h"
namespace app {
@ -117,7 +117,7 @@ protected:
Image* new_image = Image::create(image->pixelFormat(),
m_angle == 180 ? image->width(): image->height(),
m_angle == 180 ? image->height(): image->width());
raster::rotate_image(image, new_image, m_angle);
doc::rotate_image(image, new_image, m_angle);
api.replaceStockImage(m_sprite, cel->imageIndex(), new_image);
}
@ -156,7 +156,7 @@ protected:
new_mask->replace(x, y,
m_angle == 180 ? origBounds.w: origBounds.h,
m_angle == 180 ? origBounds.h: origBounds.w);
raster::rotate_image(origMask->bitmap(), new_mask->bitmap(), m_angle);
doc::rotate_image(origMask->bitmap(), new_mask->bitmap(), m_angle);
// Copy new mask
api.copyToCurrentMask(new_mask);

View File

@ -36,7 +36,7 @@
#include "base/path.h"
#include "base/thread.h"
#include "base/unique_ptr.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -26,8 +26,8 @@
#include "app/util/msk_file.h"
#include "base/fs.h"
#include "base/path.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/alert.h"
namespace app {

View File

@ -26,7 +26,7 @@
#include "app/modules/palettes.h"
#include "base/fs.h"
#include "base/path.h"
#include "raster/palette.h"
#include "doc/palette.h"
#include "ui/alert.h"
namespace app {
@ -70,7 +70,7 @@ again:
return;
}
raster::Palette* palette = get_current_palette();
doc::Palette* palette = get_current_palette();
if (!save_palette(filename.c_str(), palette)) {
Alert::show("Error<<Saving palette file||&Close");
}

View File

@ -28,7 +28,7 @@
#include "app/modules/palettes.h"
#include "app/undo_transaction.h"
#include "base/unique_ptr.h"
#include "raster/palette.h"
#include "doc/palette.h"
#include "ui/alert.h"
#include "ui/manager.h"

View File

@ -22,7 +22,7 @@
#include "app/commands/command.h"
namespace raster {
namespace doc {
class Palette;
}
@ -35,14 +35,14 @@ namespace app {
SetPaletteCommand();
Command* clone() const override { return new SetPaletteCommand(*this); }
void setPalette(raster::Palette* palette) { m_palette = palette; }
void setPalette(doc::Palette* palette) { m_palette = palette; }
void setTarget(Target target) { m_target = target; }
protected:
virtual void onExecute(Context* context) override;
private:
raster::Palette* m_palette;
doc::Palette* m_palette;
Target m_target;
};

View File

@ -31,9 +31,9 @@
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "base/mem_utils.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/palette.h"
#include "doc/sprite.h"
#include "ui/ui.h"
#include <cstdio>

View File

@ -33,13 +33,13 @@
#include "app/undo_transaction.h"
#include "base/bind.h"
#include "base/unique_ptr.h"
#include "raster/algorithm/resize_image.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/primitives.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/algorithm/resize_image.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/mask.h"
#include "doc/primitives.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/ui.h"
#define PERC_FORMAT "%.1f"
@ -47,7 +47,7 @@
namespace app {
using namespace ui;
using raster::algorithm::ResizeMethod;
using doc::algorithm::ResizeMethod;
class SpriteSizeJob : public Job {
ContextWriter m_writer;
@ -105,8 +105,8 @@ protected:
int h = scale_y(image->height());
Image* new_image = Image::create(image->pixelFormat(), MAX(1, w), MAX(1, h));
raster::algorithm::fixup_image_transparent_colors(image);
raster::algorithm::resize_image(image, new_image,
doc::algorithm::fixup_image_transparent_colors(image);
doc::algorithm::resize_image(image, new_image,
m_resize_method,
m_sprite->getPalette(cel->frame()),
m_sprite->getRgbMap(cel->frame()));
@ -220,7 +220,7 @@ void SpriteSizeCommand::onExecute(Context* context)
method->addItem("Nearest-neighbor");
method->addItem("Bilinear");
method->setSelectedItemIndex(get_config_int("SpriteSize", "Method",
raster::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR));
doc::algorithm::RESIZE_METHOD_NEAREST_NEIGHBOR));
window->remapWindow();
window->centerWindow();

View File

@ -32,7 +32,7 @@
#include "app/ui/editor/editor.h"
#include "app/ui/status_bar.h"
#include "base/thread.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/system.h"
namespace app {

View File

@ -33,8 +33,8 @@
#include "base/bind.h"
#include "filters/color_curve.h"
#include "filters/color_curve_filter.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -35,8 +35,8 @@
#include "base/bind.h"
#include "filters/convolution_matrix.h"
#include "filters/convolution_matrix_filter.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/button.h"
#include "ui/label.h"
#include "ui/listbox.h"

View File

@ -32,8 +32,8 @@
#include "app/settings/settings.h"
#include "base/bind.h"
#include "filters/median_filter.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/button.h"
#include "ui/entry.h"
#include "ui/grid.h"

View File

@ -30,9 +30,9 @@
#include "filters/invert_color_filter.h"
#include "app/ini_file.h"
#include "app/modules/gui.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/button.h"
#include "ui/label.h"
#include "ui/slider.h"

View File

@ -36,9 +36,9 @@
#include "app/ui/color_button.h"
#include "base/bind.h"
#include "filters/replace_color_filter.h"
#include "raster/image.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "doc/image.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -29,13 +29,13 @@
#include "app/undo_transaction.h"
#include "app/undoers/image_area.h"
#include "filters/filter.h"
#include "raster/cel.h"
#include "raster/image.h"
#include "raster/images_collector.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/image.h"
#include "doc/images_collector.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include "ui/manager.h"
#include "ui/view.h"
#include "ui/widget.h"

View File

@ -25,13 +25,13 @@
#include "base/unique_ptr.h"
#include "filters/filter_indexed_data.h"
#include "filters/filter_manager.h"
#include "raster/image_bits.h"
#include "raster/image_traits.h"
#include "raster/pixel_format.h"
#include "doc/image_bits.h"
#include "doc/image_traits.h"
#include "doc/pixel_format.h"
#include <cstring>
namespace raster {
namespace doc {
class Image;
class Layer;
class Mask;
@ -131,8 +131,8 @@ namespace app {
int m_offset_x, m_offset_y;
Mask* m_mask;
base::UniquePtr<Mask> m_preview_mask;
raster::ImageBits<raster::BitmapTraits> m_maskBits;
raster::ImageBits<raster::BitmapTraits>::iterator m_maskIterator;
doc::ImageBits<doc::BitmapTraits> m_maskBits;
doc::ImageBits<doc::BitmapTraits>::iterator m_maskIterator;
Target m_targetOrig; // Original targets
Target m_target; // Filtered targets

View File

@ -23,7 +23,7 @@
#include "app/commands/filters/filter_preview.h"
#include "app/commands/filters/filter_manager_impl.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/manager.h"
#include "ui/message.h"
#include "ui/widget.h"

View File

@ -26,7 +26,7 @@
#include "app/modules/gui.h"
#include "app/ui/skin/skin_parts.h"
#include "base/bind.h"
#include "raster/image.h"
#include "doc/image.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/theme.h"

View File

@ -34,7 +34,7 @@
#include "base/mutex.h"
#include "base/scoped_lock.h"
#include "base/thread.h"
#include "raster/sprite.h"
#include "doc/sprite.h"
#include "ui/ui.h"
namespace app {

View File

@ -25,10 +25,10 @@
#include "app/context.h"
#include "app/document.h"
#include "app/document_location.h"
#include "raster/cel.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "doc/stock.h"
namespace app {

View File

@ -36,17 +36,17 @@
#include "base/unique_ptr.h"
#include "doc/document_event.h"
#include "doc/document_observer.h"
#include "raster/cel.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/palette.h"
#include "doc/sprite.h"
#include "doc/stock.h"
namespace app {
using namespace base;
using namespace raster;
using namespace doc;
Document::Document(Sprite* sprite)
: m_undo(new DocumentUndo)

View File

@ -27,8 +27,8 @@
#include "base/unique_ptr.h"
#include "doc/document.h"
#include "gfx/transformation.h"
#include "raster/frame_number.h"
#include "raster/pixel_format.h"
#include "doc/frame_number.h"
#include "doc/pixel_format.h"
#include <string>
@ -36,7 +36,7 @@ namespace base {
class mutex;
}
namespace raster {
namespace doc {
class Cel;
class Image;
class Layer;
@ -57,7 +57,7 @@ namespace app {
class DocumentUndo;
struct BoundSeg;
using namespace raster;
using namespace doc;
enum DuplicateType {
DuplicateExactCopy,

View File

@ -62,19 +62,19 @@
#include "doc/context.h"
#include "doc/document_event.h"
#include "doc/document_observer.h"
#include "raster/algorithm/flip_image.h"
#include "raster/algorithm/shrink_bounds.h"
#include "raster/blend.h"
#include "raster/cel.h"
#include "raster/dirty.h"
#include "raster/image.h"
#include "raster/image_bits.h"
#include "raster/layer.h"
#include "raster/mask.h"
#include "raster/palette.h"
#include "raster/quantization.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/algorithm/flip_image.h"
#include "doc/algorithm/shrink_bounds.h"
#include "doc/blend.h"
#include "doc/cel.h"
#include "doc/dirty.h"
#include "doc/image.h"
#include "doc/image_bits.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/palette.h"
#include "doc/quantization.h"
#include "doc/sprite.h"
#include "doc/stock.h"
namespace app {
@ -147,7 +147,7 @@ void DocumentApi::trimSprite(Sprite* sprite)
// TODO configurable (what color pixel to use as "refpixel",
// here we are using the top-left pixel by default)
gfx::Rect frameBounds;
if (raster::algorithm::shrink_bounds(image, frameBounds, get_pixel(image, 0, 0)))
if (doc::algorithm::shrink_bounds(image, frameBounds, get_pixel(image, 0, 0)))
bounds = bounds.createUnion(frameBounds);
}
@ -299,7 +299,7 @@ void DocumentApi::displaceFrames(Layer* layer, FrameNumber frame)
switch (layer->type()) {
case OBJECT_LAYER_IMAGE: {
case ObjectType::LayerImage: {
LayerImage* imglayer = static_cast<LayerImage*>(layer);
// Displace all cels in '>=frame' to the next frame.
@ -318,7 +318,7 @@ void DocumentApi::displaceFrames(Layer* layer, FrameNumber frame)
break;
}
case OBJECT_LAYER_FOLDER: {
case ObjectType::LayerFolder: {
LayerIterator it = static_cast<LayerFolder*>(layer)->getLayerBegin();
LayerIterator end = static_cast<LayerFolder*>(layer)->getLayerEnd();
@ -337,13 +337,13 @@ void DocumentApi::copyFrameForLayer(Layer* layer, FrameNumber fromFrame, FrameNu
switch (layer->type()) {
case OBJECT_LAYER_IMAGE: {
case ObjectType::LayerImage: {
LayerImage* imglayer = static_cast<LayerImage*>(layer);
copyCel(imglayer, fromFrame, imglayer, frame);
break;
}
case OBJECT_LAYER_FOLDER: {
case ObjectType::LayerFolder: {
LayerIterator it = static_cast<LayerFolder*>(layer)->getLayerBegin();
LayerIterator end = static_cast<LayerFolder*>(layer)->getLayerEnd();
@ -390,7 +390,7 @@ void DocumentApi::removeFrameOfLayer(Layer* layer, FrameNumber frame)
switch (layer->type()) {
case OBJECT_LAYER_IMAGE: {
case ObjectType::LayerImage: {
LayerImage* imglayer = static_cast<LayerImage*>(layer);
if (Cel* cel = imglayer->getCel(frame))
removeCel(cel);
@ -401,7 +401,7 @@ void DocumentApi::removeFrameOfLayer(Layer* layer, FrameNumber frame)
break;
}
case OBJECT_LAYER_FOLDER: {
case ObjectType::LayerFolder: {
LayerIterator it = static_cast<LayerFolder*>(layer)->getLayerBegin();
LayerIterator end = static_cast<LayerFolder*>(layer)->getLayerEnd();
@ -501,7 +501,7 @@ void DocumentApi::moveFrameLayer(Layer* layer, FrameNumber frame, FrameNumber be
switch (layer->type()) {
case OBJECT_LAYER_IMAGE: {
case ObjectType::LayerImage: {
LayerImage* imglayer = static_cast<LayerImage*>(layer);
CelList cels;
@ -542,7 +542,7 @@ void DocumentApi::moveFrameLayer(Layer* layer, FrameNumber frame, FrameNumber be
break;
}
case OBJECT_LAYER_FOLDER: {
case ObjectType::LayerFolder: {
LayerIterator it = static_cast<LayerFolder*>(layer)->getLayerBegin();
LayerIterator end = static_cast<LayerFolder*>(layer)->getLayerEnd();
@ -931,7 +931,7 @@ void DocumentApi::displaceLayers(Layer* layer, int dx, int dy)
{
switch (layer->type()) {
case OBJECT_LAYER_IMAGE: {
case ObjectType::LayerImage: {
CelIterator it = ((LayerImage*)layer)->getCelBegin();
CelIterator end = ((LayerImage*)layer)->getCelEnd();
for (; it != end; ++it) {
@ -941,7 +941,7 @@ void DocumentApi::displaceLayers(Layer* layer, int dx, int dy)
break;
}
case OBJECT_LAYER_FOLDER: {
case ObjectType::LayerFolder: {
LayerIterator it = ((LayerFolder*)layer)->getLayerBegin();
LayerIterator end = ((LayerFolder*)layer)->getLayerEnd();
for (; it != end; ++it)
@ -1259,7 +1259,7 @@ void DocumentApi::clearMask(Cel* cel)
}
void DocumentApi::flipImage(Image* image, const gfx::Rect& bounds,
raster::algorithm::FlipType flipType)
doc::algorithm::FlipType flipType)
{
// Insert the undo operation.
if (undoEnabled()) {
@ -1269,16 +1269,16 @@ void DocumentApi::flipImage(Image* image, const gfx::Rect& bounds,
}
// Flip the portion of the bitmap.
raster::algorithm::flip_image(image, bounds, flipType);
doc::algorithm::flip_image(image, bounds, flipType);
}
void DocumentApi::flipImageWithMask(Layer* layer, Image* image, const Mask* mask, raster::algorithm::FlipType flipType)
void DocumentApi::flipImageWithMask(Layer* layer, Image* image, const Mask* mask, doc::algorithm::FlipType flipType)
{
base::UniquePtr<Image> flippedImage((Image::createCopy(image)));
color_t bgcolor = bgColor(layer);
// Flip the portion of the bitmap.
raster::algorithm::flip_image_with_mask(flippedImage, mask, flipType, bgcolor);
doc::algorithm::flip_image_with_mask(flippedImage, mask, flipType, bgcolor);
// Insert the undo operation.
if (undoEnabled()) {
@ -1365,7 +1365,7 @@ bool DocumentApi::undoEnabled()
m_document->getUndo()->isEnabled();
}
raster::color_t DocumentApi::bgColor()
doc::color_t DocumentApi::bgColor()
{
app::ISettings* appSettings =
dynamic_cast<app::ISettings*>(m_document->context()->settings());
@ -1377,7 +1377,7 @@ raster::color_t DocumentApi::bgColor()
m_document->sprite()->transparentColor()));
}
raster::color_t DocumentApi::bgColor(Layer* layer)
doc::color_t DocumentApi::bgColor(Layer* layer)
{
app::ISettings* appSettings =
dynamic_cast<app::ISettings*>(m_document->context()->settings());

View File

@ -21,13 +21,13 @@
#pragma once
#include "gfx/rect.h"
#include "raster/algorithm/flip_type.h"
#include "raster/color.h"
#include "raster/dithering_method.h"
#include "raster/frame_number.h"
#include "raster/pixel_format.h"
#include "doc/algorithm/flip_type.h"
#include "doc/color.h"
#include "doc/dithering_method.h"
#include "doc/frame_number.h"
#include "doc/pixel_format.h"
namespace raster {
namespace doc {
class Cel;
class Image;
class Layer;
@ -46,12 +46,11 @@ namespace undo {
namespace app {
class Document;
using namespace raster;
using namespace doc;
// High-level API to modify a document in an undoable and observable way.
// Each method of this class take care of three important things:
// 1) Do the given action with low-level operations (raster
// namespace mainly),
// 1) Do the given action with low-level operations (doc namespace mainly),
// 2) Add undoers so the action can be undone in the
// future (undoers namespace mainly),
// 3) Notify observers of the document that a change
@ -116,8 +115,8 @@ namespace app {
// Image API
void clearImage(Image* image, color_t bgcolor);
void clearMask(Cel* cel);
void flipImage(Image* image, const gfx::Rect& bounds, raster::algorithm::FlipType flipType);
void flipImageWithMask(Layer* layer, Image* image, const Mask* mask, raster::algorithm::FlipType flipType);
void flipImage(Image* image, const gfx::Rect& bounds, doc::algorithm::FlipType flipType);
void flipImageWithMask(Layer* layer, Image* image, const Mask* mask, doc::algorithm::FlipType flipType);
void pasteImage(Sprite* sprite, Cel* cel, const Image* src_image, int x, int y, int opacity);
// Mask API
@ -139,8 +138,8 @@ namespace app {
void configureLayerAsBackground(LayerImage* layer);
bool undoEnabled();
raster::color_t bgColor();
raster::color_t bgColor(Layer* layer);
doc::color_t bgColor();
doc::color_t bgColor(Layer* layer);
Document* m_document;
undo::UndoersCollector* m_undoers;

View File

@ -30,19 +30,19 @@
#include "base/path.h"
#include "base/unique_ptr.h"
#include "gfx/size.h"
#include "raster/cel.h"
#include "raster/dithering_method.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/dithering_method.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/palette.h"
#include "doc/sprite.h"
#include "doc/stock.h"
#include <cstdio>
#include <fstream>
#include <iostream>
using namespace raster;
using namespace doc;
namespace app {

View File

@ -27,7 +27,7 @@
#include <vector>
#include <string>
namespace raster {
namespace doc {
class Image;
}
@ -94,8 +94,8 @@ namespace app {
void captureSamples(Samples& samples);
Document* createEmptyTexture(const Samples& samples);
void renderTexture(const Samples& samples, raster::Image* textureImage);
void createDataFile(const Samples& samples, std::ostream& os, raster::Image* textureImage);
void renderTexture(const Samples& samples, doc::Image* textureImage);
void createDataFile(const Samples& samples, std::ostream& os, doc::Image* textureImage);
DataFormat m_dataFormat;
std::string m_dataFilename;

View File

@ -22,14 +22,14 @@
#include "app/document_location.h"
#include "raster/cel.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "raster/stock.h"
#include "doc/cel.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "doc/stock.h"
namespace app {
using namespace raster;
using namespace doc;
LayerIndex DocumentLocation::layerIndex() const
{

View File

@ -20,10 +20,10 @@
#define APP_DOCUMENT_LOCATION_H_INCLUDED
#pragma once
#include "raster/frame_number.h"
#include "raster/layer_index.h"
#include "doc/frame_number.h"
#include "doc/layer_index.h"
namespace raster {
namespace doc {
class Cel;
class Image;
class Layer;
@ -34,7 +34,7 @@ namespace raster {
namespace app {
class Document;
using namespace raster;
using namespace doc;
// Specifies the current location in a context. If we are in the
// UIContext, it means the location in the current Editor (current

View File

@ -24,7 +24,7 @@
namespace app {
using namespace raster;
using namespace doc;
void DocumentRange::startRange(LayerIndex layer, FrameNumber frame, Type type)
{

View File

@ -20,13 +20,13 @@
#define APP_DOCUMENT_RANGE_H_INCLUDED
#pragma once
#include "raster/frame_number.h"
#include "raster/layer_index.h"
#include "doc/frame_number.h"
#include "doc/layer_index.h"
#include <algorithm>
namespace app {
using namespace raster;
using namespace doc;
class DocumentRange {
public:

View File

@ -27,8 +27,8 @@
#include "app/document_api.h"
#include "app/document_range.h"
#include "app/undo_transaction.h"
#include "raster/layer.h"
#include "raster/sprite.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include <stdexcept>

View File

@ -25,11 +25,11 @@
#include "app/document_undo.h"
#include "app/test_context.h"
#include "base/unique_ptr.h"
#include "raster/raster.h"
#include "doc/doc.h"
#include "undo/undo_history.h"
using namespace app;
using namespace raster;
using namespace doc;
namespace app {
@ -40,7 +40,7 @@ namespace app {
}
typedef base::UniquePtr<Document> DocumentPtr;
typedef base::UniquePtr<app::Document> DocumentPtr;
#define EXPECT_LAYER_ORDER(a, b, c, d) \
EXPECT_TRUE(expect_layer(a, 0)); \
@ -84,7 +84,7 @@ public:
black = rgba(0, 0, 0, 0);
white = rgba(255, 255, 255, 255);
doc.reset(static_cast<Document*>(ctx.documents().add(4, 4)));
doc.reset(static_cast<app::Document*>(ctx.documents().add(4, 4)));
sprite = doc->sprite();
layer1 = dynamic_cast<LayerImage*>(sprite->folder()->getFirstLayer());
layer2 = new LayerImage(sprite);

View File

@ -22,7 +22,7 @@
#include "base/disable_copying.h"
#include "base/unique_ptr.h"
#include "raster/sprite_position.h"
#include "doc/sprite_position.h"
#include "undo/undo_history.h"
namespace doc {
@ -39,7 +39,7 @@ namespace app {
class CloseGroup;
}
using namespace raster;
using namespace doc;
class DocumentUndo : public undo::UndoHistoryDelegate {
public:

View File

@ -27,7 +27,7 @@
#include "base/cfile.h"
#include "base/exception.h"
#include "base/file_handle.h"
#include "raster/raster.h"
#include "doc/doc.h"
#include "zlib.h"
#include <stdio.h>

View File

@ -27,7 +27,7 @@
#include "app/file/format_options.h"
#include "base/cfile.h"
#include "base/file_handle.h"
#include "raster/raster.h"
#include "doc/doc.h"
namespace app {

View File

@ -38,8 +38,8 @@
#include "base/scoped_lock.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "raster/quantization.h"
#include "raster/raster.h"
#include "doc/quantization.h"
#include "doc/doc.h"
#include "ui/alert.h"
#include <cstring>

View File

@ -21,8 +21,8 @@
#pragma once
#include "base/shared_ptr.h"
#include "raster/frame_number.h"
#include "raster/pixel_format.h"
#include "doc/frame_number.h"
#include "doc/pixel_format.h"
#include <stdio.h>
#include <string>
@ -41,7 +41,7 @@ namespace doc {
class Document;
}
namespace raster {
namespace doc {
class Cel;
class Image;
class Layer;
@ -56,7 +56,7 @@ namespace app {
class FileFormat;
class FormatOptions;
using namespace raster;
using namespace doc;
// File operations.
typedef enum {

View File

@ -23,7 +23,7 @@
#include "app/document.h"
#include "app/file/file.h"
#include "app/file/file_formats_manager.h"
#include "raster/raster.h"
#include "doc/doc.h"
#include "she/she.h"
#include <cstdio>
@ -69,7 +69,7 @@ TEST(File, SeveralSizes)
}
{
Document* doc = load_document(&ctx, &fn[0]);
app::Document* doc = load_document(&ctx, &fn[0]);
ASSERT_EQ(w, doc->sprite()->width());
ASSERT_EQ(h, doc->sprite()->height());

View File

@ -27,7 +27,7 @@
#include "app/file/format_options.h"
#include "app/modules/palettes.h"
#include "base/file_handle.h"
#include "raster/raster.h"
#include "doc/doc.h"
#include <cstdio>

View File

@ -32,7 +32,7 @@
#include "app/util/autocrop.h"
#include "base/file_handle.h"
#include "base/unique_ptr.h"
#include "raster/raster.h"
#include "doc/doc.h"
#include "ui/alert.h"
#include "ui/button.h"
@ -614,7 +614,7 @@ bool GifFormat::onSave(FileOp* fop)
if (sprite_format != IMAGE_INDEXED &&
gif_options->quantize() == GifOptions::QuantizeAll) {
// Feed the optimizer with all rendered frames.
raster::quantization::PaletteOptimizer optimizer;
doc::quantization::PaletteOptimizer optimizer;
for (FrameNumber frame_num(0); frame_num<sprite->totalFrames(); ++frame_num) {
clear_image(buffer_image, background_color);
layer_render(sprite->folder(), buffer_image, 0, 0, frame_num);
@ -644,7 +644,7 @@ bool GifFormat::onSave(FileOp* fop)
std::vector<Image*> imgarray(1);
imgarray[0] = buffer_image;
raster::quantization::create_palette_from_images(imgarray, &current_palette, has_background);
doc::quantization::create_palette_from_images(imgarray, &current_palette, has_background);
rgbmap.regenerate(&current_palette, transparent_index);
}
break;
@ -811,7 +811,7 @@ SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
// Configuration parameters
gif_options->setQuantize((GifOptions::Quantize)get_config_int("GIF", "Quantize", (int)gif_options->quantize()));
gif_options->setInterlaced(get_config_bool("GIF", "Interlaced", gif_options->interlaced()));
gif_options->setDithering((raster::DitheringMethod)get_config_int("GIF", "Dither", (int)gif_options->dithering()));
gif_options->setDithering((doc::DitheringMethod)get_config_int("GIF", "Dither", (int)gif_options->dithering()));
// Load the window to ask to the user the GIF options he wants.
@ -826,7 +826,7 @@ SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
win.interlaced()->setSelected(gif_options->interlaced());
win.dither()->setEnabled(true);
win.dither()->setSelected(gif_options->dithering() == raster::DITHERING_ORDERED);
win.dither()->setSelected(gif_options->dithering() == doc::DITHERING_ORDERED);
win.openWindowInForeground();
@ -840,8 +840,8 @@ SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
gif_options->setInterlaced(win.interlaced()->isSelected());
gif_options->setDithering(win.dither()->isSelected() ?
raster::DITHERING_ORDERED:
raster::DITHERING_NONE);
doc::DITHERING_ORDERED:
doc::DITHERING_NONE);
set_config_int("GIF", "Quantize", gif_options->quantize());
set_config_bool("GIF", "Interlaced", gif_options->interlaced());

View File

@ -21,7 +21,7 @@
#pragma once
#include "app/file/format_options.h"
#include "raster/dithering_method.h"
#include "doc/dithering_method.h"
namespace app {
@ -33,7 +33,7 @@ namespace app {
GifOptions(
Quantize quantize = QuantizeEach,
bool interlaced = false,
DitheringMethod dithering = raster::DITHERING_NONE)
DitheringMethod dithering = doc::DITHERING_NONE)
: m_quantize(quantize)
, m_interlaced(interlaced)
, m_dithering(dithering) {
@ -41,16 +41,16 @@ namespace app {
Quantize quantize() const { return m_quantize; }
bool interlaced() const { return m_interlaced; }
raster::DitheringMethod dithering() const { return m_dithering; }
doc::DitheringMethod dithering() const { return m_dithering; }
void setQuantize(const Quantize quantize) { m_quantize = quantize; }
void setInterlaced(bool interlaced) { m_interlaced = interlaced; }
void setDithering(const raster::DitheringMethod dithering) { m_dithering = dithering; }
void setDithering(const doc::DitheringMethod dithering) { m_dithering = dithering; }
private:
Quantize m_quantize;
bool m_interlaced;
raster::DitheringMethod m_dithering;
doc::DitheringMethod m_dithering;
};
} // namespace app

View File

@ -24,7 +24,7 @@
#include "app/file/file_formats_manager.h"
#include "app/file/gif_options.h"
#include "app/test_context.h"
#include "raster/raster.h"
#include "doc/doc.h"
#include "she/scoped_handle.h"
#include "she/system.h"
@ -64,7 +64,7 @@ TEST_F(GifFormat, Dimensions)
}
{
Document* doc = load_document(&m_ctx, fn);
app::Document* doc = load_document(&m_ctx, fn);
Sprite* sprite = doc->sprite();
EXPECT_EQ(31, sprite->width());
@ -111,7 +111,7 @@ TEST_F(GifFormat, OpaqueIndexed)
}
{
Document* doc = load_document(&m_ctx, fn);
app::Document* doc = load_document(&m_ctx, fn);
Sprite* sprite = doc->sprite();
LayerImage* layer = dynamic_cast<LayerImage*>(sprite->folder()->getFirstLayer());
@ -167,7 +167,7 @@ TEST_F(GifFormat, TransparentIndexed)
}
{
Document* doc = load_document(&m_ctx, fn);
app::Document* doc = load_document(&m_ctx, fn);
Sprite* sprite = doc->sprite();
LayerImage* layer = dynamic_cast<LayerImage*>(sprite->folder()->getFirstLayer());
@ -217,7 +217,7 @@ TEST_F(GifFormat, TransparentRgbQuantization)
}
{
Document* doc = load_document(&m_ctx, fn);
app::Document* doc = load_document(&m_ctx, fn);
Sprite* sprite = doc->sprite();
LayerImage* layer = dynamic_cast<LayerImage*>(sprite->folder()->getFirstLayer());
@ -263,7 +263,7 @@ TEST_F(GifFormat, OpaqueRgbQuantization)
}
{
Document* doc = load_document(&m_ctx, fn);
app::Document* doc = load_document(&m_ctx, fn);
Sprite* sprite = doc->sprite();
LayerImage* layer = dynamic_cast<LayerImage*>(sprite->folder()->getFirstLayer());
@ -289,7 +289,7 @@ TEST_F(GifFormat, OpaqueRgbQuantizationTwoLayers)
const char* fn = "test.gif";
{
Document* doc(static_cast<Document*>(m_ctx.documents().add(2, 2, doc::ColorMode::RGB, 256)));
app::Document* doc(static_cast<app::Document*>(m_ctx.documents().add(2, 2, doc::ColorMode::RGB, 256)));
Sprite* sprite = doc->sprite();
doc->setFilename(fn);
@ -322,7 +322,7 @@ TEST_F(GifFormat, OpaqueRgbQuantizationTwoLayers)
}
{
Document* doc = load_document(&m_ctx, fn);
app::Document* doc = load_document(&m_ctx, fn);
Sprite* sprite = doc->sprite();
LayerImage* layer = dynamic_cast<LayerImage*>(sprite->folder()->getFirstLayer());

View File

@ -28,7 +28,7 @@
#include "app/file/format_options.h"
#include "base/cfile.h"
#include "base/file_handle.h"
#include "raster/raster.h"
#include "doc/doc.h"
namespace app {

View File

@ -33,7 +33,7 @@
#include "app/load_widget.h"
#include "base/file_handle.h"
#include "base/memory.h"
#include "raster/raster.h"
#include "doc/doc.h"
#include "ui/ui.h"
#include <csetjmp>

View File

@ -27,17 +27,17 @@
#include "app/file/file_formats_manager.h"
#include "base/path.h"
#include "base/string.h"
#include "raster/cel.h"
#include "raster/file/col_file.h"
#include "raster/file/gpl_file.h"
#include "raster/image.h"
#include "raster/layer.h"
#include "raster/palette.h"
#include "raster/sprite.h"
#include "doc/cel.h"
#include "doc/file/col_file.h"
#include "doc/file/gpl_file.h"
#include "doc/image.h"
#include "doc/layer.h"
#include "doc/palette.h"
#include "doc/sprite.h"
namespace app {
using namespace raster;
using namespace doc;
void get_readable_palette_extensions(char* buf, int size)
{
@ -57,10 +57,10 @@ Palette* load_palette(const char *filename)
Palette* pal = NULL;
if (ext == "col") {
pal = raster::file::load_col_file(filename);
pal = doc::file::load_col_file(filename);
}
else if (ext == "gpl") {
pal = raster::file::load_gpl_file(filename);
pal = doc::file::load_gpl_file(filename);
}
else {
FileFormat* ff = FileFormatsManager::instance()->getFileFormatByExtension(ext.c_str());
@ -101,10 +101,10 @@ bool save_palette(const char *filename, Palette* pal)
bool success = false;
if (ext == "col") {
success = raster::file::save_col_file(pal, filename);
success = doc::file::save_col_file(pal, filename);
}
else if (ext == "gpl") {
success = raster::file::save_gpl_file(pal, filename);
success = doc::file::save_gpl_file(pal, filename);
}
else {
FileFormat* ff = FileFormatsManager::instance()->getFileFormatByExtension(ext.c_str());

Some files were not shown because too many files have changed in this diff Show More